Class: CandyCheck::PlayStore::Verifier
- Inherits:
-
Object
- Object
- CandyCheck::PlayStore::Verifier
- Defined in:
- lib/candy_check/play_store/verifier.rb
Overview
Verifies purchase tokens against the Google API. The call return either a SubscriptionPurchases::SubscriptionPurchase or a VerificationFailure
Instance Method Summary collapse
-
#initialize(authorization:) ⇒ Verifier
constructor
Initializes a new verifier which is bound to an authorization.
-
#verify_product_purchase(package_name:, product_id:, token:) ⇒ ProductPurchases::ProductPurchase, VerificationFailure
Contacts the Google API and requests the product state.
-
#verify_subscription_purchase(package_name:, subscription_id:, token:) ⇒ SubscriptionPurchases::SubscriptionPurchase, VerificationFailure
Contacts the Google API and requests the product state.
Constructor Details
#initialize(authorization:) ⇒ Verifier
Initializes a new verifier which is bound to an authorization
8 9 10 |
# File 'lib/candy_check/play_store/verifier.rb', line 8 def initialize(authorization:) @authorization = end |
Instance Method Details
#verify_product_purchase(package_name:, product_id:, token:) ⇒ ProductPurchases::ProductPurchase, VerificationFailure
Contacts the Google API and requests the product state
18 19 20 21 22 23 24 25 26 |
# File 'lib/candy_check/play_store/verifier.rb', line 18 def verify_product_purchase(package_name:, product_id:, token:) verifier = CandyCheck::PlayStore::ProductPurchases::ProductVerification.new( package_name: package_name, product_id: product_id, token: token, authorization: @authorization, ) verifier.call! end |
#verify_subscription_purchase(package_name:, subscription_id:, token:) ⇒ SubscriptionPurchases::SubscriptionPurchase, VerificationFailure
Contacts the Google API and requests the product state
34 35 36 37 38 39 40 41 42 |
# File 'lib/candy_check/play_store/verifier.rb', line 34 def verify_subscription_purchase(package_name:, subscription_id:, token:) verifier = CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionVerification.new( package_name: package_name, subscription_id: subscription_id, token: token, authorization: @authorization, ) verifier.call! end |