class Enceladus::ProductionCompany

Constants

RESOURCE_ATTRIBUTES

Public Class Methods

find(id) click to toggle source

Finds a production company by id. Example:

company = Enceladus::ProductionCompany.find(7505)
# File lib/enceladus/models/production_company.rb, line 16
def self.find(id)
  build_single_resource(Enceladus::Requester.get("company/#{id}", default_params))
end

Private Class Methods

default_params() click to toggle source
# File lib/enceladus/models/production_company.rb, line 48
def self.default_params
  language = Enceladus::Configuration::Image.instance.include_image_language
  { append_to_response: "description,headquarters,homepage,id,logo_path,name", language: language }
end
find_by_name(name) click to toggle source

Returns a paginated collection of ProductionCompanies with the name. Example:

Enceladus::ProductionCompany.find_by_name("Marvel")
# File lib/enceladus/models/production_company.rb, line 9
def self.find_by_name(name)
  Enceladus::ProductionCompanyCollection.new("search/company", { query: name })
end

Public Instance Methods

reload() click to toggle source

Fetchs for more details about the production company. Example:

marvel = Enceladus::ProductionCompany.find_by_name("marvel").last
=> #<Enceladus::ProductionCompany @id=325, @logo_path="/pic.png", @name="Marvel Entertainment, LLC">
marvel.reload
=> #<Enceladus::ProductionCompan @id=325, @logo_path="/pic.png", @name="Marvel Entertainment, LLC", @description=nil, @headquarters="New York, New York, USA", @homepage="http://www.marvel.com">
# File lib/enceladus/models/production_company.rb, line 32
def reload
  rebuild_single_resource(Enceladus::Requester.get("company/#{id}", self.class.default_params))
end

Private Instance Methods

logo_urls() click to toggle source

Returns an array containing URL’s (as string) for the companies logos.

# File lib/enceladus/models/production_company.rb, line 21
def logo_urls
  Enceladus::Configuration::Image.instance.url_for("logo", logo_path)
end
movies() click to toggle source

Returns a paginated collection of all movies of a production company. Example:

marvel = Enceladus::ProductionCompany.find(7505)
marvel.movies
=> [Movie(@title="Thor"), Movie(@title="Captain America"), Movie(@title="Iron Man")]
# File lib/enceladus/models/production_company.rb, line 42
def movies
  Enceladus::MovieCollection.new("company/#{id}/movies", Enceladus::Movie.default_params)
end