Class: CandyCheck::AppStore::Verification
- Inherits:
-
Object
- Object
- CandyCheck::AppStore::Verification
- Defined in:
- lib/candy_check/app_store/verification.rb
Overview
Verifies a receipt block against a verification server. The call return either an Receipt or a VerificationFailure
Direct Known Subclasses
Constant Summary collapse
- STATUS_OK =
Constant for successful responses
0
Instance Attribute Summary collapse
-
#endpoint_url ⇒ String
readonly
The verification URL to use.
-
#receipt_data ⇒ String
readonly
The raw data to be verified.
-
#secret ⇒ String
readonly
The optional shared secret.
Instance Method Summary collapse
-
#call! ⇒ Receipt, VerificationFailure
Performs the verification against the remote server.
-
#initialize(endpoint_url, receipt_data, secret = nil) ⇒ Verification
constructor
Builds a fresh verification run.
Constructor Details
#initialize(endpoint_url, receipt_data, secret = nil) ⇒ Verification
Builds a fresh verification run
20 21 22 23 24 |
# File 'lib/candy_check/app_store/verification.rb', line 20 def initialize(endpoint_url, receipt_data, secret = nil) @endpoint_url = endpoint_url @receipt_data = receipt_data @secret = secret end |
Instance Attribute Details
#endpoint_url ⇒ String (readonly)
Returns the verification URL to use.
7 8 9 |
# File 'lib/candy_check/app_store/verification.rb', line 7 def endpoint_url @endpoint_url end |
#receipt_data ⇒ String (readonly)
Returns the raw data to be verified.
9 10 11 |
# File 'lib/candy_check/app_store/verification.rb', line 9 def receipt_data @receipt_data end |
#secret ⇒ String (readonly)
Returns the optional shared secret.
11 12 13 |
# File 'lib/candy_check/app_store/verification.rb', line 11 def secret @secret end |
Instance Method Details
#call! ⇒ Receipt, VerificationFailure
Performs the verification against the remote server
29 30 31 32 33 34 35 36 |
# File 'lib/candy_check/app_store/verification.rb', line 29 def call! verify! if valid? Receipt.new(@response["receipt"]) else VerificationFailure.fetch(@response["status"]) end end |