Class: Nova::API::Base

Inherits:
Utils::BaseStruct show all
Defined in:
lib/nova/api/base.rb

Constant Summary collapse

SCHEME =
'https'
PRODUCTION_HOST =
'nova.money'
STAGING_HOST =
'staging.nova.money'

Constants inherited from Utils::BaseStruct

Utils::BaseStruct::DATE_REGEX

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Utils::BaseStruct

#allowed_attributes

Class Method Details

.base_urlObject



15
16
17
18
19
20
21
# File 'lib/nova/api/base.rb', line 15

def self.base_url
  raise Nova::API::MissingSubdomainError, 'The subdomain must be informed' if configuration.subdomain.nil? || configuration.subdomain.empty?

  host = configuration.use_staging? ? STAGING_HOST : PRODUCTION_HOST

  "#{SCHEME}://#{configuration.subdomain}.#{host}"
end

.endpointObject



11
12
13
# File 'lib/nova/api/base.rb', line 11

def self.endpoint
  raise EndpointNotConfiguredError, 'Each class must implement its own endpoint'
end

Instance Method Details

#endpointObject



24
25
26
# File 'lib/nova/api/base.rb', line 24

def endpoint
  raise EndpointNotConfiguredError, 'Each class must implement its own endpoint'
end