pr-pin 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/pr/pin/relations/customers.rb +5 -0
- data/lib/pr/pin/repositories.rb +0 -1
- data/lib/pr/pin/repositories/charges.rb +16 -1
- data/lib/pr/pin/repositories/customers.rb +28 -1
- data/lib/pr/pin/repositories/plans.rb +28 -1
- data/lib/pr/pin/repositories/subscriptions.rb +24 -3
- data/lib/pr/pin/version.rb +1 -1
- metadata +16 -17
- data/lib/pr/pin/repositories/concerns/common.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acab6275b496fc2676179e808b656594b3ef1974b5b6ddf4992f9cf0da1f1ba3
|
4
|
+
data.tar.gz: ca330a57e17884ee194a10db7bc60b7d08ae0b9307c5f2a3dc93b718c948ca9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7d7c6fd2d8344fb4fa2b9af38bfd6ffe0988daccdd8815f0e600f573af763b92ade467ec1adbfa77d03670d7d6bfebfd9392dd13ea4db72bd7737726f45718
|
7
|
+
data.tar.gz: 1c2dd8440d8cd94848bcac71a0caf45e8c6179dd579af54967afd93a154b1ab1b88fc96c1f89e0eec08f7e8622d9b05d667908a297481fa9055a80228eb28356
|
data/README.md
CHANGED
@@ -151,8 +151,8 @@ Coverage of https://pinpayments.com/developers/api-reference
|
|
151
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: |
|
152
152
|
| Customers | POST /customers | Creates a new customer | [:link:](https://pinpayments.com/developers/api-reference/customers#post-customers) | :heavy_check_mark: |
|
153
153
|
| Customers | GET /customers | Returns a paginated list of all customers | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customers) | :heavy_check_mark: |
|
154
|
-
| Customers | GET /customers/customer-token | Returns the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#get-customer) | :
|
155
|
-
| Customers | PUT /customers/customer-token | Updates the details of a customer | [:link:](https://pinpayments.com/developers/api-reference/customers#put-customer) | :
|
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: |
|
156
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: |
|
157
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: |
|
158
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: |
|
@@ -163,15 +163,15 @@ Coverage of https://pinpayments.com/developers/api-reference
|
|
163
163
|
| Events | GET /events/event-token | Returns the details of the specified event | [:link:](https://pinpayments.com/developers/api-reference/events#get-event) | :x: |
|
164
164
|
| Plans | POST /plans | Creates a new plan | [:link:](https://pinpayments.com/developers/api-reference/plans#post-plans) | :heavy_check_mark: |
|
165
165
|
| Plans | GET /plans | Returns a paginated list of all plans | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plans) | :heavy_check_mark: |
|
166
|
-
| Plans | GET /plans/plan-token | Returns the details of a specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#get-plan) | :
|
167
|
-
| Plans | PUT /plans/plan-token | Update the specified plan | [:link:](https://pinpayments.com/developers/api-reference/plans#put-plan) | :
|
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: |
|
168
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: |
|
169
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: |
|
170
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: |
|
171
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: |
|
172
172
|
| Subscriptions | GET /subscriptions | Returns a paginated list of all subscriptions | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#get-subscriptions) | :heavy_check_mark: |
|
173
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) | :
|
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: |
|
175
175
|
| Subscriptions | DELETE /subscriptions/sub-token | Cancels the subscription identified by subscription token | [:link:](https://pinpayments.com/developers/api-reference/subscriptions#delete-subscription) | :x: |
|
176
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: |
|
177
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: |
|
@@ -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
|
data/lib/pr/pin/repositories.rb
CHANGED
@@ -3,7 +3,6 @@ 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'
|
9
8
|
require 'pr/pin/repositories/ledger'
|
@@ -2,7 +2,13 @@ module PR
|
|
2
2
|
module Pin
|
3
3
|
module Repositories
|
4
4
|
class Charges < ROM::Repository[:charges]
|
5
|
-
|
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
|
6
12
|
|
7
13
|
def find(token)
|
8
14
|
relation = root.with_path(token)
|
@@ -10,6 +16,15 @@ module PR
|
|
10
16
|
API::Result.wrap(relation) { relation.one }
|
11
17
|
end
|
12
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
|
27
|
+
|
13
28
|
def search(**params)
|
14
29
|
relation = root.append_path('search').with_params(params)
|
15
30
|
|
@@ -2,7 +2,34 @@ module PR
|
|
2
2
|
module Pin
|
3
3
|
module Repositories
|
4
4
|
class Customers < ROM::Repository[:customers]
|
5
|
-
|
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
|
@@ -2,7 +2,34 @@ module PR
|
|
2
2
|
module Pin
|
3
3
|
module Repositories
|
4
4
|
class Plans < ROM::Repository[:plans]
|
5
|
-
|
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
|
@@ -2,13 +2,34 @@ module PR
|
|
2
2
|
module Pin
|
3
3
|
module Repositories
|
4
4
|
class Subscriptions < ROM::Repository[:subscriptions]
|
5
|
-
|
5
|
+
struct_namespace PR::Pin::Struct
|
6
6
|
|
7
|
-
def
|
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)
|
8
14
|
API::Result.wrap(root) do
|
9
|
-
root.append_path(token).
|
15
|
+
root.append_path(token).command(:update).call(*args)
|
10
16
|
end
|
11
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
|
12
33
|
end
|
13
34
|
end
|
14
35
|
end
|
data/lib/pr/pin/version.rb
CHANGED
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.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AMHOL
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-19 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: '
|
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: '
|
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: '
|
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: '
|
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.
|
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.
|
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.
|
@@ -198,7 +198,6 @@ files:
|
|
198
198
|
- lib/pr/pin/relations/subscriptions.rb
|
199
199
|
- lib/pr/pin/repositories.rb
|
200
200
|
- lib/pr/pin/repositories/charges.rb
|
201
|
-
- lib/pr/pin/repositories/concerns/common.rb
|
202
201
|
- lib/pr/pin/repositories/customers.rb
|
203
202
|
- lib/pr/pin/repositories/ledger.rb
|
204
203
|
- lib/pr/pin/repositories/plans.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
|