pin_up 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dadaa5a3ca76c61d6b86c888136f7df5ed353ff268c30174d94c63e7b3c3229
4
- data.tar.gz: 4a9562a6650e9573751fe9111bdb1db9f5a20a42651e7129dae2a944fa45e296
3
+ metadata.gz: 8cd621a87b31feec9398239fb846abf0bc7117d72aac49d9c68d6d7d279fe7c4
4
+ data.tar.gz: 3e5a01721cb0a881664e7643f9295f2bf1a8e1ca0e5344af4cab6ac4c8e50b65
5
5
  SHA512:
6
- metadata.gz: 9dcc1e35755e241979202e1d693031fcd5f341059f3936e7951ffabc61e8596d2d6590ac59da4fdbcd6e2fe957ae361389688f2a7e07a32c83c3328900459ca5
7
- data.tar.gz: 1d0a1855470803206375f525331c20c52b5ecf441e3251895498180d255c2af7d29b1d04ac025940f4cd56ca582a426f1107c0cb237123e2c2ffc8a75fa8c8d4
6
+ metadata.gz: 7ea5de17437a508844cc3989a7203f33c4c29885cc9faab46627c9432e1b67927c2384334a95e9281e986746c554029868c54562e55a33340631034f3cd77a55
7
+ data.tar.gz: 145598a3fef5ce8f34b681443d7eb7ce20a8f9b3f9712aa4733c68473c97cd3e12ed25af85ffb56f30078319c368428194ee7ac054807a21e0d54f9a6656aa79
@@ -6,6 +6,7 @@ rvm:
6
6
  - 2.3.0
7
7
  - 2.4.0
8
8
  - 2.5.0
9
+ - 2.6.3
9
10
  addons:
10
11
  code_climate:
11
12
  repo_token: 497b5dc4169e71803c100a6a07b16356787fa137560de2a3c783e41766b3de18
data/Gemfile CHANGED
@@ -1,14 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "httparty", ">= 0.11.0"
4
-
5
- group :development do
6
- gem "rdoc", "~> 3.12"
7
- gem "rspec" #, "~> 2.13"
8
- gem "jeweler", "~> 2.3.9"
9
- gem "simplecov", "~> 0.7.1"
10
- gem "webmock"#, "~> 1.12.3"
11
- gem "vcr"#, "~> 2.5.0"
12
- gem "guard-rspec" #, "~> 3.0.2"
13
- gem "terminal-notifier-guard", "~> 1.5.3"
14
- end
3
+ gemspec
@@ -1,90 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pin_up (1.4.0)
5
+ httparty (= 0.17.0)
6
+
1
7
  GEM
2
8
  remote: https://rubygems.org/
3
9
  specs:
4
- addressable (2.4.0)
5
- builder (3.2.3)
6
- coderay (1.1.2)
10
+ addressable (2.6.0)
11
+ public_suffix (>= 2.0.2, < 4.0)
7
12
  crack (0.4.3)
8
13
  safe_yaml (~> 1.0.0)
9
- descendants_tracker (0.0.4)
10
- thread_safe (~> 0.3, >= 0.3.1)
11
14
  diff-lcs (1.3)
12
- faraday (0.9.2)
13
- multipart-post (>= 1.2, < 3)
14
- ffi (1.9.25)
15
- formatador (0.2.5)
16
- git (1.4.0)
17
- github_api (0.16.0)
18
- addressable (~> 2.4.0)
19
- descendants_tracker (~> 0.0.4)
20
- faraday (~> 0.8, < 0.10)
21
- hashie (>= 3.4)
22
- mime-types (>= 1.16, < 3.0)
23
- oauth2 (~> 1.0)
24
- guard (2.14.2)
25
- formatador (>= 0.2.4)
26
- listen (>= 2.7, < 4.0)
27
- lumberjack (>= 1.0.12, < 2.0)
28
- nenv (~> 0.1)
29
- notiffany (~> 0.0)
30
- pry (>= 0.9.12)
31
- shellany (~> 0.0)
32
- thor (>= 0.18.1)
33
- guard-compat (1.2.1)
34
- guard-rspec (4.7.3)
35
- guard (~> 2.1)
36
- guard-compat (~> 1.1)
37
- rspec (>= 2.99.0, < 4.0)
38
- hashdiff (0.3.7)
39
- hashie (3.5.7)
40
- highline (2.0.0)
41
- httparty (0.16.2)
15
+ hashdiff (0.4.0)
16
+ httparty (0.17.0)
17
+ mime-types (~> 3.0)
42
18
  multi_xml (>= 0.5.2)
43
- jeweler (2.3.9)
44
- builder
45
- bundler
46
- git (>= 1.2.5)
47
- github_api (~> 0.16.0)
48
- highline (>= 1.6.15)
49
- nokogiri (>= 1.5.10)
50
- psych
51
- rake
52
- rdoc
53
- semver2
54
19
  json (1.8.6)
