chargehound 1.0.3 → 1.1.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
  SHA1:
3
- metadata.gz: 50d81db233af0b4d8dc23e9776f2f1d5d75b7fae
4
- data.tar.gz: 2d282b8dce5317d38b14508341c30ede6b4c8ac3
3
+ metadata.gz: 96fdbfcdee29473624d86e92f503c57e96ec3cbb
4
+ data.tar.gz: 2c9da9c4681ffe84ddbfdd764d809d5041461d59
5
5
  SHA512:
6
- metadata.gz: aed6aab670016f74e01407055dc611ff1298dd41a3b8c8c44e847aa3fb4d9f8e77396d475f51c1b9a70058880ca82c55529667932f7d1b669c40aa1d325f8daf
7
- data.tar.gz: 80f45b22b1eb80585f01f9b567751744b6a53f04f9cdd818756cec0d96a14b5ca6fb54b5a58f9d79ee15801645ea0ed5299cbbcb14520f5a410ec541214d5af8
6
+ metadata.gz: 4f769e8fd6fe26a5c410d4f9a7ebfaee1b32366fd356e21fa53a566ad840f4cf750963f58cb499fea5cfef0e55254a82f06ff2f8d1584469d0b6035c65319183
7
+ data.tar.gz: 2e3eccc4d0977b48b24c53219518910a32b0b765ad8156fa44daa3f32f812a3be2eb2348d12321f52e0ce9c88c49ae877051434ac095308669da7c21bff4573d
data/.gitignore CHANGED
@@ -3,3 +3,5 @@
3
3
  .bundle
4
4
  Gemfile.lock
5
5
  vendor
6
+ .idea/
7
+ *.iml
data/CHANGELOG CHANGED
@@ -1,2 +1,4 @@
1
1
  1.0.0 April, 2016
2
2
  - Initial release with disputes API
3
+ 1.1.0 June, 2016
4
+ - Added APIs to pass product lists
@@ -6,13 +6,41 @@ Chargehound.api_key = ENV['CHARGEHOUND_API_KEY']
6
6
 
7
7
  # List currently active disputes and then submit
8
8
  # the most recent with the 'crowdfunding' template
9
- # and update the `customer_ip` evidence field.
9
+ # and update the `customer_ip` evidence field, along
10
+ # with some product information.
10
11
  disputes = Chargehound::Disputes.list
11
12
  first = disputes['data'][0]
12
13
  submitted = Chargehound::Disputes.submit(first['id'],
13
- template: 'crowdfunding',
14
+ template:
15
+ 'crowdfunding',
14
16
  fields: {
15
- 'customer_ip' => '100'
16
- })
17
+ customer_ip: '0.0.0.0'
18
+ },
19
+ products: [
20
+ {
21
+ name: 'Saxophone',
22
+ description:
23
+ 'Alto saxophone, ' \
24
+ 'with carrying case',
25
+ image:
26
+ 'http://s3.amazonaws.com/' \
27
+ 'chargehound/saxophone.png',
28
+ sku: '17283001272',
29
+ quantity: 1,
30
+ amount: 20_000,
31
+ url: 'http://www.example.com'
32
+ }, {
33
+ name: 'Milk',
34
+ description:
35
+ 'Semi-skimmed Organic',
36
+ image:
37
+ 'http://s3.amazonaws.com/' \
38
+ 'chargehound/milk.png',
39
+ sku: '26377382910',
40
+ quantity: '64oz',
41
+ amount: 400,
42
+ url: 'http://www.example.com'
43
+ }
44
+ ])
17
45
 
18
46
  puts "Submitted with fields: #{submitted['fields']}"
@@ -39,6 +39,8 @@ module Chargehound
39
39
  # @option update [String] :template The id of the template to use.
40
40
  # @option update [Object] :fields Key value pairs to hydrate the
41
41
  # template's evidence fields.
42
+ # @option update [Object] :products List of products the customer
43
+ # purchased.
42
44
  # @option update [String] :customer_name Update the customer name.
43
45
  # Will also update the customer name in the evidence fields.
44
46
  # @option update [String] :customer_email Update the customer email.
@@ -56,6 +58,8 @@ module Chargehound
56
58
  # @option update [String] :template The id of the template to use.
