Class: Bigbank::Client::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/bigbank/client/endpoint.rb

Direct Known Subclasses

Application, Field

Instance Method Summary collapse

Instance Method Details

#configObject



18
19
20
# File 'lib/bigbank/client/endpoint.rb', line 18

def config
  Bigbank::Client.config
end

#connectionObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bigbank/client/endpoint.rb', line 4

def connection
  @connection ||=
    ::Faraday.new(url: config.endpoint) do |builder|
      builder.use ::Faraday::Request::UrlEncoded
      builder.response :json, :content_type => /\bjson$/
      builder.headers["User-Agent"] = user_agent
      builder.options[:open_timeout] = config.open_timeout
      builder.options[:timeout] = config.timeout
      builder.adapter config.adapter
      builder.ssl.verify = config.verify_ssl
      builder.proxy(config.proxy) if config.enable_proxy?
    end
end

#user_agentObject



22
23
24
# File 'lib/bigbank/client/endpoint.rb', line 22

def user_agent
  "bigbank-client v#{::Bigbank::Client::VERSION} (github.com/mrtin/bigbank-client)"
end