Module: Croudia::Default

Defined in:
lib/croudia/default.rb

Constant Summary collapse

ENDPOINT =
'https://api.croudia.com'
CONNECTION_OPTIONS =
{
  headers: {
    accept: 'application/json',
    user_agent: "Croudia Ruby Gem/#{Croudia::VERSION}",
  },
  request: {
    open_timeout: 10,
    timeout: 30,
  },
  ssl: {
    verify: true,
  },
}
MIDDLEWARE =
Faraday::Builder.new do |builder|
  builder.request :multipart_with_file
  builder.request :multipart
  builder.request :url_encoded
  builder.request :raise_error

  builder.response :raise_error
  builder.response :parse_json

  builder.adapter Faraday.default_adapter
end

Class Method Summary collapse

Class Method Details

.access_tokenObject



53
54
55
# File 'lib/croudia/default.rb', line 53

def access_token
  ENV['CROUDIA_ACCESS_TOKEN']
end

.client_idObject



45
46
47
# File 'lib/croudia/default.rb', line 45

def client_id
  ENV['CROUDIA_CLIENT_ID']
end

.client_secretObject



49
50
51
# File 'lib/croudia/default.rb', line 49

def client_secret
  ENV['CROUDIA_CLIENT_SECRET']
end

.connection_optionsObject



61
62
63
# File 'lib/croudia/default.rb', line 61

def connection_options
  CONNECTION_OPTIONS
end

.endpointObject



57
58
59
# File 'lib/croudia/default.rb', line 57

def endpoint
  ENDPOINT
end

.middlewareObject



65
66
67
# File 'lib/croudia/default.rb', line 65

def middleware
  MIDDLEWARE
end

.optionsObject



39
40
41
42
43
# File 'lib/croudia/default.rb', line 39

def options
  Hash[Croudia::Configurable.keys.map do |key|
    [key, __send__(key)]
  end]
end