spreedly 2.0.19 → 2.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/lib/spreedly/environment.rb +2 -2
- data/lib/spreedly/urls.rb +14 -5
- data/lib/spreedly/version.rb +1 -1
- data/test/unit/list_transactions_test.rb +12 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 29df1634bab76aa230253a16210e031c74165065a62f6eb6f0216fadbe9ca7b4
|
4
|
+
data.tar.gz: 330d1b458f73e0630200f0dfa65ff567c71f00293c684699d3d2d6990996592b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a947c842a29eb9eb412c9b7a16bd98a2cd9ad5bf729f232609ae3cb11dbd1ce6a6789a8cf1611888cff03d0456a96ee31819b9beb43707ca1d5c2491d266e23
|
7
|
+
data.tar.gz: 4edc28023972f0b01b93502fa58a05fe4c3f62123e3c1f54382dee3c339a44da992ef88af170c62ea62f70c5400e5291900da507b1c633ea501d17b1d68fd094
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [2.0.20] - 2019-06-27
|
8
|
+
### Changed
|
9
|
+
- @patrickarnett - Modify `list_transactions` and `list_transactions_url` to take `count`, `order`, and `state` arguments in an optional hash.
|
10
|
+
|
7
11
|
## [2.0.19] - 2019-06-07
|
8
12
|
### Added
|
9
13
|
- Lori Holden - Receiver redaction
|
data/lib/spreedly/environment.rb
CHANGED
@@ -92,8 +92,8 @@ module Spreedly
|
|
92
92
|
Transaction.new_from(xml_doc)
|
93
93
|
end
|
94
94
|
|
95
|
-
def list_transactions(since_token = nil, payment_method_token = nil)
|
96
|
-
xml_doc = ssl_get(list_transactions_url(since_token, payment_method_token), headers)
|
95
|
+
def list_transactions(since_token = nil, payment_method_token = nil, options = {})
|
96
|
+
xml_doc = ssl_get(list_transactions_url(since_token, payment_method_token, options), headers)
|
97
97
|
Transaction.new_list_from(xml_doc)
|
98
98
|
end
|
99
99
|
|
data/lib/spreedly/urls.rb
CHANGED
@@ -62,11 +62,20 @@ module Spreedly
|
|
62
62
|
"#{base_url}/v1/gateways/#{gateway_token}/store.xml"
|
63
63
|
end
|
64
64
|
|
65
|
-
def list_transactions_url(since_token, payment_method_token)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
def list_transactions_url(since_token, payment_method_token, options = {})
|
66
|
+
options.each do |key, val|
|
67
|
+
options[key.to_sym] = val
|
68
|
+
end
|
69
|
+
|
70
|
+
params = []
|
71
|
+
params << "since_token=#{since_token}" if since_token
|
72
|
+
params << "count=#{options[:count]}" if options[:count]
|
73
|
+
params << "order=#{options[:order]}" if options[:order]
|
74
|
+
params << "state=#{options[:state]}" if options[:state]
|
75
|
+
param_string = "?#{params.join('&')}" if params.any?
|
76
|
+
return "#{base_url}/v1/transactions.xml#{param_string}" unless payment_method_token
|
77
|
+
|
78
|
+
"#{base_url}/v1/payment_methods/#{payment_method_token}/transactions.xml#{param_string}"
|
70
79
|
end
|
71
80
|
|
72
81
|
def list_payment_methods_url(since_token)
|
data/lib/spreedly/version.rb
CHANGED
@@ -40,6 +40,18 @@ class ListTransactionsTest < Test::Unit::TestCase
|
|
40
40
|
assert_request_url 'https://core.spreedly.com/v1/payment_methods/SomePaymentMethodToken/transactions.xml?since_token=SinceToken' do
|
41
41
|
@environment.list_transactions('SinceToken', 'SomePaymentMethodToken')
|
42
42
|
end
|
43
|
+
|
44
|
+
assert_request_url 'https://core.spreedly.com/v1/transactions.xml?order=asc' do
|
45
|
+
@environment.list_transactions(nil, nil, order: :asc)
|
46
|
+
end
|
47
|
+
|
48
|
+
assert_request_url 'https://core.spreedly.com/v1/transactions.xml?since_token=SinceToken&count=10&state=succeeded' do
|
49
|
+
@environment.list_transactions('SinceToken', nil, state: :succeeded, count: 10)
|
50
|
+
end
|
51
|
+
|
52
|
+
assert_request_url 'https://core.spreedly.com/v1/payment_methods/SomePaymentMethodToken/transactions.xml?since_token=SinceToken&count=10&order=asc&state=succeeded' do
|
53
|
+
@environment.list_transactions('SinceToken', 'SomePaymentMethodToken', order: :asc, state: :succeeded, count: 10)
|
54
|
+
end
|
43
55
|
end
|
44
56
|
|
45
57
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreedly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spreedly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -269,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
269
|
- !ruby/object:Gem::Version
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
|
-
|
273
|
-
rubygems_version: 2.5.2
|
272
|
+
rubygems_version: 3.0.1
|
274
273
|
signing_key:
|
275
274
|
specification_version: 4
|
276
275
|
summary: Provides a Ruby wrapper for the Spreedly API.
|