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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f65867e3c6f97d7f757e23c199c1b167aafd1a1767587d3d3bbe08b7723b1c3
4
- data.tar.gz: cf527404ec9820b32de96b39f9fb6c0393de564839182a7ee0806dd456c74594
3
+ metadata.gz: acab6275b496fc2676179e808b656594b3ef1974b5b6ddf4992f9cf0da1f1ba3
4
+ data.tar.gz: ca330a57e17884ee194a10db7bc60b7d08ae0b9307c5f2a3dc93b718c948ca9e
5
5
  SHA512:
6
- metadata.gz: 1b54eb6c97cb8a674d1c89ec09f11b52d0d20fbd7c85dd28f5b5ffeee6c72e6deb57fcb40840721c23e39a1103e6f9342efbd877a70f634555b175f9fb4a522c
7
- data.tar.gz: e630995c83be98c087a628f29e41048baa1c63d86d21f0c2dd6fde2e6727994b0c8b8302c6b0b903fbe5762bb1b8d6689f1ed26e515b8bd3e9cebf4cc3fa15b7
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) | :x: |
155
- | 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: |
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) | :x: |
167
- | 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: |
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) | :x: |
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
@@ -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
- 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
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
- 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
@@ -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
@@ -2,13 +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
6
 
7
- def find(token)
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).one
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
@@ -1,5 +1,5 @@
1
1
  module PR
2
2
  module Pin
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.7.0'.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.6.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-07-14 00:00:00.000000000 Z
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: '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.
@@ -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