pin_up 1.3.0 → 1.3.2

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
  SHA1:
3
- metadata.gz: f700bc2aa83973dd14ec89c9bff2bdb7b2fdfd78
4
- data.tar.gz: bcc17c7fc2dc62c11cb92b3292d047bee18bc98d
3
+ metadata.gz: 106a5ddaa757a8b6dc7e7fb054a7601c9e08bf8f
4
+ data.tar.gz: 74d4d89a04b0aa6e0e5b996b308caee452f7c26b
5
5
  SHA512:
6
- metadata.gz: 8b89a1203f95056d99e4734061a1bc6f2995b170e3ca24975d46087764692f6a61fe8b699a59a750db01bf328da315e21999ef099b9b31dc1d0f490eb4259ef8
7
- data.tar.gz: 31b5c8ca1e3ab72d604020d9b1b1e55ec1b820f600ab7004f168eac96479dbc83cf5294004083dbc609f704be10c3e9b119371f488487b6bfd477fef6f81aa0e
6
+ metadata.gz: dcbf8164132d3e44db466ed5dbaf24b796a3787e087f51a7fca85555f0adf239305c1de996bd4b1190d1f93d945a503fb1362d6a6457020abf60a9b5816da743
7
+ data.tar.gz: ca431e025611aa6e31cc69b73f147953f2a2bd898c8b989760ea11ffa41761e96979063998cfa8992e179733f3ae78dfe280821f9123bab497ac236f3ac03ef6
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :development do
6
6
  gem "shoulda", "~> 3.5"
7
7
  gem "rdoc", "~> 3.12"
8
8
  gem "rspec" #, "~> 2.13"
9
- gem "jeweler", "~> 1.8.4"
9
+ gem "jeweler", "~> 2.1.1"
10
10
  gem "simplecov", "~> 0.7.1"
11
11
  gem "webmock", "~> 1.12.3"
12
12
  gem "vcr", "~> 2.5.0"
data/Gemfile.lock CHANGED
@@ -16,18 +16,21 @@ GEM
16
16
  coderay (1.1.0)
17
17
  crack (0.4.2)
18
18
  safe_yaml (~> 1.0.0)
19
+ descendants_tracker (0.0.4)
20
+ thread_safe (~> 0.3, >= 0.3.1)
19
21
  diff-lcs (1.2.5)
20
- faraday (0.8.9)
21
- multipart-post (~> 1.2.0)
22
+ faraday (0.9.2)
23
+ multipart-post (>= 1.2, < 3)
22
24
  ffi (1.9.8)
23
25
  formatador (0.2.5)
24
- git (1.2.9.1)
25
- github_api (0.10.1)
26
- addressable
27
- faraday (~> 0.8.1)
28
- hashie (>= 1.2)
29
- multi_json (~> 1.4)
30
- nokogiri (~> 1.5.2)
26
+ git (1.3.0)
27
+ github_api (0.13.0)
28
+ addressable (~> 2.3)
29
+ descendants_tracker (~> 0.0.4)
30
+ faraday (~> 0.8, < 0.10)
31
+ hashie (>= 3.4)
32
+ multi_json (>= 1.7.5, < 2.0)
33
+ nokogiri (~> 1.6.6)
31
34
  oauth2
32
35
  guard (2.12.5)
33
36
  formatador (>= 0.2.4)
@@ -43,51 +46,56 @@ GEM
43
46
  guard (~> 2.1)
44
47
  guard-compat (~> 1.1)
45
48
  rspec (>= 2.99.0, < 4.0)
46
- hashie (3.4.2)
47
- highline (1.7.2)
49
+ hashie (3.4.4)
50
+ highline (1.7.8)
48
51
  hitimes (1.2.2)
49
52
  httparty (0.13.5)
50
53
  json (~> 1.8)
51
54
  multi_xml (>= 0.5.2)
52
55
  i18n (0.7.0)
53
- jeweler (1.8.8)
56
+ jeweler (2.1.1)
54
57
  builder
55
- bundler (~> 1.0)
58
+ bundler (>= 1.0)
56
59
  git (>= 1.2.5)
57
- github_api (= 0.10.1)
60
+ github_api
58
61
  highline (>= 1.6.15)
