Module: PR::Pin
- Extended by:
- Dry::Container::Mixin
- Defined in:
- lib/pr/pin.rb,
lib/pr/pin/error.rb,
lib/pr/pin/types.rb,
lib/pr/pin/struct.rb,
lib/pr/pin/version.rb,
lib/pr/pin/api/error.rb,
lib/pr/pin/inflector.rb,
lib/pr/pin/api/result.rb,
lib/pr/pin/adapter/errors.rb,
lib/pr/pin/adapter/dataset.rb,
lib/pr/pin/adapter/gateway.rb,
lib/pr/pin/relations/plans.rb,
lib/pr/pin/adapter/commands.rb,
lib/pr/pin/adapter/relation.rb,
lib/pr/pin/adapter/response.rb,
lib/pr/pin/relations/ledger.rb,
lib/pr/pin/relations/charges.rb,
lib/pr/pin/relations/refunds.rb,
lib/pr/pin/repositories/plans.rb,
lib/pr/pin/relations/customers.rb,
lib/pr/pin/repositories/ledger.rb,
lib/pr/pin/api/paginated_result.rb,
lib/pr/pin/repositories/charges.rb,
lib/pr/pin/repositories/refunds.rb,
lib/pr/pin/repositories/customers.rb,
lib/pr/pin/relations/subscriptions.rb,
lib/pr/pin/adapter/paginated_response.rb,
lib/pr/pin/repositories/subscriptions.rb,
lib/pr/pin/adapter/handlers/json_request.rb,
lib/pr/pin/adapter/handlers/json_response.rb
Defined Under Namespace
Modules: API, Adapter, Relations, Repositories, Struct, Types
Constant Summary
collapse
- LIVE_URL =
'https://api.pinpayments.com/1'.freeze
- SANDBOX_URL =
'https://test-api.pinpayments.com/1'.freeze
- Error =
Class.new(StandardError)
- VERSION =
'0.7.2'.freeze
- Inflector =
Dry::Inflector.new
Class Method Summary
collapse
Class Method Details
.charges(identifier = :default) ⇒ Object
52
53
54
|
# File 'lib/pr/pin.rb', line 52
def charges(identifier = :default)
Repositories::Charges.new(environments[identifier])
end
|
.customers(identifier = :default) ⇒ Object
56
57
58
|
# File 'lib/pr/pin.rb', line 56
def customers(identifier = :default)
Repositories::Customers.new(environments[identifier])
end
|
.environments ⇒ Object
48
49
50
|
# File 'lib/pr/pin.rb', line 48
def environments
resolve(:environments)
end
|
.ledger(identifier = :default) ⇒ Object
60
61
62
|
# File 'lib/pr/pin.rb', line 60
def ledger(identifier = :default)
Repositories::Ledger.new(environments[identifier])
end
|
.plans(identifier = :default) ⇒ Object
64
65
66
|
# File 'lib/pr/pin.rb', line 64
def plans(identifier = :default)
Repositories::Plans.new(environments[identifier])
end
|
.refunds(identifier = :default) ⇒ Object
68
69
70
|
# 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) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# 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) ⇒ Object
72
73
74
|
# File 'lib/pr/pin.rb', line 72
def subscriptions(identifier = :default)
Repositories::Subscriptions.new(environments[identifier])
end
|