Class: MobicomCandy::Client
- Inherits:
-
Object
- Object
- MobicomCandy::Client
- Defined in:
- lib/mobicom_candy/client.rb
Overview
API Client Wrapper
Instance Method Summary collapse
- #customer(customer_id, system) ⇒ MobicomCandy::Entity
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #reward(customer_id, system, amount, description) ⇒ MobicomCandy::Entity
- #sell(customer_id, system, amount, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) ⇒ MobicomCandy::Entity
- #sell_card(card_id, system, amount, pin, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) ⇒ MobicomCandy::Entity
- #sell_confirm(customer_id, system, amount, tancode) ⇒ MobicomCandy::Entity
- #transaction(limit = 10, offset = 0) ⇒ MobicomCandy::Entity
Constructor Details
#initialize(token) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/mobicom_candy/client.rb', line 8 def initialize(token) @token = token @last_sent = nil end |
Instance Method Details
#customer(customer_id, system) ⇒ MobicomCandy::Entity
23 24 25 |
# File 'lib/mobicom_candy/client.rb', line 23 def customer(customer_id, system) post('customer', customer: customer_id, 'customer.system' => system) end |
#reward(customer_id, system, amount, description) ⇒ MobicomCandy::Entity
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mobicom_candy/client.rb', line 32 def reward(customer_id, system, amount, description) post('reward', 'customer' => { value: customer_id, system: system }, amount: amount, description: description ) end |
#sell(customer_id, system, amount, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) ⇒ MobicomCandy::Entity
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mobicom_candy/client.rb', line 52 def sell(customer_id, system, amount, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) post('sell', 'customer' => { value: customer_id, system: system }, amount: amount, description: description, smsPrefix: sms_prefix, smsSuffix: sms_suffix, product: product, productType: product_type ) end |
#sell_card(card_id, system, amount, pin, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) ⇒ MobicomCandy::Entity
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/mobicom_candy/client.rb', line 89 def sell_card(card_id, system, amount, pin, description: nil, sms_prefix: nil, sms_suffix: nil, product: nil, product_type: nil) post('sellcard', 'customer' => { value: card_id, system: system }, amount: amount, pin: pin, description: description, smsPrefix: sms_prefix, smsSuffix: sms_suffix, product: product, productType: product_type ) end |
#sell_confirm(customer_id, system, amount, tancode) ⇒ MobicomCandy::Entity
72 73 74 75 76 77 |
# File 'lib/mobicom_candy/client.rb', line 72 def sell_confirm(customer_id, system, amount, tancode) post('sellconfirm', 'customer' => { value: customer_id, system: system }, amount: amount, tancode: tancode) end |
#transaction(limit = 10, offset = 0) ⇒ MobicomCandy::Entity
16 17 18 |
# File 'lib/mobicom_candy/client.rb', line 16 def transaction(limit = 10, offset = 0) get('transaction', limit: limit, offset: offset) end |