59
- nokogiri (= 1.5.10)
62
+ nokogiri (>= 1.5.10)
60
63
  rake
61
64
  rdoc
65
+ semver
62
66
  json (1.8.3)
63
- jwt (1.5.0)
67
+ jwt (1.5.4)
64
68
  listen (2.10.0)
65
69
  celluloid (~> 0.16.0)
66
70
  rb-fsevent (>= 0.9.3)
67
71
  rb-inotify (>= 0.9)
68
72
  lumberjack (1.0.9)
69
73
  method_source (0.8.2)
74
+ mini_portile2 (2.1.0)
70
75
  minitest (5.7.0)
71
76
  multi_json (1.11.0)
72
77
  multi_xml (0.5.5)
73
- multipart-post (1.2.0)
78
+ multipart-post (2.0.0)
74
79
  nenv (0.2.0)
75
- nokogiri (1.5.10)
80
+ nokogiri (1.6.8)
81
+ mini_portile2 (~> 2.1.0)
82
+ pkg-config (~> 1.1.7)
76
83
  notiffany (0.0.6)
77
84
  nenv (~> 0.1)
78
85
  shellany (~> 0.0)
79
- oauth2 (1.0.0)
86
+ oauth2 (1.2.0)
80
87
  faraday (>= 0.8, < 0.10)
81
88
  jwt (~> 1.0)
82
89
  multi_json (~> 1.3)
83
90
  multi_xml (~> 0.5)
84
- rack (~> 1.2)
91
+ rack (>= 1.2, < 3)
92
+ pkg-config (1.1.7)
85
93
  pry (0.10.1)
86
94
  coderay (~> 1.1.0)
87
95
  method_source (~> 0.8.1)
88
96
  slop (~> 3.4)
89
- rack (1.6.1)
90
- rake (10.4.2)
97
+ rack (2.0.1)
98
+ rake (11.2.2)
91
99
  rb-fsevent (0.9.5)
92
100
  rb-inotify (0.9.5)
93
101
  ffi (>= 0.5.0)
@@ -107,6 +115,7 @@ GEM
107
115
  rspec-support (~> 3.2.0)
108
116
  rspec-support (3.2.2)
109
117
  safe_yaml (1.0.4)
118
+ semver (1.0.1)
110
119
  shellany (0.0.1)
111
120
  shoulda (3.5.0)
112
121
  shoulda-context (~> 1.0, >= 1.0.1)
@@ -138,7 +147,7 @@ DEPENDENCIES
138
147
  codeclimate-test-reporter
139
148
  guard-rspec
140
149
  httparty (>= 0.11.0)
141
- jeweler (~> 1.8.4)
150
+ jeweler (~> 2.1.1)
142
151
  rdoc (~> 3.12)
143
152
  rspec
144
153
  shoulda (~> 3.5)
@@ -148,4 +157,4 @@ DEPENDENCIES
148
157
  webmock (~> 1.12.3)
149
158
 
150
159
  BUNDLED WITH
151
- 1.10.3
160
+ 1.12.5
data/README.md CHANGED
@@ -21,9 +21,11 @@ to your Gemfile.
21
21
 
22
22
  If using rails add an initializer to your app:
23
23
 
24
- Pin::Base.new("your key")
24
+ Pin::Base.new("your key", :env, timeout)
25
25
 
26
- An option second parameter can be passed in to set the environment (:live or :test). The default is :live.
26
+ An optional second parameter can be passed in to set the environment (:live or :test). The default is :live.
27
+
28
+ An optional third parameter can be passed in to set the timeout of HTTParty in seconds. The default is `1800` (30 minutes).
27
29
 
28
30
  ### Charges
29
31
  ##### List All Charges
@@ -42,8 +44,19 @@ With Pagination:
42
44
 
43
45
  ##### Find A Charge
44
46
  Pin::Charges.find("token")
45
- ##### Search For A Charge
46
- Pin::Charges.search({query: "foo", end_date: "Mar 25, 2013"})
47
+ ##### Search For Charges
48
+ Pin::Charges.search(query: "foo", end_date: "Mar 25, 2013")
49
+
50
+ Show found charges on a particular page:
51
+
52
+ Pin::Charges.search(3, query: "foo", end_date: "Mar 25, 2013")
53
+
54
+ With Pagination:
55
+
56
+ Pin::Charges.search(3, true, query: "foo", end_date: "Mar 25, 2013")
57
+ # request = Pin::Charges.search(3, true, query: "foo", end_date: "Mar 25, 2013")
58
+ # request[:response] => response hash
59
+ # request[:pagination] => "pagination":{"current":3,"previous":2,"next":4,"per_page":25,"pages":10,"count":239}
47
60
 
