Module: MovieRexx::Default

Included in:
Client
Defined in:
lib/movie_rexx/default.rb

Overview

Default configuration for Client

Constant Summary collapse

BASE_URL =
"https://api.themoviedb.org".freeze
VERSION =
3
INCLUDE_ADULT =
false
LANGUAGE =
"en".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.api_keyString

Default api_key key from ENV


24
25
26
# File 'lib/movie_rexx/default.rb', line 24

def api_key
  ENV['MOVIEREXX_API_KEY'] || @api_key
end

.base_urlString

Default API base_url from ENV or API_BASE_URL


30
31
32
# File 'lib/movie_rexx/default.rb', line 30

def base_url
  ENV['MOVIEREXX_BASE_URL'] || @base_url || BASE_URL
end

.include_adultString

Default include_adult from ENV or INCLUDE_ADULT


42
43
44
# File 'lib/movie_rexx/default.rb', line 42

def include_adult
  ENV['MOVIEREXX_INCLUDE_ADULT'] || @include_adult || INCLUDE_ADULT
end

.languageString

Default language from ENV or LANGUAGE


48
49
50
# File 'lib/movie_rexx/default.rb', line 48

def language
  ENV['MOVIEREXX_LANGUAGE'] || @language || LANGUAGE
end

.optionsHash

Configuration options


18
19
20
# File 'lib/movie_rexx/default.rb', line 18

def options
  Hash[MovieRexx::Configuration.keys.map{|key| [key, send(key)]}]
end

.versionString

Default API version from ENV or API_VERSION


36
37
38
# File 'lib/movie_rexx/default.rb', line 36

def version
  ENV['MOVIEREXX_VERSION'] || @version || VERSION
end

Instance Method Details

#api_endpointString

Default API endpoint built from the base url and version


11
12
13
# File 'lib/movie_rexx/default.rb', line 11

def api_endpoint
  "#{@base_url}/#{@version}"
end