forked from compropago/compropago-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.rb
34 lines (29 loc) · 1.01 KB
/
configuration.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Compropago
# Stores runtime configuration information.
#
# @example Standard settings
# Compropago.api_url = "https://api.compropago.com/v2"
# Compropago.api_key = "MyToken"aa
ActiveRestClient::Base.base_url = "https://api.compropago.com/v1"
def self.api_key
@api_key
end
def self.api_url
ActiveRestClient::Base.base_url
end
def self.api_key=(api_key)
@api_key = api_key
ActiveRestClient::Base.faraday_config do |faraday|
faraday.request :basic_auth, api_key, nil
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.response :raise_error
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
#FIXME https://github.com/lostisland/faraday/wiki/Setting-up-SSL-certificates#solutions-to-avoid
faraday.ssl.merge!({ verify: false })
end
end
def self.api_url=(api_url)
ActiveRestClient::Base.base_url = api_url
end
end