Module: PaysonAPI::V2

Defined in:
lib/payson_api/v2/client.rb,
lib/payson_api/v2/config.rb,
lib/payson_api/v2/models/order.rb,
lib/payson_api/v2/models/account.rb,
lib/payson_api/v2/requests/order.rb,
lib/payson_api/v2/models/checkout.rb,
lib/payson_api/v2/models/customer.rb,
lib/payson_api/v2/models/merchant.rb,
lib/payson_api/v2/models/order_item.rb,
lib/payson_api/v2/requests/customer.rb,
lib/payson_api/v2/requests/merchant.rb,
lib/payson_api/v2/requests/order_item.rb,
lib/payson_api/v2/errors/validation_error.rb,
lib/payson_api/v2/requests/list_checkouts.rb,
lib/payson_api/v2/requests/create_checkout.rb,
lib/payson_api/v2/requests/update_checkout.rb,
lib/payson_api/v2/errors/unauthorized_error.rb

Defined Under Namespace

Modules: Errors, Models, Requests Classes: Client, Configuration

Constant Summary collapse

PAYSON_API_ENDPOINT =
'https://%s.payson.se'
PAYSON_API_VERSION =
'2.0'
PAYSON_API_RESOURCES =
{
  checkouts: {
    create: 'Checkouts',
    update: 'Checkouts/%s',
    get: 'Checkouts/%s',
    list: 'Checkouts'
  },
  accounts: {
    get: 'Accounts'
  }
}.freeze
PAYSON_API_TEST_ENDPOINT =
'https://test-api.payson.se'
LOCALES =
%w[SV EN FI].freeze
CURRENCIES =
%w[sek eur].freeze

Class Method Summary collapse

Class Method Details

.api_base_urlObject



47
48
49
# File 'lib/payson_api/v2/config.rb', line 47

def api_base_url
  test? ? PAYSON_API_TEST_ENDPOINT : PAYSON_API_ENDPOINT
end

.configObject



30
31
32
# File 'lib/payson_api/v2/config.rb', line 30

def config
  @config
end

.configure {|@config ||= Configuration.new| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/payson_api/v2/config.rb', line 26

def configure
  yield @config ||= Configuration.new # rubocop:disable Naming/MemoizedInstanceVariableName
end

.test?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/payson_api/v2/config.rb', line 43

def test?
  @config.test_mode || @config.api_user_id == '4'
end