48
61
  See https://pin.net.au/docs/api/charges#search-charges for a full list of options.
49
62
 
@@ -210,6 +223,22 @@ The transfers API allows you to send money to Australian bank accounts, and to r
210
223
  ##### Get the details of a transfer.
211
224
  `Pin::Transfer.find(transfer_token)`
212
225
 
226
+ ##### Search for transfers
227
+ Pin::Transfer.search(query: "foo", end_date: "Mar 25, 2013")
228
+
229
+ Show found transfers on a particular page:
230
+
231
+ Pin::Transfer.search(3, query: "foo", end_date: "Mar 25, 2013")
232
+
233
+ With Pagination:
234
+
235
+ Pin::Transfer.search(3, true, query: "foo", end_date: "Mar 25, 2013")
236
+ # request = Pin::Transfer.search(3, true, query: "foo", end_date: "Mar 25, 2013")
237
+ # request[:response] => response hash
238
+ # request[:pagination] => "pagination":{"current":3,"previous":2,"next":4,"per_page":25,"pages":10,"count":239}
239
+
240
+ See https://pin.net.au/docs/api/transfers#search-transfers for a full list of options.
241
+
213
242
  ##### Get the line items associated with transfer.
214
243
  `Pin::Transfer.line_items(transfer_token)`
215
244
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.2
data/lib/pin_up/charge.rb CHANGED
@@ -27,13 +27,19 @@ module Pin
27
27
  # Find a charge(s) for your account given a search term or set of terms
28
28
  # args: options (Hash)
29
29
  # returns: a collection of charge objects
30
+ #
31
+ # if pagination is passed, access the response hash with [:response]
32
+ # and the pagination hash with [:pagination]
33
+ #
30
34
  # https://pin.net.au/docs/api/charges#search-charges
31
- def self.search(options = {})
35
+ def self.search(page = nil, pagination = false, **options)
32
36
  term = ''
37
+ options.merge! page: page if page
38
+
33
39
  options.each do |key, option|
34
- term += "#{key.to_s}=#{URI.encode(option)}&"
40
+ term += "#{key.to_s}=#{URI.encode(option.to_s)}&"
35
41
  end
36
- build_response(make_request(:get, {url: "charges/search?#{term}" } ))
42
+ build_collection_response(make_request(:get, {url: "charges/search?#{term}" } ), pagination)
37
43
  end
38
44
 
39
45
  # Create a charge given charge details and a card,
@@ -31,6 +31,24 @@ module Pin
31
31
  build_response(make_request(:get, {url: "transfers/#{token}" } ))
32
32
  end
33
33
 
34
+ # Find a transfer(s) for your account given a search term or set of terms
35
+ # args: options (Hash)
36
+ # returns: a collection of transfer objects
37
+ #
38
+ # if pagination is passed, access the response hash with [:response]
39
+ # and the pagination hash with [:pagination]
40
+ #
41
+ # https://pin.net.au/docs/api/transfers#search-transfers
42
+ def self.search(page = nil, pagination = false, **options)
43
+ term = ''
44
+ options.merge! page: page if page
45
+
46
+ options.each do |key, option|
47
+ term += "#{key.to_s}=#{URI.encode(option.to_s)}&"
48
+ end
49
+ build_collection_response(make_request(:get, {url: "transfers/search?#{term}" } ), pagination)
50
+ end
51
+
34
52
  ##
35
53
  # Returns the line items associated with transfer.
36
54
  # args: token (String), page (Fixnum), pagination (Boolean)
data/pin_up.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pin_up 1.3.0 ruby lib
5
+ # stub: pin_up 1.3.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pin_up"
9
- s.version = "1.3.0"
9
+ s.version = "1.3.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Daniel Nitsikopoulos"]
14
- s.date = "2016-03-31"
14
+ s.date = "2016-08-04"
15
15
  s.description = "A Ruby gem wrapper for the pin-payments (pin.net.au) API"
