Class: Vidsy::Data::API::Response
- Inherits:
-
Object
- Object
- Vidsy::Data::API::Response
- Defined in:
- lib/vidsy/data/api/response.rb
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
12 13 14 |
# File 'lib/vidsy/data/api/response.rb', line 12 def initialize(response) @response = response end |
Class Method Details
.build(response) ⇒ Object
8 9 10 |
# File 'lib/vidsy/data/api/response.rb', line 8 def self.build(response) new(response).data end |
Instance Method Details
#data ⇒ Object
16 17 18 19 20 |
# File 'lib/vidsy/data/api/response.rb', line 16 def data raise unexpected_error unless response.body data = response.body["data"] || raise(response_error) data.map { |e| OpenStruct.new e } end |