module NHKProgram::Connection

Public Instance Methods

connection(options = {}) click to toggle source

@return [Faraday::Connection]

# File lib/nhk_program/connection.rb, line 10
def connection(options = {})
  default_options = {
    headers: {
      accept: 'application/json',
      user_agent: user_agent,
    },
    proxy: proxy,
  }

  options = default_options.merge(options)

  Faraday::Connection.new(endpoint, options) do |builder|
    builder.response :raise_error
    builder.response :mashify
    builder.response :json
    builder.request :url_encoded
    builder.adapter adapter
  end
end