class Bitodeme::UnauthorizedConn

HTTP Connection for Bitodeme unauthorized endpoints

Constants

USER_AGENT

Public Class Methods

build() click to toggle source
# File lib/bitodeme/unauthorized_conn.rb, line 11
def self.build
  instance.send(:connection)
end

Private Instance Methods

connection() click to toggle source
# File lib/bitodeme/unauthorized_conn.rb, line 20
def connection
  Faraday.new(faraday_opts) do |conn|
    conn.request  :json
    conn.response :logger if logging
    conn.response :json, content_type: /\bjson$/
    conn.adapter  Faraday.default_adapter
  end
end
faraday_opts() click to toggle source
# File lib/bitodeme/unauthorized_conn.rb, line 29
def faraday_opts
  @faraday_opts ||= {
    url:     "https://#{hostname}",
    headers: { 'User-Agent' => USER_AGENT }
  }
end