Class: Monza::Client
- Inherits:
-
Object
- Object
- Monza::Client
- Defined in:
- lib/monza/client.rb
Constant Summary collapse
- PRODUCTION_URL =
"https://buy.itunes.apple.com/verifyReceipt"
- DEVELOPMENT_URL =
"https://sandbox.itunes.apple.com/verifyReceipt"
Instance Attribute Summary collapse
-
#shared_secret ⇒ Object
writeonly
Sets the attribute shared_secret.
-
#verification_url ⇒ Object
Returns the value of attribute verification_url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #verify(data, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
25 26 |
# File 'lib/monza/client.rb', line 25 def initialize end |
Instance Attribute Details
#shared_secret=(value) ⇒ Object (writeonly)
Sets the attribute shared_secret
8 9 10 |
# File 'lib/monza/client.rb', line 8 def shared_secret=(value) @shared_secret = value end |
#verification_url ⇒ Object
Returns the value of attribute verification_url.
7 8 9 |
# File 'lib/monza/client.rb', line 7 def verification_url @verification_url end |
Class Method Details
.development ⇒ Object
13 14 15 16 17 |
# File 'lib/monza/client.rb', line 13 def self.development client = self.new client.verification_url = DEVELOPMENT_URL client end |
.production ⇒ Object
19 20 21 22 23 |
# File 'lib/monza/client.rb', line 19 def self.production client = self.new client.verification_url = PRODUCTION_URL client end |
Instance Method Details
#verify(data, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/monza/client.rb', line 28 def verify(data, = {}) # Post to apple and receive json_response json_response = post_receipt_verification(data, ) # Get status code of response status = json_response['status'].to_i case status when 0 begin return VerificationResponse.new(json_response) rescue nil end else raise VerificationResponse::VerificationError.new(status) end end |