Module: Flix::Default
- Defined in:
- lib/flix/default.rb
Constant Summary collapse
- ENDPOINT =
'http://api.netflix.com'
- CONNECTION_OPTIONS =
MEDIA_ENDPOINT = ‘upload.flix.com’ unless defined? MEDIA_ENDPOINT SEARCH_ENDPOINT = ‘search.flix.com’ unless defined? SEARCH_ENDPOINT
{ :headers => { :accept => 'application/json', :user_agent => "Flix Ruby Gem #{Flix::VERSION}" }, :open_timeout => 5, :raw => true, :ssl => {:verify => false}, :timeout => 10, }
- IDENTITY_MAP =
Flix::IdentityMap
- MIDDLEWARE =
Faraday::Builder.new( &Proc.new do |builder| # # Convert file uploads to Faraday::UploadIO objects # builder.use Flix::Request::MultipartWithFile # # Checks for files in the payload # builder.use Faraday::Request::Multipart builder.use Faraday::Request::OAuth, Flix::Default. # Convert request params to "www-form-urlencoded" builder.use Faraday::Request::UrlEncoded # Handle 4xx server responses # builder.use Flix::Response::RaiseError, Flix::Error::ClientError # # Parse JSON response bodies using MultiJson # builder.use Flix::Response::ParseJson # # Handle 5xx server responses # builder.use Flix::Response::RaiseError, Flix::Error::ServerError # Set Faraday's HTTP adapter builder.adapter Faraday.default_adapter end )
Class Method Summary collapse
- .connection_options ⇒ Hash
- .consumer_key ⇒ String
- .consumer_secret ⇒ String
- .endpoint ⇒ String
- .identity_map ⇒ Flix::IdentityMap
- .middleware ⇒ Faraday::Builder
- .oauth_token ⇒ String
- .oauth_token_secret ⇒ String
- .options ⇒ Hash
Class Method Details
.connection_options ⇒ Hash
96 97 98 |
# File 'lib/flix/default.rb', line 96 def CONNECTION_OPTIONS end |
.consumer_key ⇒ String
56 57 58 |
# File 'lib/flix/default.rb', line 56 def consumer_key ENV['NETFLIX_CONSUMER_KEY'] end |
.consumer_secret ⇒ String
61 62 63 |
# File 'lib/flix/default.rb', line 61 def consumer_secret ENV['NETFLIX_CONSUMER_SECRET'] end |
.endpoint ⇒ String
Note:
This is configurable in case you want to use HTTP instead of HTTPS or use a Netflix-compatible endpoint.
81 82 83 |
# File 'lib/flix/default.rb', line 81 def endpoint ENDPOINT end |
.identity_map ⇒ Flix::IdentityMap
101 102 103 |
# File 'lib/flix/default.rb', line 101 def identity_map IDENTITY_MAP end |
.middleware ⇒ Faraday::Builder
Note:
Faraday’s middleware stack implementation is comparable to that of Rack middleware. The order of middleware is important: the first middleware on the list wraps all others, while the last middleware is the innermost one.
109 110 111 |
# File 'lib/flix/default.rb', line 109 def middleware MIDDLEWARE end |
.oauth_token ⇒ String
66 67 68 |
# File 'lib/flix/default.rb', line 66 def oauth_token ENV['NETFLIX_OAUTH_TOKEN'] end |
.oauth_token_secret ⇒ String
71 72 73 |
# File 'lib/flix/default.rb', line 71 def oauth_token_secret ENV['NETFLIX_OAUTH_TOKEN_SECRET'] end |
.options ⇒ Hash
51 52 53 |
# File 'lib/flix/default.rb', line 51 def Hash[Flix::Configurable.keys.map{|key| [key, send(key)]}] end |