module Cha::Connection

Public Instance Methods

connection(options = {}) click to toggle source

@return [Faraday::Connection]

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

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