Module: PactasItero::Default

Defined in:
lib/pactas_itero/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

SANDBOX_API_ENDPOINT =
"https://sandbox.billwerk.com"
PRODUCTION_API_ENDPOINT =
"https://app.billwerk.com"
PRODUCTION =
false
USER_AGENT =
"Pactas.Itero Ruby Gem #{PactasItero::VERSION}"
MEDIA_TYPE =
"application/json"
MIDDLEWARE =
Faraday::RackBuilder.new do |builder|
  builder.request :json
  builder.use PactasItero::Response::RaiseError
  builder.response :rashify
  builder.request :url_encoded
  builder.response :json, content_type: /\bjson$/

  builder.adapter Faraday.default_adapter
end

Class Method Summary collapse

Class Method Details

.api_endpointObject



35
36
37
# File 'lib/pactas_itero/default.rb', line 35

def api_endpoint
  ENV["PACTAS_ITERO_ENDPOINT"]
end

.bearer_tokenObject



59
60
61
# File 'lib/pactas_itero/default.rb', line 59

def bearer_token
  ENV["PACTAS_ITERO_BEARER_TOKEN"]
end

.client_idObject



51
52
53
# File 'lib/pactas_itero/default.rb', line 51

def client_id
  ENV["PACTAS_ITERO_CLIENT_ID"]
end

.client_secretObject



55
56
57
# File 'lib/pactas_itero/default.rb', line 55

def client_secret
  ENV["PACTAS_ITERO_CLIENT_SECRET"]
end

.default_media_typeObject



63
64
65
# File 'lib/pactas_itero/default.rb', line 63

def default_media_type
  ENV["PACTAS_ITERO_CLIENT_DEFAULT_MEDIA_TYPE"] || MEDIA_TYPE
end


75
76
77
# File 'lib/pactas_itero/default.rb', line 75

def legal_entity_id
  ENV["PACTAS_ITERO_LEGAL_ENTITY_ID"]
end

.middlewareObject



67
68
69
# File 'lib/pactas_itero/default.rb', line 67

def middleware
  MIDDLEWARE
end

.optionsObject



31
32
33
# File 'lib/pactas_itero/default.rb', line 31

def options
  PactasItero::Configurable.keys.to_h { |key| [key, send(key)] }
end

.productionObject



47
48
49
# File 'lib/pactas_itero/default.rb', line 47

def production
  PRODUCTION
end

.production_api_endpointObject



43
44
45
# File 'lib/pactas_itero/default.rb', line 43

def production_api_endpoint
  PRODUCTION_API_ENDPOINT
end

.sandbox_api_endpointObject



39
40
41
# File 'lib/pactas_itero/default.rb', line 39

def sandbox_api_endpoint
  SANDBOX_API_ENDPOINT
end

.user_agentObject



71
72
73
# File 'lib/pactas_itero/default.rb', line 71

def user_agent
  ENV["PACTAS_ITERO_USER_AGENT"] || USER_AGENT
end