Class: Promobox

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

Constant Summary collapse

API_VERSION =
'v3'
API_URL =
"http://api.promobox.fr/api/#{API_VERSION}"

Instance Method Summary collapse

Constructor Details

#initialize(api_key, login, password) ⇒ Promobox

Returns a new instance of Promobox.



14
15
16
17
18
19
# File 'lib/promobox.rb', line 14

def initialize(api_key, , password)
  @api_key = api_key
  @login = 
  @password = password
  @hash_password = Digest::MD5.digest("#{@password}{#{@api_key}}").unpack('H*').first
end

Instance Method Details

#coupon(id) ⇒ Object



28
29
30
31
# File 'lib/promobox.rb', line 28

def coupon(id)
  url = build_query("#{__method__}/#{id}")
  decode_url(url)
end

#shop(id) ⇒ Object



33
34
35
36
# File 'lib/promobox.rb', line 33

def shop(id)
  url = build_query("#{__method__}/#{id}")
  decode_url(url)
end