zuora_rest_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +53 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +18 -0
  7. data/README.md +56 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/fixtures/vcr_cassettes/zuora/create_account_object_success.yml +59 -0
  12. data/fixtures/vcr_cassettes/zuora/create_account_success.yml +66 -0
  13. data/fixtures/vcr_cassettes/zuora/delete_account_object_success.yml +223 -0
  14. data/fixtures/vcr_cassettes/zuora/describe_account.yml +577 -0
  15. data/fixtures/vcr_cassettes/zuora/describe_account_related_objects.yml +577 -0
  16. data/fixtures/vcr_cassettes/zuora/describe_all_account_fields.yml +577 -0
  17. data/fixtures/vcr_cassettes/zuora/describe_all_zobjects.yml +176 -0
  18. data/fixtures/vcr_cassettes/zuora/describe_exportable_account_fields.yml +577 -0
  19. data/fixtures/vcr_cassettes/zuora/describe_non_exportable_account_fields.yml +577 -0
  20. data/fixtures/vcr_cassettes/zuora/describe_non_updateable_account_fields.yml +577 -0
  21. data/fixtures/vcr_cassettes/zuora/describe_updateable_account_fields.yml +577 -0
  22. data/fixtures/vcr_cassettes/zuora/get_account_object_success.yml +60 -0
  23. data/fixtures/vcr_cassettes/zuora/get_account_success.yml +149 -0
  24. data/fixtures/vcr_cassettes/zuora/get_account_summary_success.yml +141 -0
  25. data/fixtures/vcr_cassettes/zuora/update_account_object_success.yml +115 -0
  26. data/fixtures/vcr_cassettes/zuora/update_account_success.yml +207 -0
  27. data/lib/zuora_rest_client/client.rb +1917 -0
  28. data/lib/zuora_rest_client/connection.rb +189 -0
  29. data/lib/zuora_rest_client/result.rb +8 -0
  30. data/lib/zuora_rest_client/version.rb +3 -0
  31. data/lib/zuora_rest_client.rb +7 -0
  32. data/zuora_rest_client.gemspec +45 -0
  33. metadata +383 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8688e729d34d999158bf6a54f7d81684847b419f
