Method: Opium::Model::Connectable::ClassMethods#connection

Defined in:
lib/opium/model/connectable.rb

#connectionObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/opium/model/connectable.rb', line 26

def connection
  @@connection ||= Faraday.new( url: parse_server_url ) do |faraday|
    faraday.request :multipart
    faraday.request :url_encoded
    faraday.request :json
    faraday.response :logger if Opium.config.log_network_responses
    faraday.response :json, content_type: /\bjson$/
    faraday.headers[:x_parse_application_id] = Opium.config.app_id
    faraday.adapter Faraday.default_adapter
  end
end