Class: Genba::Client::Promotions

Inherits:
Object
  • Object
show all
Defined in:
lib/genba/client/promotions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Promotions

Returns a new instance of Promotions.



6
7
8
# File 'lib/genba/client/promotions.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#list(from_date: nil, to_date: nil, continuation_token: nil, headers: {}) ⇒ Object

Gets a collection of available promotions



11
12
13
14
15
16
17
18
19
# File 'lib/genba/client/promotions.rb', line 11

def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})
  payload = {
    fromDate: from_date,
    toDate: to_date,
    continuationtoken: continuation_token
  }.select { |_, v| !v.nil? }

  @client.rest_get_with_token('/promotions', payload, headers)
end