module Promisepay::Configurable

Configuration options for {Client}, defaulting to values in {Default}.

Attributes

api_domain[RW]

@!attribute api_domain

@return [String] Promisepay API domain name. default: api.promisepay.com

@!attribute environment

@see http://docs.promisepay.com/v2.2/docs/environments
@return [String] Promisepay environment. default: test

@!attribute token

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay token for Basic Authentication.

@!attribute username

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay username for Basic Authentication.

@!attribute errors_format

@return [String] {'processed', 'raw'} format to be used for exception messages.
environment[RW]

@!attribute api_domain

@return [String] Promisepay API domain name. default: api.promisepay.com

@!attribute environment

@see http://docs.promisepay.com/v2.2/docs/environments
@return [String] Promisepay environment. default: test

@!attribute token

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay token for Basic Authentication.

@!attribute username

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay username for Basic Authentication.

@!attribute errors_format

@return [String] {'processed', 'raw'} format to be used for exception messages.
errors_format[RW]

@!attribute api_domain

@return [String] Promisepay API domain name. default: api.promisepay.com

@!attribute environment

@see http://docs.promisepay.com/v2.2/docs/environments
@return [String] Promisepay environment. default: test

@!attribute token

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay token for Basic Authentication.

@!attribute username

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay username for Basic Authentication.

@!attribute errors_format

@return [String] {'processed', 'raw'} format to be used for exception messages.
token[RW]

@!attribute api_domain

@return [String] Promisepay API domain name. default: api.promisepay.com

@!attribute environment

@see http://docs.promisepay.com/v2.2/docs/environments
@return [String] Promisepay environment. default: test

@!attribute token

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay token for Basic Authentication.

@!attribute username

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay username for Basic Authentication.

@!attribute errors_format

@return [String] {'processed', 'raw'} format to be used for exception messages.
username[RW]

@!attribute api_domain

@return [String] Promisepay API domain name. default: api.promisepay.com

@!attribute environment

@see http://docs.promisepay.com/v2.2/docs/environments
@return [String] Promisepay environment. default: test

@!attribute token

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay token for Basic Authentication.

@!attribute username

@see http://docs.promisepay.com/v2.2/docs/overview-2
@return [String] Promisepay username for Basic Authentication.

@!attribute errors_format

@return [String] {'processed', 'raw'} format to be used for exception messages.

Public Class Methods

keys() click to toggle source

List of configurable keys for {Promisepay::Client}.

@return [Array] of option keys

# File lib/promisepay/configurable.rb, line 24
def keys
  @keys ||= [
    :environment,
    :api_domain,
    :token,
    :username,
    :errors_format
  ]
end

Public Instance Methods

api_endpoint() click to toggle source

API endpoint to be used by {Promisepay::Client}. Built from {#environment} and {#api_domain}

@return [String]

# File lib/promisepay/configurable.rb, line 48
def api_endpoint
  "https://#{@environment}.#{@api_domain}/"
end
reset!() click to toggle source

Reset configuration options to default values.

# File lib/promisepay/configurable.rb, line 36
def reset!
  Promisepay::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Promisepay::Default.options[key])
  end
  self
end
Also aliased as: setup
setup()
Alias for: reset!