Class: Promobox
- Inherits:
-
Object
- Object
- Promobox
- Defined in:
- lib/promobox.rb
Constant Summary collapse
- API_VERSION =
'v3'
- API_URL =
"http://api.promobox.fr/api/#{API_VERSION}"
Instance Method Summary collapse
- #coupon(id) ⇒ Object
-
#initialize(api_key, login, password) ⇒ Promobox
constructor
A new instance of Promobox.
- #shop(id) ⇒ Object
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, login, password) @api_key = api_key @login = 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 |