55
- jwt (1.5.6)
56
- listen (3.1.5)
57
- rb-fsevent (~> 0.9, >= 0.9.4)
58
- rb-inotify (~> 0.9, >= 0.9.7)
59
- ruby_dep (~> 1.2)
60
- lumberjack (1.0.13)
61
- method_source (0.9.0)
62
- mime-types (2.99.3)
63
- mini_portile2 (2.3.0)
20
+ mime-types (3.2.2)
21
+ mime-types-data (~> 3.2015)
22
+ mime-types-data (3.2019.0331)
64
23
  multi_json (1.13.1)
65
24
  multi_xml (0.6.0)
66
- multipart-post (2.0.0)
67
- nenv (0.3.0)
68
- nokogiri (1.8.2)
69
- mini_portile2 (~> 2.3.0)
70
- notiffany (0.1.1)
71
- nenv (~> 0.1)
72
- shellany (~> 0.0)
73
- oauth2 (1.4.0)
74
- faraday (>= 0.8, < 0.13)
75
- jwt (~> 1.0)
76
- multi_json (~> 1.3)
77
- multi_xml (~> 0.5)
78
- rack (>= 1.2, < 3)
79
- pry (0.11.3)
80
- coderay (~> 1.1.0)
81
- method_source (~> 0.9.0)
82
- psych (3.0.2)
83
- rack (2.0.5)
84
- rake (12.3.1)
85
- rb-fsevent (0.10.3)
86
- rb-inotify (0.9.10)
87
- ffi (>= 0.5.0, < 2)
25
+ public_suffix (3.1.1)
88
26
  rdoc (3.12.2)
89
27
  json (~> 1.4)
90
28
  rspec (3.7.0)
@@ -100,36 +38,27 @@ GEM
100
38
  diff-lcs (>= 1.2.0, < 2.0)
101
39
  rspec-support (~> 3.7.0)
102
40
  rspec-support (3.7.1)
103
- ruby_dep (1.5.0)
104
- safe_yaml (1.0.4)
105
- semver2 (3.4.2)
106
- shellany (0.0.1)
41
+ safe_yaml (1.0.5)
107
42
  simplecov (0.7.1)
108
43
  multi_json (~> 1.0)
109
44
  simplecov-html (~> 0.7.1)
110
45
  simplecov-html (0.7.1)
111
- terminal-notifier-guard (1.5.3)
112
- thor (0.20.0)
113
- thread_safe (0.3.6)
114
46
  vcr (4.0.0)
115
- webmock (3.4.2)
47
+ webmock (3.6.0)
116
48
  addressable (>= 2.3.6)
117
49
  crack (>= 0.3.2)
118
- hashdiff
50
+ hashdiff (>= 0.4.0, < 2.0.0)
119
51
 
120
52
  PLATFORMS
121
53
  ruby
122
54
 
123
55
  DEPENDENCIES
124
- guard-rspec
125
- httparty (>= 0.11.0)
126
- jeweler (~> 2.3.9)
56
+ pin_up!
127
57
  rdoc (~> 3.12)
128
- rspec
58
+ rspec (~> 3.7.0)
129
59
  simplecov (~> 0.7.1)
130
- terminal-notifier-guard (~> 1.5.3)
131
- vcr
132
- webmock
60
+ vcr (~> 4.0.0)
61
+ webmock (~> 3.6.0)
133
62
 
134
63
  BUNDLED WITH
135
- 1.16.1
64
+ 1.17.3
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## pin_up
2
2
 
3
- A Ruby gem wrapper for the pin-payments (pin.net.au) API, all of it.
3
+ A Ruby gem wrapper for the pin-payments (pinpayments.com) API, all of it.
4
4
 
5
5
  Support for Ruby Ruby 2.x.x
6
6
 
@@ -115,7 +115,7 @@ With Pagination:
115
115
 
116
116
  Pin::Customer.update('cus_token', hash_of_details)
117
117
 
