Module: RubyLokaliseApi::Rest::Segments

Included in:
RubyLokaliseApi::Rest
Defined in:
lib/ruby_lokalise_api/rest/segments.rb

Instance Method Summary collapse

Instance Method Details

#segment(project_id, key_id, language_iso, segment_number, req_params = {}) ⇒ RubyLokaliseApi::Resources::Segment

Returns a single project segment

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • language_iso (String)
  • segment_number (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



32
33
34
35
36
37
38
# File 'lib/ruby_lokalise_api/rest/segments.rb', line 32

def segment(project_id, key_id, language_iso, segment_number, req_params = {})
  params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }

  data = endpoint(name: 'Segments', params: params).do_get

  resource 'Segment', data
end

#segments(project_id, key_id, language_iso, req_params = {}) ⇒ RubyLokaliseApi::Collections::Segments

Returns project segments

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • language_iso (String)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



14
15
16
17
18
19
20
21
# File 'lib/ruby_lokalise_api/rest/segments.rb', line 14

def segments(project_id, key_id, language_iso, req_params = {})
  name = 'Segments'
  params = { query: [project_id, key_id, language_iso], req: req_params }

  data = endpoint(name: name, params: params).do_get

  collection name, data
end

#update_segment(project_id, key_id, language_iso, segment_number, req_params = {}) ⇒ RubyLokaliseApi::Resources::Segment

Updates a segment

Parameters:

  • project_id (String)
  • key_id (String, Integer)
  • language_iso (String)
  • segment_number (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



49
50
51
52
53
54
55
# File 'lib/ruby_lokalise_api/rest/segments.rb', line 49

def update_segment(project_id, key_id, language_iso, segment_number, req_params = {})
  params = { query: [project_id, key_id, language_iso, segment_number], req: req_params }

  data = endpoint(name: 'Segments', params: params).do_put

  resource 'Segment', data
end