class Tr8n::Component

Public Class Methods

cache_key(key) click to toggle source
# File lib/tr8n/component.rb, line 74
def self.cache_key(key)
  "#{cache_prefix}_[#{key}]"
end
cache_prefix() click to toggle source

Cache Methods

# File lib/tr8n/component.rb, line 70
def self.cache_prefix
  'c@'
end

Public Instance Methods

languages() click to toggle source
# File lib/tr8n/component.rb, line 45
def languages
  application.api_client.get("component/languages", {:key => key}, {:class => Tr8n::Language, :application => application})
end
live?() click to toggle source
# File lib/tr8n/component.rb, line 57
def live?
  state == 'live'
end
register_source(source) click to toggle source
# File lib/tr8n/component.rb, line 49
def register_source(source)
  application.api_client.post("component/register_source", {:key => key, :source => source.source})
end
restricted?() click to toggle source
# File lib/tr8n/component.rb, line 53
def restricted?
  state == 'restricted'
end
sources() click to toggle source
# File lib/tr8n/component.rb, line 37
def sources
  application.api_client.get("component/sources", {:key => key}, {:class => Tr8n::Source, :application => application})
end
translator_authorized?(translator) click to toggle source
# File lib/tr8n/component.rb, line 61
def translator_authorized?(translator)
  return true unless restricted?
  translators.include?(translator)
end
translators() click to toggle source
# File lib/tr8n/component.rb, line 41
def translators
  application.api_client.get("component/translators", {:key => key}, {:class => Tr8n::Translator, :application => application})
end