16
16
  s.email = "dnitza@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
57
57
  ]
58
58
  s.homepage = "http://github.com/dNitza/pin_up"
59
59
  s.licenses = ["MIT"]
60
- s.rubygems_version = "2.4.8"
60
+ s.rubygems_version = "2.5.1"
61
61
  s.summary = "A Ruby gem wrapper for the pin-payments API"
62
62
 
63
63
  if s.respond_to? :specification_version then
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  s.add_development_dependency(%q<shoulda>, ["~> 3.5"])
69
69
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
70
70
  s.add_development_dependency(%q<rspec>, [">= 0"])
71
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
71
+ s.add_development_dependency(%q<jeweler>, ["~> 2.1.1"])
72
72
  s.add_development_dependency(%q<simplecov>, ["~> 0.7.1"])
73
73
  s.add_development_dependency(%q<webmock>, ["~> 1.12.3"])
74
74
  s.add_development_dependency(%q<vcr>, ["~> 2.5.0"])
@@ -79,7 +79,7 @@ Gem::Specification.new do |s|
79
79
  s.add_dependency(%q<shoulda>, ["~> 3.5"])
80
80
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
81
81
  s.add_dependency(%q<rspec>, [">= 0"])
82
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
82
+ s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
83
83
  s.add_dependency(%q<simplecov>, ["~> 0.7.1"])
84
84
  s.add_dependency(%q<webmock>, ["~> 1.12.3"])
85
85
  s.add_dependency(%q<vcr>, ["~> 2.5.0"])
@@ -91,7 +91,7 @@ Gem::Specification.new do |s|
91
91
  s.add_dependency(%q<shoulda>, ["~> 3.5"])
92
92
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
93
93
  s.add_dependency(%q<rspec>, [">= 0"])
94
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
94
+ s.add_dependency(%q<jeweler>, ["~> 2.1.1"])
95
95
  s.add_dependency(%q<simplecov>, ["~> 0.7.1"])
96
96
  s.add_dependency(%q<webmock>, ["~> 1.12.3"])
97
97
  s.add_dependency(%q<vcr>, ["~> 2.5.0"])
data/spec/base_spec.rb CHANGED
@@ -30,6 +30,6 @@ RSpec.describe 'Base', :vcr, class: Pin::Base do
30
30
 
31
31
  it "raises a timeout error if we don't get a response in time" do
32
32
  @test_pin = Pin::Base.new(ENV['PIN_SECRET'], :test, 0)
33
- expect { Pin::Base.make_request(:get, { url: 'customers' }) }.to raise_error(Net::ReadTimeout)
33
+ expect { Pin::Base.make_request(:get, { url: 'customers' }) }.to raise_error.with_message(/Timeout/)
34
34
  end
35
35
  end
data/spec/charges_spec.rb CHANGED
@@ -14,7 +14,8 @@ describe 'Charge', :vcr, class: Pin::Charges do
14
14
  end
15
15
 
16
16
  it 'should create a charge given details' do
17
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_6XnfOD5bvQ1qkaf3LqmhfQ' }
17
+ customer = Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: Time.now.year+1, cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')
18
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: customer['token'] }
18
19
  expect(Pin::Charges.create(options)['success']).to eq true
19
20
  end
20
21
 
@@ -23,7 +24,7 @@ describe 'Charge', :vcr, class: Pin::Charges do
23
24
  end
24
25
 
25
26
  it 'should show a charge given a search term' do
26
- expect(Pin::Charges.search(query: 'A new charge from testing Pin gem', end_date: 'Mar 25, 2016')).to_not eq []
27
+ expect(Pin::Charges.search(query: 'A new charge from testing Pin gem', end_date: 'Aug 31, 2016')).to_not eq []
27
28
  end
28
29
 
29
30
  it 'should return pagination if "pagination" is true' do
@@ -34,13 +35,23 @@ describe 'Charge', :vcr, class: Pin::Charges do
34
35
  expect(Pin::Charges.all(1)).to_not eq []
35
36
  end
36
37
 
