Class: Rakuten::Response
- Inherits:
-
Object
show all
- Defined in:
- lib/rakuten/api/response.rb
Instance Method Summary
collapse
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
5
6
7
8
|
# File 'lib/rakuten/api/response.rb', line 5
def initialize(response)
@response =response
@body = JSON.parse(@response.body)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/rakuten/api/response.rb', line 18
def method_missing(name, *args, &block)
if @body.respond_to?(name)
@body.send(name, *args, &block)
else
super
end
end
|
Instance Method Details
#code ⇒ Object
10
11
12
|
# File 'lib/rakuten/api/response.rb', line 10
def code
@response.code.to_i
end
|
#message ⇒ Object
14
15
16
|
# File 'lib/rakuten/api/response.rb', line 14
def message
@response.message
end
|