Module: RubyLokaliseApi::Rest::Orders

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

Instance Method Summary collapse

Instance Method Details

#create_order(team_id, req_params) ⇒ RubyLokaliseApi::Resources::Order

Creates a new order

Parameters:

  • team_id (String)
  • req_params (Hash)

Returns:

See Also:



47
48
49
50
51
52
53
54
55
56
# File 'lib/ruby_lokalise_api/rest/orders.rb', line 47

def create_order(team_id, req_params)
  params = { query: team_id, req: req_params }

  response = endpoint(name: 'Orders', params: params).do_post

  # We must patch content because the API does not return team_id and it's mandatory to build resource URL
  response.patch_content_with 'team_id', team_id

  resource 'Order', response
end

#order(team_id, order_id) ⇒ RubyLokaliseApi::Resources::Order

Returns a single order

Parameters:

  • team_id (String, Integer)
  • order_id (String)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby_lokalise_api/rest/orders.rb', line 30

def order(team_id, order_id)
  params = { query: [team_id, order_id] }

  response = endpoint(name: 'Orders', params: params).do_get

  # We must patch content because the API does not return team_id and it's mandatory to build resource URL
  response.patch_content_with 'team_id', team_id

  resource 'Order', response
end

#orders(team_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Orders

Returns orders for the given team

Parameters:

  • team_id (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ruby_lokalise_api/rest/orders.rb', line 12

def orders(team_id, req_params = {})
  name = 'Orders'
  params = { query: team_id, req: req_params }

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

  # We must patch content because the API does not return team_id and it's mandatory to build resource URLs
  response.patch_content_with 'team_id', team_id

  collection name, response
end