38
+ it 'should return pagination for search if "pagination" is true' do
39
+ expect(Pin::Charges.search(3, true, query: 'A new charge from testing Pin gem', end_date: 'Aug 31, 2016')[:pagination]['current']).to eq 3
40
+ end
41
+
42
+ it 'should list charges for search on a page given a page' do
43
+ expect(Pin::Charges.search(1, query: 'A new charge from testing Pin gem', end_date: 'Aug 31, 2016')).to_not eq []
44
+ end
45
+
37
46
  it 'should create a pre-auth (capture a charge)' do
38
- options = { email: 'dNitza@gmail.com', description: 'A new captured charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_6XnfOD5bvQ1qkaf3LqmhfQ', capture: false }
47
+ customer = Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: Time.now.year+1, cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')
48
+ options = { email: 'email@example.com', description: 'A new captured charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: customer['token'], capture: false }
39
49
  expect(Pin::Charges.create(options)['captured']).to eq false
40
50
  end
41
51
 
42
52
  it 'should capture a charge' do
43
- options = { email: 'dNitza@gmail.com', description: 'A new captured charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_6XnfOD5bvQ1qkaf3LqmhfQ', capture: false }
53
+ customer = Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: Time.now.year+1, cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')
54
+ options = { email: 'email@example.com', description: 'A new captured charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: customer['token'], capture: false }
44
55
  token = Pin::Charges.create(options)['token']
45
56
  expect(Pin::Charges.capture(token)['success']).to eq true
46
57
  end
@@ -46,11 +46,11 @@ describe 'Customer', :vcr, class: Pin::Customer do
46
46
  end
47
47
 
48
48
  it 'should create a customer given an email and card details' do
49
- expect(Pin::Customer.create('dNitza@gmail.com', number: '5520000000000000', expiry_month: '12', expiry_year: '2016', cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')['token']).to match(/^[a-z]{3}[_]/)
49
+ expect(Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: '2016', cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')['token']).to match(/^[a-z]{3}[_]/)
50
50
  end
51
51
 
52
52
  it 'should update a customer given a token and details to update' do
53
- options = { email: 'dNitza@gmail.com', card: { number: '5520000000000000', address_line1: '12345 Fake Street', expiry_month: '05', expiry_year: '2016', cvc: '123', name: 'Daniel Nitsikopoulos', address_city: 'Melbourne', address_postcode: '1234', address_state: 'VIC', address_country: 'Australia' } }
53
+ options = { email: 'email@example.com', card: { number: '5520000000000000', address_line1: '12345 Fake Street', expiry_month: '05', expiry_year: Time.now.year+1, cvc: '123', name: 'Daniel Nitsikopoulos', address_city: 'Melbourne', address_postcode: '1234', address_state: 'VIC', address_country: 'Australia' } }
54
54
  expect(Pin::Customer.update('cus_6XnfOD5bvQ1qkaf3LqmhfQ', options)['card']['address_line1']).to eq '12345 Fake Street'
55
55
  end
56
56
 
data/spec/errors_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
14
14
  end
15
15
 
16
16
  it 'should raise a 422 error when trying to update missing a param' do
17
- options = { email: 'dNitza@gmail.com', card: { address_line1: '12345 Fake Street', expiry_month: '05', expiry_year: '2016', cvc: '123', address_city: 'Melbourne', address_postcode: '1234', address_state: 'VIC', address_country: 'Australia' } }
17
+ options = { email: 'email@example.com', card: { address_line1: '12345 Fake Street', expiry_month: '05', expiry_year: Time.now.year+1, cvc: '123', address_city: 'Melbourne', address_postcode: '1234', address_state: 'VIC', address_country: 'Australia' } }
18
18
  expect { Pin::Customer.update('cus_6XnfOD5bvQ1qkaf3LqmhfQ', options) }.to raise_error do |error|
19
19
  expect(error).to be_a Pin::InvalidResource
20
20
  expect(error.message).to eq "card_number_invalid: Card number can't be blank card_name_invalid: Card name can't be blank "
@@ -23,7 +23,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
23
23
  end
24
24
 
25
25
  it 'should raise a 422 error when trying to make a payment with an expired card' do
26
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
26
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
27
27
  number: '5520000000000000',
28
28
  expiry_month: '05',
29
29
  expiry_year: '2012',
@@ -43,7 +43,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
43
43
  end
44
44
 
45
45
  it 'should raise a 400 error when trying to make a payment and a valid card gets declined' do
46
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
46
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
47
47
  number: '5560000000000001',
48
48
  expiry_month: '05',
49
49
  expiry_year: '2018',
@@ -59,7 +59,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
59
59
  end
60
60
 
61
61
  it 'should raise a 422 error when trying to make a payment with an invalid card' do
62
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
62
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', card: {
63
63
  number: '5520000000000099',
64
64
  expiry_month: '05',
65
65
  expiry_year: '2019',
@@ -87,7 +87,8 @@ describe 'Errors', :vcr, class: Pin::PinError do
87
87
  end
88
88
 
89
89
  it 'should raise a 422 error if no 2nd argument is given' do
90
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_6XnfOD5bvQ1qkaf3LqmhfQ' }
90
+ customer = Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: Time.now.year+1, cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')
91
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: customer['token'] }
91
92
  @charge = Pin::Charges.create(options)
92
93
  expect { Pin::Refund.create(@charge['token']) }.to raise_error do |error|
93
94
  expect(error).to be_a Pin::InvalidResource
data/spec/refund_spec.rb CHANGED
@@ -18,7 +18,8 @@ describe 'Refund', :vcr, class: Pin::Refund do
18
18
  end
19
19
 
20
20
  it 'should create a refund for a given amount and charge' do
21
- options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_6XnfOD5bvQ1qkaf3LqmhfQ'}
21
+ customer = Pin::Customer.create('email@example.com', number: '5520000000000000', expiry_month: '12', expiry_year: Time.now.year+1, cvc: '123', name: 'Roland Robot', address_line1: '123 fake street', address_city: 'Melbourne', address_postcode: '1234', address_state: 'Vic', address_country: 'Australia')
22
+ options = { email: 'email@example.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: customer['token']}
22
23
  @charge = Pin::Charges.create(options)
23
24
  expect(Pin::Refund.create(@charge['token'], '400')['amount']).to eq 400
24
25
  end
@@ -34,4 +34,20 @@ describe Pin::Transfer, :vcr do
34
34
  transfer_token = Pin::Transfer.create(options)['token']
35
35
  expect(Pin::Transfer.find(transfer_token)['token']).to eq transfer_token
36
36
  end
37
+
38
+ it 'should not show a charge if end_date is out of range' do
39
+ expect(Pin::Transfer.search(end_date: 'Mar 25, 2011')).to eq []
40
+ end
41
+
42
+ it 'returns a paginated list of searched transfers' do
43
+ expect(Pin::Transfer.search(query: 'Pay day')).to_not eq []
44
+ end
45
+
46
+ it 'should return pagination for search if "pagination" is true' do
47
+ expect(Pin::Transfer.search(3, true, query: 'Pay day')[:pagination]['current']).to eq 3
48
+ end
49
+
50
+ it 'should list transfers for search on a page given a page' do
51
+ expect(Pin::Transfer.search(1, query: 'Pay day')).to_not eq []
52
+ end
37
53
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pin_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Nitsikopoulos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.11.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
26
  version: 0.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shoulda
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.5'
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
40
  version: '3.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.12'
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
54
  version: '3.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.8.4
75
+ version: 2.1.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.8.4
82
+ version: 2.1.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.7.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.7.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.12.3
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.12.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: vcr
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 2.5.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 2.5.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: guard-rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: terminal-notifier-guard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 1.5.3
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.5.3
153
153
  description: A Ruby gem wrapper for the pin-payments (pin.net.au) API
@@ -158,8 +158,8 @@ extra_rdoc_files:
158
158
  - LICENSE.txt
159
159
  - README.md
160
160
  files:
161
- - .document
162
- - .travis.yml
161
+ - ".document"
162
+ - ".travis.yml"
163
163
  - Gemfile
164
164
  - Gemfile.lock
165
165
  - Guardfile
@@ -203,17 +203,17 @@ require_paths:
203
203
  - lib
204
204
  required_ruby_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - '>='
206
+ - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  requirements:
211
- - - '>='
211
+ - - ">="
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  requirements: []
215
215
  rubyforge_project:
216
- rubygems_version: 2.4.8
216
+ rubygems_version: 2.5.1
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: A Ruby gem wrapper for the pin-payments API