Class: Transifex::ResourceComponents::TranslationComponents::Strings

Inherits:
Object
  • Object
show all
Includes:
CrudRequests::Fetch, CrudRequests::Update, Utilities
Defined in:
lib/transifex/resource_components/translation_components/strings.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CrudRequests::Update

included

Methods included from CrudRequests::Fetch

included

Constructor Details

#initialize(project_slug = nil, resource_slug = nil, translation_slug = nil) ⇒ Strings

Returns a new instance of Strings.



10
11
12
13
14
15
16
17
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 10

def initialize(project_slug = nil, resource_slug = nil, translation_slug = nil)
  raise MissingParametersError.new(["project_slug"]) if project_slug.nil?
  raise MissingParametersError.new(["resource_slug"]) if resource_slug.nil?
  raise MissingParametersError.new(["translation_slug"]) if translation_slug.nil?
  @project_slug = project_slug
  @resource_slug = resource_slug
  @translation_slug = translation_slug
end

Instance Attribute Details

#project_slugObject

Returns the value of attribute project_slug.



8
9
10
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 8

def project_slug
  @project_slug
end

#resource_slugObject

Returns the value of attribute resource_slug.



8
9
10
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 8

def resource_slug
  @resource_slug
end

#translation_slugObject

Returns the value of attribute translation_slug.



8
9
10
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 8

def translation_slug
  @translation_slug
end

Class Method Details

.authorsObject



24
25
26
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 24

def self.authors
  [:project, :resource, :translation]            
end

Instance Method Details

#fetch_with_details(options = {}) ⇒ Object



19
20
21
22
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 19

def fetch_with_details(options = {})
  options[:details] = true
  self.fetch(options)      
end

#update(params) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/transifex/resource_components/translation_components/strings.rb', line 28

def update(params)
  params = [params] unless params.is_a?(Array)
  params.each do |param|
    raise MissingParametersError.new(["key"]) unless param.key?(:key)
    param[:source_entity_hash] = compute_source_entity_hash(param[:key], param[:context])
  end
  super
end