Class: Giftery::Client

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

Overview

Giftery::Client class needs to be used for making requests to Giftery API docs.giftery.tech/b2b-api/

Instance Method Summary collapse

Constructor Details

#initialize(client_id, secret) ⇒ Client

Returns a new instance of Client.



16
17
18
19
# File 'lib/giftery/client.rb', line 16

def initialize(client_id, secret)
  @client_id = client_id
  @secret = secret
end

Instance Method Details

#address(product_id, area_name, locality_name) ⇒ Object

Returns list of places (with address) where certificate can be accepted More info here: docs.giftery.tech/b2b-api/methods/getAddress/



80
81
82
83
84
85
# File 'lib/giftery/client.rb', line 80

def address(product_id, area_name, locality_name)
  make_request('getBalance',
               product_id: product_id,
               area_name: area_name,
               locality_name: locality_name)
end

#balanceObject

Returns your available balance More info here: docs.giftery.tech/b2b-api/methods/getBalance/



74
75
76
# File 'lib/giftery/client.rb', line 74

def balance
  make_request('getBalance')
end

#categoriesObject

Returns list of available certificate categories More info here: docs.giftery.tech/b2b-api/methods/getCategories/



68
69
70
# File 'lib/giftery/client.rb', line 68

def categories
  make_request('getCategories')
end

#certificate(queue_id) ⇒ Object

Returns base64 encoded PDF certificate More info here: docs.giftery.tech/b2b-api/methods/getCertificate/



40
41
42
# File 'lib/giftery/client.rb', line 40

def certificate(queue_id)
  make_request('getCertificate', queue_id: queue_id)
end

#code(queue_id, order_id) ⇒ Object

Returns certificate requisites More info here: docs.giftery.tech/b2b-api/methods/getCode/



46
47
48
49
50
# File 'lib/giftery/client.rb', line 46

def code(queue_id, order_id)
  make_request('getCode',
               queue_id: queue_id,
               order_id: order_id)
end

Returns certificate links More info here: docs.giftery.tech/b2b-api/methods/getLinks/



54
55
56
57
58
# File 'lib/giftery/client.rb', line 54

def links(queue_id, order_id)
  make_request('getLinks',
               queue_id: queue_id,
               order_id: order_id)
end

#make_order(product_id, face, options = {}) ⇒ Object

Creates order More info here: docs.giftery.tech/b2b-api/methods/makeOrder/



27
28
29
30
# File 'lib/giftery/client.rb', line 27

def make_order(product_id, face, options = {})
  data = options.merge!(product_id: product_id, face: face)
  make_request('makeOrder', data)
end

#productsObject

Returns list of available products More info here: docs.giftery.tech/b2b-api/methods/getProducts/



34
35
36
# File 'lib/giftery/client.rb', line 34

def products
  make_request('getProducts')
end

#status(id) ⇒ Object

Returns status of order that is created by make_order More info here: docs.giftery.tech/b2b-api/methods/getStatus/



62
63
64
# File 'lib/giftery/client.rb', line 62

def status(id)
  make_request('getStatus', id: id)
end

#testObject



21
22
23
# File 'lib/giftery/client.rb', line 21

def test
  make_request('test')
end