118
- If passing a hash of details, it must be the full list of details of the credit card to be stored. (https://pin.net.au/docs/api/customers#put-customer)
118
+ If passing a hash of details, it must be the full list of details of the credit card to be stored. (https://pinpayments.com/docs/api/customers#put-customer)
119
119
 
120
120
  ###### Update only an email
121
121
 
@@ -190,20 +190,20 @@ Only use this method if you're comfortable sending card details to your server -
190
190
  ##### Create A Plan
191
191
  Pin::Plan.create(plan)
192
192
 
193
- plan = { name: 'Coffee Plan',
194
- amount: '1000',
195
- currency: 'AUD',
196
- interval: 30,
197
- interval_unit: 'day',
198
- setup_amount: 0,
199
- trial_amount: 0,
200
- trial_interval: 7,
193
+ plan = { name: 'Coffee Plan',
194
+ amount: '1000',
195
+ currency: 'AUD',
196
+ interval: 30,
197
+ interval_unit: 'day',
198
+ setup_amount: 0,
199
+ trial_amount: 0,
200
+ trial_interval: 7,
201
201
  trial_interval_unit: 'day' }
202
-
203
- Note: setup_amount, trial_amount, trial_interval and trial_interval_unit are all optional fields.
202
+
203
+ Note: setup_amount, trial_amount, trial_interval and trial_interval_unit are all optional fields.
204
204
 
205
205
  Pin::Plan.create(plan)
206
-
206
+
207
207
  ##### List All Plans
208
208
  Pin::Plan.all
209
209
 
@@ -214,30 +214,30 @@ Show Plans on a particular page:
214
214
  With Pagination:
215
215
 
216
216
  Pin::Plan.all(3,true)
217
-
217
+
218
218
  ##### Find a Plan
219
219
 
220
220
  Pin::Plan.find(plan_token)
221
221
 
222
222
  Return the details of a specified plan
223
-
223
+
224
224
  ##### Update a Plan
225
225
  Update the name of a specified plan. Only the plan name can be updated!
226
-
226
+
227
227
  Pin::Plan.update(plan_token, name_hash)
228
-
228
+
229
229
  name_hash = { name: 'new_plan_name' }
230
230
 
231
231
  ##### Delete a Plan
232
- Deletes a plan and all of its subscriptions. You will not be able to recover this.
232
+ Deletes a plan and all of its subscriptions. You will not be able to recover this.
233
233
 
234
234
  Note: Plans can only be deleted if they have no running subscriptions.
235
-
235
+
236
236
  Pin::Plan.delete(plan_token)
237
237
 
238
238
  ## Subscriptions
239
239
  ##### Create A Subscription
240
- Activate a new subscription and return its details. The customer's card will immeadiately be billed the initial plan amount, unless there's a trial period.
240
+ Activate a new subscription and return its details. The customer's card will immeadiately be billed the initial plan amount, unless there's a trial period.
241
241
 
242
242
 
243
243
  subscription = { plan_token: plan_token,
@@ -248,7 +248,7 @@ Activate a new subscription and return its details. The customer's card will imm
248
248
  Note: card_token and include_setup_fee are both optional.
249
249
 
250
250
  Pin::Subscription.create(subscription)
251
-
251
+
252
252
  ##### List All Subscriptions
253
253
 
254
254
  Pin::Subscription.all
@@ -260,34 +260,34 @@ Show Subscriptions on a particular page:
260
260
  With Pagination:
261
261
 
262
262
  Pin::Subscription.all(3,true)
263
-
263
+
264
264
  ##### Find a Subscription
265
265
  Return the details of a subscription.
266
266
 
267
267
  Pin::Subscription.find(subscription_token)
268
-
268
+
269
269
  ##### Update a Subscription
270
270
  Updates the card associated with a subscription identified by the subscription token.
271
-
271
+
272
272
  Note: The card token must already be associated to the customer of the subscription.
273
-
273
+
274
274
  Pin::Subscription.update(subscription_token, card_token)
275
-
275
+
276
276
  ##### Delete a Subscription
277
- Cancels the subscription identified by the subscription token. Subscriptions can only be cancelled if they are in a trial or active state.
277
+ Cancels the subscription identified by the subscription token. Subscriptions can only be cancelled if they are in a trial or active state.
278
278
 
279
279
  Note: Subscriptions will only attain a cancelled state once the subscription period has elapsed. Until such time subscriptions will be in a state of 'Cancelling'.
280
-
280
+
281
281
  Pin::Subscription.delete(plan_token)
282
-
282
+
283
283
  ##### Reactivate a Subscription
284
284
  Reactivates the subscription identified by the subscription token returning the details of the subscription
285
-
285
+
286
286
  Pin::Subscription.reactivate(plan_token)
287
287
 
288
288
  ##### List Subscription history
289
289
  Fetch the ledger entries relating to a subscription identified by a subscription token
290
-
290
+
291
291
  Pin::Subscription.history(subscription_token)
292
292
 
293
293
  ###### With pagination
@@ -422,7 +422,7 @@ run
422
422
  ### Record New VCR cassettes
423
423
  After cloning the project one should create a new set of cassettes.
424
424
 
425
- In spec_helper change
425
+ In spec_helper change
426
426
 
427
427
  VCR.use_cassette(name, options) { example.call }
428
428
  to
@@ -433,7 +433,7 @@ Run all tests and then change the line back (replace record: :all with options)
433
433
 
434
434
  ### Updating VCR test cassettes
435
435
  A contributor can update cassettes previously recorded by adding the following syntax:
436
-
436
+
437
437
  record: :all, :match_requests_on => [:method, :host, :path]
438
438
 
439
439
  E.g. in a particular spec file:
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
18
18
  gem.homepage = "http://github.com/dNitza/pin_up"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{A Ruby gem wrapper for the pin-payments API}
21
- gem.description = %Q{A Ruby gem wrapper for the pin-payments (pin.net.au) API}
21
+ gem.description = %Q{A Ruby gem wrapper for the pin-payments (pinpayments.com) API}
22
22
  gem.email = "dnitza@gmail.com"
23
23
  gem.authors = ["Daniel Nitsikopoulos"]
24
24
  # dependencies defined in Gemfile
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
@@ -7,7 +7,7 @@ module Pin
7
7
  # Transfers can only be made using the funds in the available balance.
8
8
  # The pending amount will become available after the 7 day settlement schedule on your charges.
9
9
  #
10
- # https://pin.net.au/docs/api/balance
10
+ # https://pinpayments.com/docs/api/balance
11
11
  def self.get
12
12
  build_response(make_request(:get, { url: 'balance' }))
13
13
  end
@@ -11,7 +11,7 @@ module Pin
11
11
  # A bank account token can only be used once to create a recipient.
12
12
  # The token automatically expires after 1 month if it hasn’t been used.
13
13
  #
14
- # https://pin.net.au/docs/api/bank-accounts
14
+ # https://pinpayments.com/docs/api/bank-accounts
15
15
  def self.create(options)
16
16
  build_response(make_request(:post, { url: 'bank_accounts', options: options }))
17
17
  end
@@ -19,9 +19,9 @@ module Pin
19
19
  @@auth = { username: @key, password: '' }
20
20
  @@timeout = timeout
21
21
  @@base_url = if env == :live
22
- 'https://api.pin.net.au/1/'
22
+ 'https://api.pinpayments.com/1/'
23
23
  elsif env == :test
24
- 'https://test-api.pin.net.au/1/'
24
+ 'https://test-api.pinpayments.com/1/'
25
25
  else
26
26
  fail "'env' option must be :live or :test. Leave blank for live payments"
27
27
  end
@@ -4,10 +4,10 @@ module Pin
4
4
  class Card < Base
5
5
  ##
6
6
  # creates a card given a hash of options
7
- # https://pin.net.au/docs/api/cards
7
+ # https://pinpayments.com/docs/api/cards
8
8
  # Only use if you have a secure server connection, if in doubt use
9
9
  # the form example provided by Pin to create a card_token
10
- # https://pin.net.au/docs/guides/payment-forms
10
+ # https://pinpayments.com/docs/guides/payment-forms
11
11
  # args: card_details (Hash)
12
12
  # returns: card object
13
13
  def self.create(options)
@@ -10,7 +10,7 @@ module Pin
10
10
  # if pagination is passed, access the response hash with [:response]
11
11
  # and the pagination hash with [:pagination]
12
12
  #
13
- # https://pin.net.au/docs/api/charges#get-charges
13
+ # https://pinpayments.com/docs/api/charges#get-charges
14
14
  def self.all(page = nil, pagination = false)
15
15
  build_collection_response(make_request(:get, { url: "charges?page=#{page}" }), pagination)
16
16
  end
@@ -19,7 +19,7 @@ module Pin
19
19
  # Find a charge for your account given a token
20
20
  # args: token (String)
21
21
  # returns: a charge object
22
- # https://pin.net.au/docs/api/charges#get-charge
22
+ # https://pinpayments.com/docs/api/charges#get-charge
23
23
  def self.find(token)
24
24
  build_response(make_request(:get, {url: "charges/#{token}" } ))
25
25
  end
@@ -31,7 +31,7 @@ module Pin
31
31
  # if pagination is passed, access the response hash with [:response]
32
32
  # and the pagination hash with [:pagination]
33
33
  #
34
- # https://pin.net.au/docs/api/charges#search-charges
34
+ # https://pinpayments.com/docs/api/charges#search-charges
35
35
  def self.search(page = nil, pagination = false, **options)
36
36
  term = ''
37
37
  options.merge! page: page if page
@@ -46,7 +46,7 @@ module Pin
46
46
  # a card_token or a customer_token
47
47
  # args: options (Hash)
48
48
  # returns: a charge object
49
- # https://pin.net.au/docs/api/charges#post-charges
49
+ # https://pinpayments.com/docs/api/charges#post-charges
50
50
  def self.create(options = {})
51
51
  build_response(make_request(:post, {url: 'charges', options: options} ))
52
52
  end
@@ -54,7 +54,7 @@ module Pin
54
54
  # Captures a previously authorised charge and returns its details.
55
55
  # args: charge-token (String)
56
56
  # returns: charge object
57
- # https://pin.net.au/docs/api/charges#put-charges
57
+ # https://pinpayments.com/docs/api/charges#put-charges
58
58
  def self.capture(token)
59
59
  build_response(make_request(:put, { url: "charges/#{token}/capture" } ))
60
60
  end
@@ -10,7 +10,7 @@ module Pin
10
10
  # if pagination is passed, access the response hash with [:response]
11
11
  # and the pagination hash with [:pagination]
12
12
  #
13
- # https://pin.net.au/docs/api/customers#get-customers
13
+ # https://pinpayments.com/docs/api/customers#get-customers
14
14
  def self.all(page = nil, pagination = false)
15
15
  build_collection_response(make_request(:get, {url: "customers?page=#{page}" } ), pagination)
16
16
  end
@@ -19,7 +19,7 @@ module Pin
19
19
  # Create a customer given customer details and a card OR a card_token
20
20
  # args: email(String), card (Hash)
21
21
  # returns: a customer object
22
- # https://pin.net.au/docs/api/customers#post-customers
22
+ # https://pinpayments.com/docs/api/customers#post-customers
23
23
  def self.create(email, card)
24
24
  options = if card.respond_to?(:to_hash)
25
25
  { card: card.to_hash }
@@ -34,7 +34,7 @@ module Pin
34
34
  # Find a customer for your account given a token
35
35
  # args: token (String)
36
36
  # returns: a customer object
37
- # https://pin.net.au/docs/api/customers#get-customers
37
+ # https://pinpayments.com/docs/api/customers#get-customers
38
38
  def self.find(token)
39
39
  build_response(make_request(:get, {url: "customers/#{token}" } ))
40
40
  end
@@ -44,7 +44,7 @@ module Pin
44
44
  # and any of: email, card (hash),card_token
45
45
  # args: token (String), options (Hash)
46
46
  # returns: a customer object
47
- # https://pin.net.au/docs/api/customers#put-customer
47
+ # https://pinpayments.com/docs/api/customers#put-customer
48
48
  # NB: When providing a card (hash), you need to specify
49
49
  # the full list of details.
50
50
  def self.update(token, options = {})
@@ -59,7 +59,7 @@ module Pin
59
59
  # if pagination is passed, access the response hash with [:response]
60
60
  # and the pagination hash with [:pagination]
61
61
  #
62
- # https://pin.net.au/docs/api/customers#get-customers-charges
62
+ # https://pinpayments.com/docs/api/customers#get-customers-charges
63
63
  def self.charges(token, page = nil, pagination = false)
64
64
  build_collection_response(
65
65
  make_request(:get, {url: "customers/#{token}/charges?page=#{page}" }), pagination
@@ -74,7 +74,7 @@ module Pin
74
74
  # if pagination is passed, access the response hash with [:response]
75
75
  # and the pagination hash with [:pagination]
76
76
  #
77
- # https://pin.net.au/docs/api/customers#get-customers-cards
77
+ # https://pinpayments.com/docs/api/customers#get-customers-cards
78
78
  def self.cards(token, page = nil, pagination = false)
79
79
  build_collection_response(
80
80
  make_request(:get, {url: "customers/#{token}/cards?page=#{page}" }), pagination
@@ -85,7 +85,7 @@ module Pin
85
85
  # Create a card for customer given a card OR a card_token
86
86
  # args: customer_token (String), card (Hash) or (String) see docs.
87
87
  # returns: a card object
88
- # https://pin.net.au/docs/api/customers#post-customers-cards
88
+ # https://pinpayments.com/docs/api/customers#post-customers-cards
89
89
  def self.create_card(token, card)
90
90
  options = if card.respond_to?(:to_hash)
91
91
  card
@@ -100,7 +100,7 @@ module Pin
100
100
  # Deletes a card for customer given a card_token
101
101
  # args: customer_token (String), card_token (String)
102
102
  # returns: a card object
103
- # https://pin.net.au/docs/api/customers#delete-customers-card
103
+ # https://pinpayments.com/docs/api/customers#delete-customers-card
104
104
  def self.delete_card(token, card_token)
105
105
  build_response(make_request(:delete, {url: "customers/#{token}/cards/#{card_token}"} ))
106
106
  end
@@ -4,7 +4,7 @@ module Pin
4
4
  class Recipient < Base
5
5
  ##
6
6
  # Creates a new recipient and returns its details.
7
- # https://pin.net.au/docs/api/recipients#post-recipients
7
+ # https://pinpayments.com/docs/api/recipients#post-recipients
8
8
  # args: options (Hash)
9
9
  # returns: recipient (Hash)
10
10
  def self.create(options)
@@ -19,7 +19,7 @@ module Pin
19
19
  # if pagination is passed, access the response hash with [:response]
20
20
  # and the pagination hash with [:pagination]
21
21
  #
22
- # https://pin.net.au/docs/api/recipients#get-recipients
22
+ # https://pinpayments.com/docs/api/recipients#get-recipients
23
23
  def self.all(page = nil, pagination = false)
24
24
  build_collection_response(make_request(:get, {url: "recipients?page=#{page}" } ), pagination)
25
25
  end
@@ -28,7 +28,7 @@ module Pin
28
28
  # Find a recipient for your account given a token
29
29
  # args: token (String)
30
30
  # returns: a recipient
31
- # https://pin.net.au/docs/api/recipients#get-recipient
31
+ # https://pinpayments.com/docs/api/recipients#get-recipient
32
32
  def self.find(token)
33
33
  build_response(make_request(:get, {url: "recipients/#{token}" } ))
34
34
  end
@@ -38,7 +38,7 @@ module Pin
38
38
  # and any of: email, name, bank_account (hash)
39
39
  # args: token (String), options (Hash)
40
40
  # returns: a recipient
41
- # https://pin.net.au/docs/api/recipients#put-recipient
41
+ # https://pinpayments.com/docs/api/recipients#put-recipient
42
42
  def self.update(token, options = {})
43
43
  build_response(make_request(:put, { url: "recipients/#{token}", options: options }))
44
44
  end
@@ -10,7 +10,7 @@ module Pin
10
10
  # if pagination is passed, access the response hash with [:response]
11
11
  # and the pagination hash with [:pagination]
12
12
  #
13
- # https://pin.net.au/docs/api/refunds#get-refunds
13
+ # https://pinpayments.com/docs/api/refunds#get-refunds
14
14
  def self.find(token, page = nil, pagination = false)
15
15
  build_collection_response(make_request(:get, { url: "charges/#{token}/refunds?page=#{page}" } ), pagination)
16
16
  end
@@ -20,7 +20,7 @@ module Pin
20
20
  # args: token (String), amount (String - optional)
21
21
  # returns: a refund object
22
22
  # if no amount is passed in, the full amount of the charge will be refunded
23
- # https://pin.net.au/docs/api/refunds#post-refunds
23
+ # https://pinpayments.com/docs/api/refunds#post-refunds
24
24
  def self.create(token, amount = nil)
25
25
  options = { amount: amount }
26
26
  build_response(make_request(:post, { url: "charges/#{token}/refunds", options: options } ))
@@ -4,7 +4,7 @@ module Pin
4
4
  class Transfer < Base
5
5
  ##
6
6
  # Creates a new transfer and returns its details.
7
- # https://pin.net.au/docs/api/transfers#post-transfers
7
+ # https://pinpayments.com/docs/api/transfers#post-transfers
8
8
  # args: options (Hash)
9
9
  def self.create(options)
10
10
  build_response(make_request(:post, { url: 'transfers', options: options }))
@@ -17,7 +17,7 @@ module Pin
17
17
  # if pagination is passed, access the response hash with [:response]
18
18
  # and the pagination hash with [:pagination]
19
19
  #
20
- # https://pin.net.au/docs/api/transfers#get-transfers
20
+ # https://pinpayments.com/docs/api/transfers#get-transfers
21
21
  def self.all(page = nil, pagination = false)
22
22
  build_collection_response(make_request(:get, {url: "transfers?page=#{page}" } ), pagination)
23
23
  end
@@ -26,7 +26,7 @@ module Pin
26
26
  # Returns the details of a transfer.
27
27
  # args: token (String)
28
28
  # returns: a transfer
29
- # https://pin.net.au/docs/api/transfers#get-transfer
29
+ # https://pinpayments.com/docs/api/transfers#get-transfer
30
30
  def self.find(token)
31
31
  build_response(make_request(:get, {url: "transfers/#{token}" } ))
32
32
  end
@@ -38,7 +38,7 @@ module Pin
38
38
  # if pagination is passed, access the response hash with [:response]
39
39
  # and the pagination hash with [:pagination]
40
40
  #
41
- # https://pin.net.au/docs/api/transfers#search-transfers
41
+ # https://pinpayments.com/docs/api/transfers#search-transfers
42
42
  def self.search(page = nil, pagination = false, **options)
43
43
  term = ''
44
44
  options.merge! page: page if page
@@ -53,7 +53,7 @@ module Pin
53
53
  # Returns the line items associated with transfer.
54
54
  # args: token (String), page (Fixnum), pagination (Boolean)
55
55
  #
56
- # https://pin.net.au/docs/api/transfers#get-transfer-line-items
56
+ # https://pinpayments.com/docs/api/transfers#get-transfer-line-items
57
57
  def self.line_items(token, page = nil, pagination = false)
58
58
  build_collection_response(make_request(:get, {url: "transfers/#{token}/line_items?page=#{page}" } ), pagination)
59
59
  end
@@ -10,14 +10,14 @@ module Pin
10
10
  # if pagination is passed, access the response hash with [:response]
11
11
  # and the pagination hash with [:pagination]
12
12
  #
13
- # https://pin.net.au/docs/api/webhook_endpoints#get-webhook_endpoints
13
+ # https://pinpayments.com/docs/api/webhook_endpoints#get-webhook_endpoints
14
14
  def self.all(page = nil, pagination = false)
15
15
  build_collection_response(make_request(:get, {url: "webhook_endpoints?page=#{page}" } ), pagination)
16
16
  end
17
17
 
18
18
  ##
19
19
  # creates a webhook endpoint given a hash of options
20
- # https://pin.net.au/docs/api/webhook_endpoints
20
+ # https://pinpayments.com/docs/api/webhook_endpoints
21
21
  # args: url (Hash)
22
22
  # returns: webhook object
23
23
  def self.create(options)
@@ -28,7 +28,7 @@ module Pin
28
28
  # Find a webhook endpoint for your account given a token
29
29
  # args: token (String)
30
30
  # returns: a webhook endpoint object
31
- # https://pin.net.au/docs/api/webhook_endpoints#get-webhook_endpoints
31
+ # https://pinpayments.com/docs/api/webhook_endpoints#get-webhook_endpoints
32
32
  def self.find(token)
33
33
  build_response(make_request(:get, {url: "webhook_endpoints/#{token}" } ))
34
34
  end
@@ -37,7 +37,7 @@ module Pin
37
37
  # Delete a webhook endpoint for your account given a token
38
38
  # args: token (String)
39
39
  # returns: nil
40
- # https://pin.net.au/docs/api/webhook_endpoints#delete-webhook_endpoints
40
+ # https://pinpayments.com/docs/api/webhook_endpoints#delete-webhook_endpoints
41
41
  def self.delete(token)
42
42
  build_response(make_request(:delete, {url: "webhook_endpoints/#{token}" } ))
43
43
  end
@@ -6,13 +6,13 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pin_up".freeze
9
- s.version = "1.4.0"
9
+ s.version = "1.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Daniel Nitsikopoulos".freeze]
14
14
  s.date = "2018-06-15"
15
- s.description = "A Ruby gem wrapper for the pin-payments (pin.net.au) API".freeze
15
+ s.description = "A Ruby gem wrapper for the pin-payments (pinpayments.com) API".freeze
16
16
  s.email = "dnitza@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
@@ -71,36 +71,19 @@ Gem::Specification.new do |s|
71
71
  s.specification_version = 4
72
72
 
73
73
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
- s.add_runtime_dependency(%q<httparty>.freeze, [">= 0.11.0"])
74
+ s.add_runtime_dependency(%q<httparty>.freeze, ["= 0.17.0"])
75
75
  s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
76
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
77
- s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.3.9"])
76
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.7.0"])
78
77
  s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.7.1"])
79
- s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
80
- s.add_development_dependency(%q<vcr>.freeze, [">= 0"])
81
- s.add_development_dependency(%q<guard-rspec>.freeze, [">= 0"])
82
- s.add_development_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.5.3"])
78
+ s.add_development_dependency(%q<webmock>.freeze, ["~> 3.6.0"])
79
+ s.add_development_dependency(%q<vcr>.freeze, ["~> 4.0.0"])
83
80
  else
84
- s.add_dependency(%q<httparty>.freeze, [">= 0.11.0"])
81
+ s.add_dependency(%q<httparty>.freeze, ["= 0.17.0"])
85
82
  s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
86
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
87
- s.add_dependency(%q<jeweler>.freeze, ["~> 2.3.9"])
88
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.7.1"])
89
- s.add_dependency(%q<webmock>.freeze, [">= 0"])
90
- s.add_dependency(%q<vcr>.freeze, [">= 0"])
91
- s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
92
- s.add_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.5.3"])
93
83
  end
94
84
  else
95
- s.add_dependency(%q<httparty>.freeze, [">= 0.11.0"])
85
+ s.add_dependency(%q<httparty>.freeze, ["= 0.17.0"])
96
86
  s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
97
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
98
- s.add_dependency(%q<jeweler>.freeze, ["~> 2.3.9"])
99
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.7.1"])
100
- s.add_dependency(%q<webmock>.freeze, [">= 0"])
101
- s.add_dependency(%q<vcr>.freeze, [">= 0"])
102
- s.add_dependency(%q<guard-rspec>.freeze, [">= 0"])
103
- s.add_dependency(%q<terminal-notifier-guard>.freeze, ["~> 1.5.3"])
104
87
  end
105
88
  end
106
89
 
@@ -12,11 +12,11 @@ RSpec.describe 'Base', :vcr, class: Pin::Base do
12
12
 
13
13
  it 'should set environment to live if no env set' do
14
14
  @pin = Pin::Base.new('KEY', :live)
15
- expect(@pin.base_uri).to eq 'https://api.pin.net.au/1/'
15
+ expect(@pin.base_uri).to eq 'https://api.pinpayments.com/1/'
16
16
  end
17
17
 
18
18
  it 'should set environment to test when set' do
19
- expect(@test_pin.base_uri).to eq 'https://test-api.pin.net.au/1/'
19
+ expect(@test_pin.base_uri).to eq 'https://test-api.pinpayments.com/1/'
20
20
  end
21
21
 
22
22
  it 'should raise an error if anything other than '' :live or :test is passed to a new instance' do
@@ -24,7 +24,7 @@ RSpec.describe 'Base', :vcr, class: Pin::Base do
24
24
  end
25
25
 
26
26
  it 'should succesfully connect to Pin' do
27
- stub_request(:get, "https://#{@test_pin.key}:''@test-api.pin.net.au/1/customers")
27
+ stub_request(:get, "https://#{@test_pin.key}:''@test-api.pinpayments.com/1/customers")
28
28
  expect(Pin::Base.make_request(:get, { url: 'customers' }).code).to eq 200
29
29
  end
30
30
 
@@ -239,13 +239,14 @@ describe 'Errors', :vcr, class: Pin::PinError do
239
239
  end
240
240
  end
241
241
 
242
- it 'should raise a 422 when updating a plan token and any field validation fails' do
243
- expect { Pin::Plan.update(plan_token, { currency: 'USD' }) }.to raise_error do |error|
244
- expect(error).to be_a Pin::InvalidResource
245
- expect(error.response['messages'][0]).to match a_hash_including("message"=>"Name can't be blank")
246
- expect(error.response).to be_a Hash
247
- end
248
- end
242
+ # Name is now optional in the API
243
+ # it 'should raise a 422 when updating a plan token and any field validation fails' do
244
+ # expect { Pin::Plan.update(plan_token, { currency: 'USD' }) }.to raise_error do |error|
245
+ # expect(error).to be_a Pin::InvalidResource
246
+ # expect(error.response['messages'][0]).to match a_hash_including("message"=>"Name can't be blank")
247
+ # expect(error.response).to be_a Hash
248
+ # end
249
+ # end
249
250
 
250
251
  it 'should raise a 400 cannot delete plan which has active subscriptions' do
251
252
  end
@@ -281,7 +282,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
281
282
  subscription_w_no_plan_token = subscription_1.tap { |h| h[:plan_token] = '' }
282
283
  expect { Pin::Subscription.create(subscription_w_no_plan_token) }.to raise_error do |error|
283
284
  expect(error).to be_a Pin::InvalidResource
284
- expect(error.response['messages'][0]).to match a_hash_including("message"=>"Plan must exist")
285
+ expect(error.response['messages'][0]).to match a_hash_including("message"=>"Plan token must be present")
285
286
  end
286
287
  end
287
288
 
@@ -21,9 +21,7 @@ describe 'Plan', :vcr, class: Pin::Plan do
21
21
  interval: 1,
22
22
  interval_unit: 'day',
23
23
  setup_amount: 27900,
24
- trial_amount: 0,
25
- trial_interval: '',
26
- trial_interval_unit: '' }
24
+ trial_amount: 0}
27
25
  }
28
26
 
29
27
  let(:plan_2_token) {
@@ -102,9 +100,9 @@ describe 'Plan', :vcr, class: Pin::Plan do
102
100
  end
103
101
 
104
102
  it 'should create a new plan and return its details' do
105
- expect(Pin::Plan.create(plan))
103
+ res = Pin::Plan.create(plan)
104
+ expect(res)
106
105
  .to match a_hash_including("name"=>match(/(Plan)/),
107
- "token"=>match(/(plan)[_]([\w-]{22})/),
108
106
  "amount"=>1000,
109
107
  "currency"=>"AUD",
110
108
  "setup_amount"=>0,
@@ -113,8 +111,9 @@ describe 'Plan', :vcr, class: Pin::Plan do
113
111
  "interval_unit"=>"day",
114
112
  "trial_interval"=>7,
115
113
  "trial_interval_unit"=>"day",
116
- "expiration_interval"=>0,
117
- "expiration_interval_unit"=>"",
114
+ "created_at"=>match(/\d/),
115
+ "customer_permissions"=>["cancel"],
116
+ "token"=>match(/(plan)[_]([\w-]{22})/),
118
117
  "active_subscriptions"=>0,
119
118
  "trial_subscriptions"=>0)
120
119
  end
@@ -21,9 +21,7 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
21
21
  interval: 30,
22
22
  interval_unit: 'day',
23
23
  setup_amount: 27900,
24
- trial_amount: 0,
25
- trial_interval: '',
26
- trial_interval_unit: '' }
24
+ trial_amount: 0 }
27
25
  }
