Class: TMDb::Base
Direct Known Subclasses
Changes, Genre, KnownFor, Movie, Person, ProductionCompany, ProductionCountry, SpokenLanguage
Class Method Summary collapse
-
.bad_response(response) ⇒ Object
Internal: Raises an exception depending on the type of the response.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
Internal: creates a new TMDb::Base object.
Constructor Details
#initialize(attributes = {}) ⇒ Base
Internal: creates a new TMDb::Base object.
attributes - Attributes fetched from the API.
27 28 29 |
# File 'lib/tmdb-api/base.rb', line 27 def initialize(attributes = {}) set_attributes(attributes) end |
Class Method Details
.bad_response(response) ⇒ Object
Internal: Raises an exception depending on the type of the response.
response - Result of a request.
Raises an exception.
17 18 19 20 21 22 |
# File 'lib/tmdb-api/base.rb', line 17 def self.bad_response(response) if response.class == HTTParty::Response raise ArgumentError, response['status_message'] end raise StandardError, 'Unkown error' end |