Class: CandyCheck::AppStore::Client
- Inherits:
-
Object
- Object
- CandyCheck::AppStore::Client
- Defined in:
- lib/candy_check/app_store/client.rb
Overview
Simple HTTP client to load the receipt’s data from Apple’s verification servers (either sandbox or production).
Constant Summary collapse
- JSON_MIME_TYPE =
Mimetype for JSON objects
"application/json".freeze
Instance Method Summary collapse
-
#initialize(endpoint_url) ⇒ Client
constructor
Initialize a new client bound to an endpoint.
-
#verify(receipt_data, secret = nil) ⇒ Hash
Contacts the configured endpoint and requests the receipt’s data.
Constructor Details
#initialize(endpoint_url) ⇒ Client
Initialize a new client bound to an endpoint
14 15 16 |
# File 'lib/candy_check/app_store/client.rb', line 14 def initialize(endpoint_url) @uri = URI(endpoint_url) end |
Instance Method Details
#verify(receipt_data, secret = nil) ⇒ Hash
Contacts the configured endpoint and requests the receipt’s data
22 23 24 25 26 |
# File 'lib/candy_check/app_store/client.rb', line 22 def verify(receipt_data, secret = nil) request = build_request(build_request_parameters(receipt_data, secret)) response = perform_request(request) MultiJson.load(response.body) end |