Class: Transloadit::Response
- Inherits:
-
Delegator
- Object
- Delegator
- Transloadit::Response
- Defined in:
- lib/transloadit/response.rb
Defined Under Namespace
Modules: Assembly
Instance Method Summary collapse
-
#[](attribute) ⇒ String
Returns the attribute from the JSON response.
-
#body ⇒ Hash
Returns the parsed JSON body.
-
#extend!(mod) ⇒ Transloadit::Response
Chainably extends the response with additional methods.
-
#initialize(response) ⇒ Response
constructor
Creates an enhanced response wrapped around a RestClient response.
-
#inspect ⇒ String
Inspects the body of the response.
Constructor Details
#initialize(response) ⇒ Response
Creates an enhanced response wrapped around a RestClient response.
14 15 16 |
# File 'lib/transloadit/response.rb', line 14 def initialize(response) __setobj__(response) end |
Instance Method Details
#[](attribute) ⇒ String
Returns the attribute from the JSON response.
24 25 26 |
# File 'lib/transloadit/response.rb', line 24 def [](attribute) body[attribute.to_s] end |
#body ⇒ Hash
Returns the parsed JSON body.
33 34 35 |
# File 'lib/transloadit/response.rb', line 33 def body MultiJson.load __getobj__.body end |
#extend!(mod) ⇒ Transloadit::Response
Chainably extends the response with additional methods. Used to add context-specific functionality to a response.
53 54 55 56 |
# File 'lib/transloadit/response.rb', line 53 def extend!(mod) extend(mod) self end |
#inspect ⇒ String
Inspects the body of the response.
42 43 44 |
# File 'lib/transloadit/response.rb', line 42 def inspect body.inspect end |