28
26
 
29
27
  let(:plan_1_token) {
@@ -150,7 +148,7 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
150
148
  end
151
149
 
152
150
  it 'should not list subscriptions for a given page if there are no subscriptions' do
153
- request = Pin::Subscription.all(25, true)
151
+ request = Pin::Subscription.all(250, true)
154
152
  expect(request[:response]).to eq []
155
153
  end
156
154
 
@@ -1,8 +1,9 @@
1
1
  require 'spec_helper'
2
+ require 'securerandom'
2
3
 
3
4
  RSpec.describe 'WebhookEndpoints', :vcr, class: Pin::WebhookEndpoints do
4
5
  let(:token) {
5
- Pin::WebhookEndpoints.create({ url: "http://example.com/webhooks#{Time.now.to_i}/" })['token']
6
+ Pin::WebhookEndpoints.create({ url: "http://example.com/webhooks#{SecureRandom.urlsafe_base64}/" })['token']
6
7
  }
7
8
 
8
9
  before(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pin_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Nitsikopoulos
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.17.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -40,32 +40,18 @@ dependencies:
40
40
  version: '3.12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: jeweler
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 2.3.9
47
+ version: 3.7.0
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 2.3.9
54
+ version: 3.7.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: simplecov
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,59 +70,31 @@ dependencies:
84
70
  name: webmock
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ">="
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: 3.6.0
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - ">="
80
+ - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: 3.6.0
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: vcr
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: guard-rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: terminal-notifier-guard
127
85
  requirement: !ruby/object:Gem::Requirement
128
86
  requirements:
129
87
  - - "~>"
130
88
  - !ruby/object:Gem::Version
131
- version: 1.5.3
89
+ version: 4.0.0
132
90
  type: :development
133
91
  prerelease: false
134
92
  version_requirements: !ruby/object:Gem::Requirement
135
93
  requirements:
136
94
  - - "~>"
137
95
  - !ruby/object:Gem::Version
138
- version: 1.5.3
139
- description: A Ruby gem wrapper for the pin-payments (pin.net.au) API
96
+ version: 4.0.0
97
+ description: A Ruby gem wrapper for the pin-payments (pinpayments.com) API
140
98
  email: dnitza@gmail.com
141
99
  executables: []
142
100
  extensions: []
@@ -205,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
163
  - !ruby/object:Gem::Version
206
164
  version: '0'
207
165
  requirements: []
208
- rubyforge_project:
209
- rubygems_version: 2.7.3
166
+ rubygems_version: 3.0.3
210
167
  signing_key:
211
168
  specification_version: 4
212
169
  summary: A Ruby gem wrapper for the pin-payments API