Class: CandyCheck::AppStore::SubscriptionVerification

Inherits:
Verification
  • Object
show all
Defined in:
lib/candy_check/app_store/subscription_verification.rb

Overview

Verifies a latest_receipt_info block against a verification server. The call return either an ReceiptCollection or a VerificationFailure

Constant Summary

Constants inherited from Verification

Verification::STATUS_OK

Instance Attribute Summary

Attributes inherited from Verification

#endpoint_url, #receipt_data, #secret

Instance Method Summary collapse

Constructor Details

#initialize(endpoint_url, receipt_data, secret = nil, product_ids = nil) ⇒ SubscriptionVerification

Builds a fresh verification run

Parameters:

  • endpoint_url (String)

    the verification URL to use

  • receipt_data (String)

    the raw data to be verified

  • secret (String) (defaults to: nil)

    optional: shared secret

  • product_ids (Array<String>) (defaults to: nil)

    optional: select specific products



11
12
13
14
15
16
17
18
19
# File 'lib/candy_check/app_store/subscription_verification.rb', line 11

def initialize(
  endpoint_url,
  receipt_data,
  secret = nil,
  product_ids = nil
)
  super(endpoint_url, receipt_data, secret)
  @product_ids = product_ids
end

Instance Method Details

#call!ReceiptCollection, VerificationFailure

Performs the verification against the remote server

Returns:



24
25
26
27
28
29
30
31
# File 'lib/candy_check/app_store/subscription_verification.rb', line 24

def call!
  verify!
  if valid?
    build_collection(@response["latest_receipt_info"])
  else
    VerificationFailure.fetch(@response["status"])
  end
end