Module: Vindi::Default

Defined in:
lib/vindi/default.rb

Constant Summary collapse

API_ENDPOINT =

Default API endpoint

'https://app.vindi.com.br/api/v1/'.freeze
MEDIA_TYPE =

Default media type

'application/vnd.api+json'.freeze
USER_AGENT =

Default User Agent header string

"Vindi-Ruby/#{Vindi::VERSION}".freeze
MIDDLEWARE =
Vindi::Response::RaiseError

Class Method Summary collapse

Class Method Details

.api_endpointString

Default api endpoint string from ENV or API_ENDPOINT

Returns:

  • (String)


21
22
23
# File 'lib/vindi/default.rb', line 21

def api_endpoint
  ENV['VINDI_API_ENDPOINT'] || API_ENDPOINT
end

.connection_optionsObject



47
48
49
50
51
52
53
# File 'lib/vindi/default.rb', line 47

def connection_options
  {
    headers: {
      'User-Agent': user_agent
    }
  }
end

.default_media_typeString

Default media type header string from ENV or MEDIA_TYPE

Returns:

  • (String)


27
28
29
# File 'lib/vindi/default.rb', line 27

def default_media_type
  ENV['VINDI_MEDIA_TYPE'] || MEDIA_TYPE
end

.keyString

Default user KEY string from ENV

Returns:

  • (String)


33
34
35
# File 'lib/vindi/default.rb', line 33

def key
  ENV['VINDI_KEY']
end

.middlewareObject



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

def middleware
  MIDDLEWARE
end

.optionsHash

Default Settings for Vindi Ruby Gem

Returns:

  • (Hash)


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

def options
  Hash[Vindi::Configuration.keys
    .map{ |key| [key, send(key)] }]
end

.user_agentString

Default User-Agent header string from ENV or USER_AGENT

Returns:

  • (String)


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

def user_agent
  ENV['VINDI_USER_AGENT'] || USER_AGENT
end