pr-pin 0.3.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 915ba4a1b62cee7806b8e50335d40bc7b5ae6ad5f3feb54147eef6112d3a46a2
4
- data.tar.gz: cb6e578f737a1102a284e9f6cb18bc2be0ec119c9dcad5287506529a413c0a11
3
+ metadata.gz: 6f32e8eefb471ea647f6268f379cd63a07525430f00bfc1a6e5f88e1988314ac
4
+ data.tar.gz: ea49d8cb25bb42d26d50a1efc8f05a085acbe8aa17feeae5c3b3ff18577d3f71
5
5
  SHA512:
6
- metadata.gz: 1b4e1ca34d765ae2d152e58c37495940a00335cbd4b18dea237e9a0c9a310497733a2604d98d9b0bc65a530862dcb4a88b5f1fdf0f9e805227b5f7e12c484c25
7
- data.tar.gz: 1d415283974aecc4a07cce0b69c5757c359dab4665a091b5a6bad9a3507897c0c36e3a282ca705c300b212dd95c0a8d0a92a1837282331db13362aa2b686ed53
6
+ metadata.gz: 503d6ef1300c1562bf88392cc886e75e714c389e1299320867be5ad7ade12b406aa3a051ddaf2c83e6ef232cb90fd9b59e83676318514fde1b5d12e1de922937
7
+ data.tar.gz: 3d6682b40e28aba0cd5e219dafc5c00d0f6dc30ae6d3535e6efbf73facaf4d7681db3ee069c6f435dc4e2e2c0e39801a214d73620d5192002e4b4a85f25909a1
data/README.md CHANGED
@@ -66,6 +66,10 @@ charge = PR::Pin.charges.create(
66
66
  charge.success? # => true
67
67
  charge.error? # => false
68
68
  charge # => #<PR::Pin::Struct::Charge>
69
+
70
+ # Find a charge by token
71
+ PR::Pin.charges.find('ch_1ee2d1')
72
+ # => #<PR::Pin::Struct::Charge>
69
73
  ```
70
74
 
71
75
  ### Recurring payments
@@ -88,6 +92,35 @@ subscription = PR::Pin.subscriptions.create(
88
92
  subscription.success? # => true
89
93
  subscription.error? # => false
90
94
  subscription # => #<PR::Pin::Struct::Subscription>
95
+
96
+ ledger = PR::Pin.ledger.for_subscription('sub_293857')
97
+ subscription.success? # => true
98
+ subscription.error? # => false
99
+ ledger
100
+ # => [
101
+ # #<PR::Pin::Struct::Ledger type="credit" annotation="charge_credit" amount=1026 currency="AUD" created_at=#<DateTime: 2020-07-02T02:19:50+00:00 ((2459033j,8390s,0n),+0s,2299161j)>>,
102
+ # #<PR::Pin::Struct::Ledger type="debit" annotation="interval_fee" amount=1026 currency="AUD" created_at=#<DateTime: 2020-07-02T02:19:47+00:00 ((2459033j,8387s,0n),+0s,2299161j)>>,
103
+ # #<PR::Pin::Struct::Ledger type="debit" annotation="setup_fee" amount=0 currency="AUD" created_at=#<DateTime: 2020-07-02T02:19:47+00:00 ((2459033j,8387s,0n),+0s,2299161j)>>
104
+ # ]
105
+ ```
106
+
107
+ ### Refunds
108
+ ```ruby
109
+ # List refunds (paginated)
110
+ refunds = PR::Pin.refunds.list
111
+ # => [#<PR::Pin::Struct::Refund>, ...]
112
+
113
+ # Find a specific refund
114
+ refund = PR::Pin.refunds.find('rf_1e5429')
115
+ # => #<PR::Pin::Struct::Refund>
116
+
117
+ # Create a refund for a charge
118
+ PR::Pin.refunds.create_for_charge('ch_1ee2d1')
119
+ # => #<PR::Pin::Struct::Refund>
120
+
121
+ # List all refunds by charge
122
+ PR::Pin.refunds.for_charge('ch_1ee2d1')
123
+ # => [#<PR::Pin::Struct::Refund>, ...]
91
124
  ```
92
125
 
93
126
  ### Errors - See [PR::Pin::API::Error](https://github.com/PetRescue/pr-pin/blob/master/lib/pr/pin/api/error.rb)
@@ -115,11 +148,11 @@ Coverage of https://pinpayments.com/developers/api-reference
115
148
  | Charges | PUT /charges/charge-token/capture | Captures a previously authorised charge | [:link:](https://pinpayments.com/developers/api-reference/charges#put-charges) | :x: |
116
149
  | Charges | GET /charges | Returns a paginated list of all charges | [:link:](https://pinpayments.com/developers/api-reference/charges#get-charges) | :heavy_check_mark: |
117
150
  | Charges | GET /charges/search | Returns a paginated list of charges matching the search criteria | [:link:](https://pinpayments.com/developers/api-reference/charges#search-charges) | :heavy_check_mark: |
118
- | Charges | GET /charges/charge-token | Returns the details of a charge | [:link:](https://pinpayments.com/developers/api-reference/charges#get-charge) | :x: |
151
+ | Charges | GET /charges/charge-token | Returns the details of a charge | [:link:](https://pinpayments.com/developers/api-reference/charges#get-charge) | :heavy_check_mark: |
119
152
  | Customers | POST /customers | Creates a new customer | [:link:](https://pinpayments.com/developers/api-reference/customers#post-customers) | :heavy_check_mark: |
120
153
  | Customers | GET /customers | Returns a paginated list of all customers | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customers) | :heavy_check_mark: |
121
- | Customers | GET /customers/customer-token | Returns the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customer) | :x: |
122
- | Customers | PUT /customers/customer-token | Updates the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#put-customer) | :x: |
154
+ | Customers | GET /customers/customer-token | Returns the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customer) | :heavy_check_mark: |
155
+ | Customers | PUT /customers/customer-token | Updates the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#put-customer) | :heavy_check_mark: |
123
156
  | Customers | DELETE /customers/customer-token | Deletes a customer and all of its cards | [:link:](https://pinpayments.com/developers/api-reference/customers#delete-customer) | :x: |
124
157
  | Customers | GET /customers/customer-token/charges | Returns a paginated list of a customer's charges | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customers-charges) | :x: |
125
158
  | Customers | GET /customers/customer-token/cards | Returns a paginated list of a customer's cards | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customers-cards) | :x: |
@@ -130,27 +163,27 @@ Coverage of https://pinpayments.com/developers/api-reference
130
163
  | Events | GET /events/event-token | Returns the details of the specified event | [:link:](https://pinpayments.com/developers/api-reference/events#get-event) | :x: |
131
164
  | Plans | POST /plans | Creates a new plan | [:link:](https://pinpayments.com/developers/api-reference/plans#post-plans) | :heavy_check_mark: |
132
165
  | Plans | GET /plans | Returns a paginated list of all plans | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plans) | :heavy_check_mark: |
133
- | Plans | GET /plans/plan-token | Returns the details of a specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plan) | :x: |
134
- | Plans | PUT /plans/plan-token | Update the specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#put-plan) | :x: |
166
+ | Plans | GET /plans/plan-token | Returns the details of a specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plan) | :heavy_check_mark: |
167
+ | Plans | PUT /plans/plan-token | Update the specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#put-plan) | :heavy_check_mark: |
135
168
  | Plans | DELETE /plans/plan-token | Deletes a plan and all of its subscriptions | [:link:](https://pinpayments.com/developers/api-reference/plans#delete-plan) | :x: |
136
169
  | Plans | POST /plans/plan-token/subscriptions | Creates a new subscription to the specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#create-plan-subscription) | :x: |
137
170
  | Plans | GET /plans/plan-token/subscriptions | Returns a paginated list of subscriptions for a plan | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plan-subscriptions) | :x: |
138
171
  | Subscriptions | POST /subscriptions | Activate a new subscription and returns its details | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#post-subscriptions) | :heavy_check_mark: |
139
172
  | Subscriptions | GET /subscriptions | Returns a paginated list of all subscriptions | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#get-subscriptions) | :heavy_check_mark: |
140
- | Subscriptions | GET /subscriptions/sub-token | Returns the details of the subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#get-subscription) | :x: |
141
- | Subscriptions | PUT /subscriptions/sub-token | Updates the card associated with a subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#update-subscription) | :x: |
173
+ | Subscriptions | GET /subscriptions/sub-token | Returns the details of the subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#get-subscription) | :heavy_check_mark: |
174
+ | Subscriptions | PUT /subscriptions/sub-token | Updates the card associated with a subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#update-subscription) | :heavy_check_mark: |
142
175
  | Subscriptions | DELETE /subscriptions/sub-token | Cancels the subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#delete-subscription) | :x: |
143
176
  | Subscriptions | PUT /subscriptions/sub-token/reactivate | Reactivates the subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#reactivate-subscription) | :x: |
144
- | Subscriptions | GET /subscriptions/sub-token/ledger | Fetch the ledger entries relating to a subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#ledger-subscription) | :x: |
177
+ | Subscriptions | GET /subscriptions/sub-token/ledger | Fetch the ledger entries relating to a subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#ledger-subscription) | :heavy_check_mark: |
145
178
  | Recipients | POST /recipients | Creates a new recipient | [:link:](https://pinpayments.com/developers/api-reference/recipients#post-recipients) | :x: |
146
179
  | Recipients | GET /recipients | Returns a paginated list of all recipients | [:link:](https://pinpayments.com/developers/api-reference/recipients#get-recipients) | :x: |
147
180
  | Recipients | GET /recipients/recipient-token | Returns the details of a recipient | [:link:](https://pinpayments.com/developers/api-reference/recipients#get-recipient) | :x: |
148
181
  | Recipients | PUT /recipients/recipient-token | Updates the details of a recipient | [:link:](https://pinpayments.com/developers/api-reference/recipients#put-recipient) | :x: |
149
182
  | Recipients | GET /recipients/recipient-token/transfers | Returns a paginated list of a recipient's transfers | [:link:](https://pinpayments.com/developers/api-reference/recipients#get-recipients-transfers) | :x: |
150
- | Refunds | GET /refunds | Returns a paginated list of all refunds | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-refunds) | :x: |
151
- | Refunds | GET /refunds/refund-token | Returns the details of the specified refund | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-refund) | :x: |
152
- | Refunds | POST /charges/charge-token/refunds | Creates a new refund and returns its details | [:link:](https://pinpayments.com/developers/api-reference/refunds#post-refunds) | :x: |
153
- | Refunds | GET /charges/charge-token/refunds | Returns a list of all refunds for the specified charge | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-token-refunds) | :x: |
183
+ | Refunds | GET /refunds | Returns a paginated list of all refunds | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-refunds) | :heavy_check_mark: |
184
+ | Refunds | GET /refunds/refund-token | Returns the details of the specified refund | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-refund) | :heavy_check_mark: |
185
+ | Refunds | POST /charges/charge-token/refunds | Creates a new refund and returns its details | [:link:](https://pinpayments.com/developers/api-reference/refunds#post-refunds) | :heavy_check_mark: |
186
+ | Refunds | GET /charges/charge-token/refunds | Returns a list of all refunds for the specified charge | [:link:](https://pinpayments.com/developers/api-reference/refunds#get-token-refunds) | :heavy_check_mark: |
154
187
  | Transfers | POST /transfers | Creates a new transfer | [:link:](https://pinpayments.com/developers/api-reference/transfers#post-transfers) | :x: |
155
188
  | Transfers | GET /transfers | Returns a paginated list of all transfers | [:link:](https://pinpayments.com/developers/api-reference/transfers#get-transfers) | :x: |
156
189
  | Transfers | GET /transfers/search | Returns a paginated list of transfers matching the search criteria | [:link:](https://pinpayments.com/developers/api-reference/transfers#search-transfers) | :x: |
@@ -57,10 +57,18 @@ module PR
57
57
  Repositories::Customers.new(environments[identifier])
58
58
  end
59
59
 
60
+ def ledger(identifier = :default)
61
+ Repositories::Ledger.new(environments[identifier])
62
+ end
63
+
60
64
  def plans(identifier = :default)
61
65
  Repositories::Plans.new(environments[identifier])
62
66
  end
63
67
 
68
+ def refunds(identifier = :default)
69
+ Repositories::Refunds.new(environments[identifier])
70
+ end
71
+
64
72
  def subscriptions(identifier = :default)
65
73
  Repositories::Subscriptions.new(environments[identifier])
66
74
  end
@@ -4,6 +4,7 @@ module PR
4
4
  module Commands
5
5
  class Create < ROM::HTTP::Commands::Create
6
6
  adapter :pr_pin
7
+ restrictable true
7
8
 
8
9
  def execute(*args, &block)
9
10
  relation.new(super.map(&:to_h)).to_a
@@ -12,6 +13,7 @@ module PR
12
13
 
13
14
  class Update < ROM::HTTP::Commands::Update
14
15
  adapter :pr_pin
16
+ restrictable true
15
17
 
16
18
  def execute(*args, &block)
17
19
  relation.new(super.map(&:to_h)).to_a
@@ -20,6 +22,7 @@ module PR
20
22
 
21
23
  class Delete < ROM::HTTP::Commands::Delete
22
24
  adapter :pr_pin
25
+ restrictable true
23
26
  end
24
27
  end
25
28
  end
@@ -5,6 +5,11 @@ module PR
5
5
  schema(:customers) do
6
6
  attribute :token, Types::Strict::String
7
7
  attribute :email, Types::Strict::String
8
+ attribute :first_name, Types::Strict::String.optional
9
+ attribute :last_name, Types::Strict::String.optional
10
+ attribute :phone_number, Types::Strict::String.optional
11
+ attribute :company, Types::Strict::String.optional
12
+ attribute :notes, Types::Strict::String.optional
8
13
  attribute :created_at, Types::JSON::DateTime
9
14
  attribute :card, Types::JSON::Hash
10
15
  end
@@ -0,0 +1,19 @@
1
+ module PR
2
+ module Pin
3
+ module Relations
4
+ class Ledger < ROM::Relation[:pr_pin]
5
+ schema(:ledger) do
6
+ attribute :type, Types::Strict::String
7
+ attribute :annotation, Types::Strict::String
8
+ attribute :amount, Types::Strict::Integer
9
+ attribute :currency, Types::Strict::String
10
+ attribute :created_at, Types::JSON::DateTime
11
+ end
12
+
13
+ def for_subscription(token)
14
+ with_base_path("/subscriptions/#{token}/ledger")
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ module PR
2
+ module Pin
3
+ module Relations
4
+ class Refunds < ROM::Relation[:pr_pin]
5
+ schema(:refunds) do
6
+ attribute :token, Types::Strict::String
7
+ attribute :success, Types::Bool.optional
8
+ attribute :amount, Types::Strict::Integer
9
+ attribute :currency, Types::Strict::String
10
+ attribute :charge, Types::Strict::String
11
+ attribute :error_message, Types::Strict::String.optional
12
+ attribute :status_message, Types::Strict::String
13
+ attribute :created_at, Types::JSON::DateTime
14
+ end
15
+
16
+ def for_charge(token)
17
+ with_base_path("/charges/#{token}/refunds")
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -4,8 +4,8 @@ module PR
4
4
  class Subscriptions < ROM::Relation[:pr_pin]
5
5
  schema(:subscriptions) do
6
6
  attribute :state, Types::Strict::String
7
- attribute :next_billing_date, Types::JSON::DateTime
8
- attribute :active_interval_started_at, Types::JSON::DateTime
7
+ attribute :next_billing_date, Types::JSON::DateTime.optional
8
+ attribute :active_interval_started_at, Types::JSON::DateTime.optional
9
9
  attribute :active_interval_finishes_at, Types::JSON::DateTime.optional
10
10
  attribute :cancelled_at, Types::JSON::DateTime.optional
11
11
  attribute :created_at, Types::JSON::DateTime
@@ -3,8 +3,9 @@ require 'pr/pin/api/error'
3
3
  require 'pr/pin/api/result'
4
4
  require 'pr/pin/api/paginated_result'
5
5
  require 'pr/pin/struct'
6
- require 'pr/pin/repositories/concerns/common'
7
6
  require 'pr/pin/repositories/charges'
8
7
  require 'pr/pin/repositories/customers'
8
+ require 'pr/pin/repositories/ledger'
9
9
  require 'pr/pin/repositories/plans'
10
+ require 'pr/pin/repositories/refunds'
10
11
  require 'pr/pin/repositories/subscriptions'
@@ -2,7 +2,28 @@ module PR
2
2
  module Pin
3
3
  module Repositories
4
4
  class Charges < ROM::Repository[:charges]
5
- include Concerns::Common
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def create(*args)
8
+ API::Result.wrap(root) do
9
+ root.command(:create).call(*args)
10
+ end
11
+ end
12
+
13
+ def find(token)
14
+ relation = root.with_path(token)
15
+
16
+ API::Result.wrap(relation) { relation.one }
17
+ end
18
+
19
+ def list(page: 1, per_page: nil)
20
+ relation = root.with_params(
21
+ page: page,
22
+ per_page: per_page
23
+ )
24
+
25
+ API::PaginatedResult.wrap(relation) { relation.paginate }
26
+ end
6
27
 
7
28
  def search(**params)
8
29
  relation = root.append_path('search').with_params(params)
@@ -2,7 +2,34 @@ module PR
2
2
  module Pin
3
3
  module Repositories
4
4
  class Customers < ROM::Repository[:customers]
5
- include Concerns::Common
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def create(*args)
8
+ API::Result.wrap(root) do
9
+ root.command(:create).call(*args)
10
+ end
11
+ end
12
+
13
+ def update(token, *args)
14
+ API::Result.wrap(root) do
15
+ root.append_path(token).command(:update).call(*args)
16
+ end
17
+ end
18
+
19
+ def find(token)
20
+ relation = root.with_path(token)
21
+
22
+ API::Result.wrap(relation) { relation.one }
23
+ end
24
+
25
+ def list(page: 1, per_page: nil)
26
+ relation = root.with_params(
27
+ page: page,
28
+ per_page: per_page
29
+ )
30
+
31
+ API::PaginatedResult.wrap(relation) { relation.paginate }
32
+ end
6
33
  end
7
34
  end
8
35
  end
@@ -0,0 +1,18 @@
1
+ module PR
2
+ module Pin
3
+ module Repositories
4
+ class Ledger < ROM::Repository[:ledger]
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def for_subscription(token, page: 1, per_page: nil)
8
+ relation = root.for_subscription(token).with_params(
9
+ page: page,
10
+ per_page: per_page
11
+ )
12
+
13
+ API::PaginatedResult.wrap(relation) { relation.paginate }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,7 +2,34 @@ module PR
2
2
  module Pin
3
3
  module Repositories
4
4
  class Plans < ROM::Repository[:plans]
5
- include Concerns::Common
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def create(*args)
8
+ API::Result.wrap(root) do
9
+ root.command(:create).call(*args)
10
+ end
11
+ end
12
+
13
+ def update(token, *args)
14
+ API::Result.wrap(root) do
15
+ root.append_path(token).command(:update).call(*args)
16
+ end
17
+ end
18
+
19
+ def find(token)
20
+ relation = root.with_path(token)
21
+
22
+ API::Result.wrap(relation) { relation.one }
23
+ end
24
+
25
+ def list(page: 1, per_page: nil)
26
+ relation = root.with_params(
27
+ page: page,
28
+ per_page: per_page
29
+ )
30
+
31
+ API::PaginatedResult.wrap(relation) { relation.paginate }
32
+ end
6
33
  end
7
34
  end
8
35
  end
@@ -0,0 +1,41 @@
1
+ module PR
2
+ module Pin
3
+ module Repositories
4
+ class Refunds < ROM::Repository[:refunds]
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def list(page: 1, per_page: nil)
8
+ relation = root.with_params(
9
+ page: page,
10
+ per_page: per_page
11
+ )
12
+
13
+ API::PaginatedResult.wrap(relation) { relation.paginate }
14
+ end
15
+
16
+ def find(token)
17
+ relation = root.with_path(token)
18
+
19
+ API::Result.wrap(relation) { relation.one }
20
+ end
21
+
22
+ def create_for_charge(token, *args)
23
+ relation = root.for_charge(token)
24
+
25
+ API::Result.wrap(relation) do
26
+ relation.command(:create).call(*args)
27
+ end
28
+ end
29
+
30
+ def for_charge(token, page: 1, per_page: nil)
31
+ relation = root.for_charge(token).with_params(
32
+ page: page,
33
+ per_page: per_page
34
+ )
35
+
36
+ API::PaginatedResult.wrap(relation) { relation.paginate }
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,7 +2,34 @@ module PR
2
2
  module Pin
3
3
  module Repositories
4
4
  class Subscriptions < ROM::Repository[:subscriptions]
5
- include Concerns::Common
5
+ struct_namespace PR::Pin::Struct
6
+
7
+ def create(*args)
8
+ API::Result.wrap(root) do
9
+ root.command(:create).call(*args)
10
+ end
11
+ end
12
+
13
+ def update(token, *args)
14
+ API::Result.wrap(root) do
15
+ root.append_path(token).command(:update).call(*args)
16
+ end
17
+ end
18
+
19
+ def find(token)
20
+ relation = root.with_path(token)
21
+
22
+ API::Result.wrap(relation) { relation.one }
23
+ end
24
+
25
+ def list(page: 1, per_page: nil)
26
+ relation = root.with_params(
27
+ page: page,
28
+ per_page: per_page
29
+ )
30
+
31
+ API::PaginatedResult.wrap(relation) { relation.paginate }
32
+ end
6
33
  end
7
34
  end
8
35
  end
@@ -1,5 +1,5 @@
1
1
  module PR
2
2
  module Pin
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.7.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr-pin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AMHOL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -140,28 +140,28 @@ dependencies:
140
140
  name: rom
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 5.1.2
145
+ version: 5.0.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 5.1.2
152
+ version: 5.0.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rom-http
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: 0.8.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.8.0
167
167
  description: Pin Payments API wrapper inplemented using rom-rb HTTP adapter.
@@ -192,13 +192,16 @@ files:
192
192
  - lib/pr/pin/inflector.rb
193
193
  - lib/pr/pin/relations/charges.rb
194
194
  - lib/pr/pin/relations/customers.rb
195
+ - lib/pr/pin/relations/ledger.rb
195
196
  - lib/pr/pin/relations/plans.rb
197
+ - lib/pr/pin/relations/refunds.rb
196
198
  - lib/pr/pin/relations/subscriptions.rb
197
199
  - lib/pr/pin/repositories.rb
198
200
  - lib/pr/pin/repositories/charges.rb
199
- - lib/pr/pin/repositories/concerns/common.rb
200
201
  - lib/pr/pin/repositories/customers.rb
202
+ - lib/pr/pin/repositories/ledger.rb
201
203
  - lib/pr/pin/repositories/plans.rb
204
+ - lib/pr/pin/repositories/refunds.rb
202
205
  - lib/pr/pin/repositories/subscriptions.rb
203
206
  - lib/pr/pin/struct.rb
204
207
  - lib/pr/pin/types.rb
@@ -1,28 +0,0 @@
1
- module PR
2
- module Pin
3
- module Repositories
4
- module Concerns
5
- module Common
6
- def self.included(mod)
7
- mod.struct_namespace(PR::Pin::Struct)
8
- end
9
-
10
- def create(*args)
11
- API::Result.wrap(root) do
12
- root.command(:create).call(*args)
13
- end
14
- end
15
-
16
- def list(page: 1, per_page: nil)
17
- relation = root.with_params(
18
- page: page,
19
- per_page: per_page
20
- )
21
-
22
- API::PaginatedResult.wrap(relation) { relation.paginate }
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end