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