Class: Amazon::Iap::Client
- Inherits:
-
Object
- Object
- Amazon::Iap::Client
- Defined in:
- lib/amazon/iap/client.rb
Constant Summary collapse
- PRODUCTION_HOST =
'https://appstore-sdk.amazon.com'
Instance Method Summary collapse
-
#initialize(developer_secret, host = nil) ⇒ Client
constructor
A new instance of Client.
- #renew(user_id, purchase_token) ⇒ Object
- #verify(user_id, purchase_token, renew_on_failure = true) ⇒ Object
Constructor Details
#initialize(developer_secret, host = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/amazon/iap/client.rb', line 7 def initialize(developer_secret, host=nil) @developer_secret = developer_secret @host = host || PRODUCTION_HOST end |
Instance Method Details
#renew(user_id, purchase_token) ⇒ Object
23 24 25 |
# File 'lib/amazon/iap/client.rb', line 23 def renew(user_id, purchase_token) process :renew, user_id, purchase_token end |
#verify(user_id, purchase_token, renew_on_failure = true) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/amazon/iap/client.rb', line 12 def verify(user_id, purchase_token, renew_on_failure=true) begin process :verify, user_id, purchase_token rescue Amazon::Iap::Exceptions::ExpiredCredentials => e raise e unless renew_on_failure renewal = renew(user_id, purchase_token) verify(user_id, renewal.purchase_token, false) end end |