module PR::Pin

Constants

Error
Inflector
LIVE_URL
SANDBOX_URL
VERSION

Public Class Methods

charges(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 52
def charges(identifier = :default)
  Repositories::Charges.new(environments[identifier])
end
customers(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 56
def customers(identifier = :default)
  Repositories::Customers.new(environments[identifier])
end
environments() click to toggle source
# File lib/pr/pin.rb, line 48
def environments
  resolve(:environments)
end
ledger(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 60
def ledger(identifier = :default)
  Repositories::Ledger.new(environments[identifier])
end
plans(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 64
def plans(identifier = :default)
  Repositories::Plans.new(environments[identifier])
end
refunds(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 68
def refunds(identifier = :default)
  Repositories::Refunds.new(environments[identifier])
end
register_connection( identifier = :default, secret_key:, sandbox: true, error_handler: nil ) click to toggle source
# File lib/pr/pin.rb, line 23
def register_connection(
  identifier = :default,
  secret_key:,
  sandbox: true,
  error_handler: nil
)
  configuration = ROM::Configuration.new(:pr_pin, {
    uri: sandbox ? SANDBOX_URL : LIVE_URL,
    secret_key: secret_key,
    error_handler: error_handler || resolve(:default_error_handler),
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'User-Agent': "pr-pin:#{VERSION}"
    }
  })

  configuration.auto_registration(
    File.expand_path('pin', __dir__),
    namespace: 'PR::Pin'
  )

  environments[identifier] = ROM.container(configuration)
end
subscriptions(identifier = :default) click to toggle source
# File lib/pr/pin.rb, line 72
def subscriptions(identifier = :default)
  Repositories::Subscriptions.new(environments[identifier])
end