Class: Oja::Request
- Inherits:
-
Object
- Object
- Oja::Request
- Defined in:
- lib/oja/mock.rb,
lib/oja/request.rb
Constant Summary collapse
- ENDPOINT =
{ :production => 'https://buy.itunes.apple.com/verifyReceipt', :sandbox => 'https://sandbox.itunes.apple.com/verifyReceipt' }
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#receipt ⇒ Object
Returns the value of attribute receipt.
Instance Method Summary collapse
- #endpoint ⇒ Object
-
#initialize(attributes) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
- #response_data ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Request
Returns a new instance of Request.
13 14 15 16 17 |
# File 'lib/oja/request.rb', line 13 def initialize(attributes) attributes.each do |attribute, value| send("#{attribute}=", value) end end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/oja/request.rb', line 11 def environment @environment end |
#receipt ⇒ Object
Returns the value of attribute receipt.
11 12 13 |
# File 'lib/oja/request.rb', line 11 def receipt @receipt end |
Instance Method Details
#endpoint ⇒ Object
19 20 21 |
# File 'lib/oja/request.rb', line 19 def endpoint ENDPOINT[environment] end |
#response ⇒ Object
42 43 44 |
# File 'lib/oja/mock.rb', line 42 def response @response ||= Oja::Mock.next_response end |
#response_data ⇒ Object
27 28 29 |
# File 'lib/oja/request.rb', line 27 def response_data JSON.parse(response.body) end |