Class: CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionVerification
- Inherits:
-
Object
- Object
- CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionVerification
- Defined in:
- lib/candy_check/play_store/subscription_purchases/subscription_verification.rb
Overview
Verifies a purchase token against the Google API The call return either an SubscriptionPurchase or an VerificationFailure
Instance Attribute Summary collapse
-
#package_name ⇒ String
readonly
The package which will be queried.
-
#subscription_id ⇒ String
readonly
The item id which will be queried.
-
#token ⇒ String
readonly
The token for authentication.
Instance Method Summary collapse
-
#call! ⇒ SubscriptionPurchase, VerificationFailure
Performs the verification against the remote server.
-
#initialize(package_name:, subscription_id:, token:, authorization:) ⇒ SubscriptionVerification
constructor
Initializes a new call to the API.
Constructor Details
#initialize(package_name:, subscription_id:, token:, authorization:) ⇒ SubscriptionVerification
Initializes a new call to the API
18 19 20 21 22 23 |
# File 'lib/candy_check/play_store/subscription_purchases/subscription_verification.rb', line 18 def initialize(package_name:, subscription_id:, token:, authorization:) @package_name = package_name @subscription_id = subscription_id @token = token @authorization = end |
Instance Attribute Details
#package_name ⇒ String (readonly)
Returns the package which will be queried.
8 9 10 |
# File 'lib/candy_check/play_store/subscription_purchases/subscription_verification.rb', line 8 def package_name @package_name end |
#subscription_id ⇒ String (readonly)
Returns the item id which will be queried.
10 11 12 |
# File 'lib/candy_check/play_store/subscription_purchases/subscription_verification.rb', line 10 def subscription_id @subscription_id end |
#token ⇒ String (readonly)
Returns the token for authentication.
12 13 14 |
# File 'lib/candy_check/play_store/subscription_purchases/subscription_verification.rb', line 12 def token @token end |
Instance Method Details
#call! ⇒ SubscriptionPurchase, VerificationFailure
Performs the verification against the remote server
28 29 30 31 32 33 34 35 |
# File 'lib/candy_check/play_store/subscription_purchases/subscription_verification.rb', line 28 def call! verify! if valid? CandyCheck::PlayStore::SubscriptionPurchases::SubscriptionPurchase.new(@response[:result]) else CandyCheck::PlayStore::VerificationFailure.new(@response[:error]) end end |