57
59
  # @option update [Object] :fields Key value pairs to hydrate the template's
58
60
  # evidence fields.
61
+ # @option update [Object] :products List of products the customer
62
+ # purchased.
59
63
  # @option update [String] :customer_name Update the customer name.
60
64
  # Will also update the customer name in the evidence fields.
61
65
  # @option update [String] :customer_email Update the customer email.
@@ -1,3 +1,3 @@
1
1
  module Chargehound
2
- VERSION = '1.0.3'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -15,10 +15,35 @@ post_headers = {
15
15
 
16
16
  dispute_update = {
17
17
  fields: {
18
- 'customer_name' => 'Susie'
18
+ customer_name: 'Susie'
19
19
  }
20
20
  }
21
21
 
22
+ dispute_with_product_info_update = {
23
+ fields: {
24
+ customer_name: 'Susie'
25
+ },
26
+ products: [
27
+ {
28
+ name: 'Saxophone',
29
+ description: 'Alto saxophone, with carrying case',
30
+ image: 'http://s3.amazonaws.com/chargehound/saxophone.png',
31
+ sku: '17283001272',
32
+ quantity: 1,
33
+ amount: 20_000,
34
+ url: 'http://www.example.com'
35
+ }, {
36
+ name: 'Milk',
37
+ description: 'Semi-skimmed Organic',
38
+ image: 'http://s3.amazonaws.com/chargehound/milk.png',
39
+ sku: '26377382910',
40
+ quantity: '64oz',
41
+ amount: 400,
42
+ url: 'http://www.example.com'
43
+ }
44
+ ]
45
+ }
46
+
22
47
  dispute_response = {
23
48
  'id' => 'dp_123'
24
49
  }.to_json
@@ -61,6 +86,17 @@ describe Chargehound::Disputes do
61
86
  assert_requested stub
62
87
  end
63
88
 
89
+ it 'can submit a dispute with product data' do
90
+ stub = stub_request(:post, 'https://api.chargehound.com/v1/disputes/dp_123/submit')
91
+ .with(headers: post_headers,
92
+ body: dispute_with_product_info_update.to_json)
93
+ .to_return(body: dispute_response,
94
+ status: 201)
95
+
96
+ Chargehound::Disputes.submit('dp_123', dispute_with_product_info_update)
97
+ assert_requested stub
98
+ end
99
+
64
100
  it 'can update a dispute' do
65
101
  stub = stub_request(:put, 'https://api.chargehound.com/v1/disputes/dp_123')
66
102
  .with(headers: post_headers, body: dispute_update.to_json)
@@ -69,4 +105,14 @@ describe Chargehound::Disputes do
69
105
  Chargehound::Disputes.update('dp_123', dispute_update)
70
106
  assert_requested stub
71
107
  end
108
+
109
+ it 'can update a dispute with product data' do
110
+ stub = stub_request(:put, 'https://api.chargehound.com/v1/disputes/dp_123')
111
+ .with(headers: post_headers,
112
+ body: dispute_with_product_info_update.to_json)
113
+ .to_return(body: dispute_response)
114
+
115
+ Chargehound::Disputes.update('dp_123', dispute_with_product_info_update)
116
+ assert_requested stub
117
+ end
72
118
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chargehound
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chargehound
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - <
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.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: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.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: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.8'
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: '5.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '11.1'
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: '11.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.39'
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
82
  version: '0.39'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '2.0'
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: '2.0'
97
97
  description: Automatically fight disputes in Stripe
@@ -102,9 +102,9 @@ extensions: []
102
102
  extra_rdoc_files:
103
103
  - README.md
104
104
  files:
105
- - .gitignore
106
- - .rubocop.yml
107
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - ".travis.yml"
108
108
  - CHANGELOG
109
109
  - Gemfile
110
110
  - LICENSE
@@ -131,17 +131,17 @@ require_paths:
131
131
  - lib
132
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - '>='
134
+ - - ">="
135
135
  - !ruby/object:Gem::Version
136
136
  version: 1.9.3
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - '>='
139
+ - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.0.14
144
+ rubygems_version: 2.4.3
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Ruby bindings for the Chargehound API