Class: MovieRexx::Client

Inherits:
Object
  • Object
show all
Includes:
Certification, Movie, Connection, Default, Request
Defined in:
lib/movie_rexx/client.rb,
lib/movie_rexx/client/movie.rb,
lib/movie_rexx/client/certification.rb

Defined Under Namespace

Modules: Certification, Movie

Constant Summary

Constants included from Certification

Certification::RESOURCE

Constants included from Movie

Movie::RESOURCE

Constants included from Default

Default::BASE_URL, Default::INCLUDE_ADULT, Default::LANGUAGE, Default::VERSION

Instance Method Summary collapse

Methods included from Certification

#certifications

Methods included from Movie

#latest_movie, #movie, #movie_alternative_titles, #movie_backdrops, #movie_changes, #movie_credits, #movie_images, #movie_keywords, #movie_lists, #movie_posters, #movie_releases, #movie_reviews, #movie_translations, #movie_videos, #now_playing, #popular_movies, #similar_movies, #top_rated_movies, #upcoming

Methods included from Request

#delete, #get, #last_response, #post, #put

Methods included from Default

#api_endpoint, api_key, base_url, include_adult, language, options, version

Methods included from Connection

#connection

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.


20
21
22
23
24
25
26
27
28
29
# File 'lib/movie_rexx/client.rb', line 20

def initialize(options = {})
  MovieRexx::Configuration.keys.each do |key|
    instance_variable_set(
      :"@#{key}", options[key] ||
      MovieRexx.instance_variable_get(:"@#{key}")
    )
  end

  raise MovieRexx::MissingAPIKeyError if @api_key.nil? || @api_key.empty?
end