4
+ data.tar.gz: 395af0820799b67d2d158bb6ef652b95c5ab53fe
5
+ SHA512:
6
+ metadata.gz: f5d8fbf991658ef2e255e76061710d51328041637e7868735fb84e1c16a6ec27cf9e4bd4fe476dc6c1f47d05b32726f7508dd7c498ef3276bf6f67f1a5fac283
7
+ data.tar.gz: 0c7c86429d7048cb515abde95353ede90fd046814c035897b34850c866c1cdcde206adac7bf1a5371f64a8f4fd2d9cc7af6e26d01a0d24aa2a29dc5aae10a1e9
data/.gitignore ADDED
@@ -0,0 +1,53 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ Gemfile.lock
46
+ .ruby-version
47
+ .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ .idea
53
+ /.env
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.13.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zuora_rest_client.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright 2017 Frontera Consulting, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the "Software"),
5
+ to deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
16
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
+ DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # ZuoraRestClient
2
+
3
+ This is a simple Zuora client for Ruby. It mainly consists of methods that
4
+ wrap the operations described in the Zuora API Reference
5
+ (https://www.zuora.com/developer/api-reference), as well as a few helper methods.
6
+
7
+ Most of the methods take either the query parameters and/or a hash representing the JSON
8
+ request body as arguments. The methods return a `ZuoraRestClient::Result` object which
9
+ represents ths JSON response.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'zuora_rest_client'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install zuora_rest_client
26
+
27
+ ## Usage
28
+
29
+ First, construct a client object:
30
+ ```ruby
31
+ username = 'zuora_username@example.com'
32
+ password = 'mypassword'
33
+ client = ZuoraRestClient::Client.new(username, password) # Create a production client
34
+ ```
35
+
36
+ For a sandbox tenant, you can specify the following:
37
+ ```ruby
38
+ client = ZuoraRestClient::Client.new(username, password, :api_sandbox) # Create an api sandbox client
39
+ ```
40
+
41
+ Call one of the client methods. For example, to create an account:
42
+ ```ruby
43
+ account_to_create = {
44
+ Batch: 'Batch1',
45
+ BillCycleDay: 15,
46
+ Currency: 'USD',
47
+ Name: 'Test Account',
48
+ PaymentTerm: 'Due Upon Receipt',
49
+ Status: 'Draft' }
50
+ result = client.create_account_object(account_to_create) # Returns an object representation of the JSON response
51
+ ```
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/FronteraConsulting/zuora_rest_client.
56
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "zuora_rest_client"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://rest.zuora.com/v1/object/account
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"Batch":"Batch1","BillCycleDay":15,"Currency":"USD","Name":"Test Account","PaymentTerm":"Due
9
+ Upon Receipt","Status":"Draft"}'
10
+ headers:
11
+ User-Agent:
12
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
13
+ Accept:
14
+ - "*/*"
15
+ Accept-Encoding:
16
+ - gzip,deflate
17
+ Date:
18
+ - Fri, 09 Jun 2017 17:38:31 GMT
19
+ Content-Type:
20
+ - application/json
21
+ Apiaccesskeyid:
22
+ - "{ZUORA_USERNAME}"
23
+ Apisecretaccesskey:
24
+ - "{ZUORA_PASSWORD}"
25
+ response:
26
+ status:
27
+ code: 200
28
+ message: OK
29
+ headers:
30
+ Content-Type:
31
+ - application/json; charset=utf-8
32
+ Server:
33
+ - kong/0.9.9
34
+ X-Request-Id:
35
+ - 5c7bf3bb-9808-4343-9843-b3bac54d3445
36
+ X-Kong-Upstream-Latency:
37
+ - '363'
38
+ X-Kong-Proxy-Latency:
39
+ - '0'
40
+ Expires:
41
+ - Fri, 09 Jun 2017 17:38:31 GMT
42
+ Cache-Control:
43
+ - max-age=0, no-cache, no-store
44
+ Pragma:
45
+ - no-cache
46
+ Date:
47
+ - Fri, 09 Jun 2017 17:38:31 GMT
48
+ Content-Length:
49
+ - '57'
50
+ Connection:
51
+ - keep-alive
52
+ body:
53
+ encoding: UTF-8
54
+ string: '{"Success":true,"Id":"2c92a0fe5c7d8185015c8defa5374aa8"}
55
+
56
+ '
57
+ http_version:
58
+ recorded_at: Fri, 09 Jun 2017 17:38:31 GMT
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,66 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://rest.zuora.com/v1/accounts
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"batch":"Batch1","billCycleDay":15,"billToContact":{"country":"US","firstName":"Test","lastName":"User","state":"TX"},"creditCard":{"cardHolderInfo":{"addressLine1":"123
9
+ Anystreet Lane","cardHolderName":"Test User","city":"Anytown","country":"US","state":"TX","zipCode":"00000"},"cardNumber":"4111111111111111","cardType":"Visa","expirationMonth":"12","expirationYear":"2099","securityCode":"123"},"currency":"USD","name":"Test
10
+ Account","paymentTerm":"Due Upon Receipt"}'
11
+ headers:
12
+ User-Agent:
13
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
14
+ Accept:
15
+ - "*/*"
16
+ Accept-Encoding:
17
+ - gzip,deflate
18
+ Date:
19
+ - Fri, 09 Jun 2017 17:38:30 GMT
20
+ Content-Type:
21
+ - application/json
22
+ Apiaccesskeyid:
23
+ - "{ZUORA_USERNAME}"
24
+ Apisecretaccesskey:
25
+ - "{ZUORA_PASSWORD}"
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Content-Type:
32
+ - application/json;charset=utf-8
33
+ Server:
34
+ - Zuora App
35
+ X-Request-Id:
36
+ - 7ab05a60-723b-4a2e-9f5b-fa352908261f
37
+ X-Kong-Upstream-Latency:
38
+ - '188'
39
+ X-Kong-Proxy-Latency:
40
+ - '0'
41
+ Expires:
42
+ - Fri, 09 Jun 2017 17:38:30 GMT
43
+ Cache-Control:
44
+ - max-age=0, no-cache, no-store
45
+ Pragma:
46
+ - no-cache
47
+ Date:
48
+ - Fri, 09 Jun 2017 17:38:30 GMT
49
+ Content-Length:
50
+ - '165'
51
+ Connection:
52
+ - keep-alive
53
+ Set-Cookie:
54
+ - ZSession={ZUORA_SESSION_ID}; Path=/; Secure; HttpOnly
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "success" : true,
60
+ "accountId" : "2c92a0fd5c832adb015c8def9fd9081c",
61
+ "accountNumber" : "Z00324059",
62
+ "paymentMethodId" : "2c92a0fd5c832adb015c8def9fff0822"
63
+ }
64
+ http_version:
65
+ recorded_at: Fri, 09 Jun 2017 17:38:30 GMT
66
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,223 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://rest.zuora.com/v1/object/account/2c92a0fd5c832adb015c8def9fd9081c
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
12
+ Accept:
13
+ - "*/*"
14
+ Accept-Encoding:
15
+ - gzip,deflate
16
+ Date:
17
+ - Fri, 09 Jun 2017 17:38:32 GMT
18
+ Content-Type:
19
+ - application/json
20
+ Apiaccesskeyid:
21
+ - "{ZUORA_USERNAME}"
22
+ Apisecretaccesskey:
23
+ - "{ZUORA_PASSWORD}"
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Server:
32
+ - kong/0.9.9
33
+ X-Request-Id:
34
+ - 13ee5884-cbc3-4803-8948-db99ac4436fc
35
+ X-Kong-Upstream-Latency:
36
+ - '262'
37
+ X-Kong-Proxy-Latency:
38
+ - '0'
39
+ Expires:
40
+ - Fri, 09 Jun 2017 17:38:32 GMT
41
+ Cache-Control:
42
+ - max-age=0, no-cache, no-store
43
+ Pragma:
44
+ - no-cache
45
+ Date:
46
+ - Fri, 09 Jun 2017 17:38:32 GMT
47
+ Content-Length:
48
+ - '57'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":"2c92a0fd5c832adb015c8def9fd9081c","success":true}
54
+
55
+ '
56
+ http_version:
57
+ recorded_at: Fri, 09 Jun 2017 17:38:32 GMT
58
+ - request:
59
+ method: get
60
+ uri: https://rest.zuora.com/v1/object/account/2c92a0fd5c832adb015c8def9fd9081c
61
+ body:
62
+ encoding: UTF-8
63
+ string: ''
64
+ headers:
65
+ User-Agent:
66
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
67
+ Accept:
68
+ - "*/*"
69
+ Accept-Encoding:
70
+ - gzip,deflate
71
+ Date:
72
+ - Fri, 09 Jun 2017 17:38:32 GMT
73
+ Content-Type:
74
+ - application/json
75
+ Apiaccesskeyid:
76
+ - "{ZUORA_USERNAME}"
77
+ Apisecretaccesskey:
78
+ - "{ZUORA_PASSWORD}"
79
+ response:
80
+ status:
81
+ code: 404
82
+ message: Not Found
83
+ headers:
84
+ Content-Type:
85
+ - application/json; charset=utf-8
86
+ Server:
87
+ - kong/0.9.9
88
+ X-Request-Id:
89
+ - 5a5b0781-f65c-463b-a032-71e7b4ff47a8
90
+ X-Kong-Upstream-Latency:
91
+ - '84'
92
+ X-Kong-Proxy-Latency:
93
+ - '0'
94
+ Expires:
95
+ - Fri, 09 Jun 2017 17:38:33 GMT
96
+ Cache-Control:
97
+ - max-age=0, no-cache, no-store
98
+ Pragma:
99
+ - no-cache
100
+ Date:
101
+ - Fri, 09 Jun 2017 17:38:33 GMT
102
+ Content-Length:
103
+ - '36'
104
+ Connection:
105
+ - keep-alive
106
+ body:
107
+ encoding: UTF-8
108
+ string: '{"records":[],"size":0,"done":true}
109
+
110
+ '
111
+ http_version:
112
+ recorded_at: Fri, 09 Jun 2017 17:38:33 GMT
113
+ - request:
114
+ method: delete
115
+ uri: https://rest.zuora.com/v1/object/account/2c92a0fe5c7d8185015c8defa5374aa8
116
+ body:
117
+ encoding: UTF-8
118
+ string: ''
119
+ headers:
120
+ User-Agent:
121
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
122
+ Accept:
123
+ - "*/*"
124
+ Accept-Encoding:
125
+ - gzip,deflate
126
+ Date:
127
+ - Fri, 09 Jun 2017 17:38:33 GMT
128
+ Content-Type:
129
+ - application/json
130
+ Apiaccesskeyid:
131
+ - "{ZUORA_USERNAME}"
132
+ Apisecretaccesskey:
133
+ - "{ZUORA_PASSWORD}"
134
+ response:
135
+ status:
136
+ code: 200
137
+ message: OK
138
+ headers:
139
+ Content-Type:
140
+ - application/json; charset=utf-8
141
+ Server:
142
+ - kong/0.9.9
143
+ X-Request-Id:
144
+ - 5a6fc2fc-2b07-46fd-853a-35c61b8fc770
145
+ X-Kong-Upstream-Latency:
146
+ - '200'
147
+ X-Kong-Proxy-Latency:
148
+ - '0'
149
+ Expires:
150
+ - Fri, 09 Jun 2017 17:38:33 GMT
151
+ Cache-Control:
152
+ - max-age=0, no-cache, no-store
153
+ Pragma:
154
+ - no-cache
155
+ Date:
156
+ - Fri, 09 Jun 2017 17:38:33 GMT
157
+ Content-Length:
158
+ - '57'
159
+ Connection:
160
+ - keep-alive
161
+ body:
162
+ encoding: UTF-8
163
+ string: '{"id":"2c92a0fe5c7d8185015c8defa5374aa8","success":true}
164
+
165
+ '
166
+ http_version:
167
+ recorded_at: Fri, 09 Jun 2017 17:38:33 GMT
168
+ - request:
169
+ method: get
170
+ uri: https://rest.zuora.com/v1/object/account/2c92a0fe5c7d8185015c8defa5374aa8
171
+ body:
172
+ encoding: UTF-8
173
+ string: ''
174
+ headers:
175
+ User-Agent:
176
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
177
+ Accept:
178
+ - "*/*"
179
+ Accept-Encoding:
180
+ - gzip,deflate
181
+ Date:
182
+ - Fri, 09 Jun 2017 17:38:33 GMT
183
+ Content-Type:
184
+ - application/json
185
+ Apiaccesskeyid:
186
+ - "{ZUORA_USERNAME}"
187
+ Apisecretaccesskey:
188
+ - "{ZUORA_PASSWORD}"
189
+ response:
190
+ status:
191
+ code: 404
192
+ message: Not Found
193
+ headers:
194
+ Content-Type:
195
+ - application/json; charset=utf-8
196
+ Server:
197
+ - kong/0.9.9
198
+ X-Request-Id:
199
+ - 64cf96fb-47c0-49f1-9df3-28fd8f714843
200
+ X-Kong-Upstream-Latency:
201
+ - '289'
202
+ X-Kong-Proxy-Latency:
203
+ - '0'
204
+ Expires:
205
+ - Fri, 09 Jun 2017 17:38:33 GMT
206
+ Cache-Control:
207
+ - max-age=0, no-cache, no-store
208
+ Pragma:
209
+ - no-cache
210
+ Date:
211
+ - Fri, 09 Jun 2017 17:38:33 GMT
212
+ Content-Length:
213
+ - '36'
214
+ Connection:
215
+ - keep-alive
216
+ body:
217
+ encoding: UTF-8
218
+ string: '{"records":[],"size":0,"done":true}
219
+
220
+ '
221
+ http_version:
222
+ recorded_at: Fri, 09 Jun 2017 17:38:33 GMT
223
+ recorded_with: VCR 3.0.3