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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0110d918dc588bb377b7d8cfb5071e438cb74103
4
- data.tar.gz: 8afcecf45db7a9e8fc7da38d9fdffc7fa8566b8a
2
+ SHA256:
3
+ metadata.gz: 29df1634bab76aa230253a16210e031c74165065a62f6eb6f0216fadbe9ca7b4
4
+ data.tar.gz: 330d1b458f73e0630200f0dfa65ff567c71f00293c684699d3d2d6990996592b
5
5
  SHA512:
6
- metadata.gz: 66bbfc2431d1aee375fffda01c43d1dba5b4c3c0440f3b5c24d8ba587bb5ad1521287f6afee507a1f39db8f3baddc615d71c229b6ededf8f0592df42cb6ff300
7
- data.tar.gz: 2c3862d8c1eac3d9d5a1c53142210530b11302c70d79f510b51524e746f7368c7f8c606a492e7649f2216af3c51a579f3b10c3a5187b4181a823f7e86cf9bdc6
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
@@ -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
- since_param = "?since_token=#{since_token}" if since_token
67
- return "#{base_url}/v1/transactions.xml#{since_param}" unless payment_method_token
68
-
69
- "#{base_url}/v1/payment_methods/#{payment_method_token}/transactions.xml#{since_param}"
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)
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "2.0.19"
2
+ VERSION = "2.0.20"
3
3
  end
@@ -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.19
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-07 00:00:00.000000000 Z
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
- rubyforge_project:
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.