zuora4r 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/bin/zuora-delete +64 -0
- data/lib/zuora_client.rb +10 -0
- data/zuora4r.gemspec +4 -3
- metadata +6 -4
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "zuora4r"
|
8
|
-
gem.version = "1.0.
|
8
|
+
gem.version = "1.0.2"
|
9
9
|
gem.summary = "Zuora4r"
|
10
10
|
gem.description = "A client for Zuora API"
|
11
11
|
gem.email = "gene@ning.com"
|
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
"lib/**/*", "bin/**/*"]
|
16
16
|
gem.add_dependency "soap4r", ">= 1.5.8"
|
17
17
|
gem.add_dependency "json_pure", ">= 1.4.6"
|
18
|
-
gem.executables = ['zuora-query', 'zuora-bill-run', 'zuora-payment-run', 'zq']
|
18
|
+
gem.executables = ['zuora-query', 'zuora-bill-run', 'zuora-payment-run', 'zuora-delete', 'zq']
|
19
19
|
gem.requirements = ["none"]
|
20
20
|
gem.bindir = "bin"
|
21
21
|
end
|
data/bin/zuora-delete
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright 2010 Ning
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
$:.unshift(File::join(File::dirname(File::dirname(__FILE__)), 'lib'))
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
require 'optparse'
|
21
|
+
require 'json/pure'
|
22
|
+
require 'zuora_client'
|
23
|
+
|
24
|
+
username = nil
|
25
|
+
password = nil
|
26
|
+
environment = 'prod'
|
27
|
+
type = nil
|
28
|
+
ids = nil
|
29
|
+
|
30
|
+
|
31
|
+
opts = OptionParser.new do |opts|
|
32
|
+
opts.banner = 'Usage: zuora-delete -u <username> -p <password> -e [prod|sandbox] -t <type> -i <id_1,...>'
|
33
|
+
opts.on('-u', '--user USERNAME', 'username') { |u| username = u }
|
34
|
+
opts.on('-p', '--pass PASSWORD', 'password') { |p| password = p }
|
35
|
+
opts.on('-e', '--env ENVIRONMENT', '[prod|sandbox] (default: prod)') { |e| environment = e }
|
36
|
+
opts.on('-t', '--type TYPE', 'type (Account, Subscription, Payment, etc)') { |e| type = e }
|
37
|
+
opts.on('-i', '--id IDs', 'id(s) to be removed') { |e| ids = e.split(',').map {|i| i.strip} }
|
38
|
+
opts.on('-v', '--verbose', 'log harder') { $ZUORA_VERBOSE = true }
|
39
|
+
end
|
40
|
+
|
41
|
+
if ARGV.empty?
|
42
|
+
puts opts
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.parse!(ARGV)
|
47
|
+
|
48
|
+
unless username and password and type and ids
|
49
|
+
puts opts
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
53
|
+
url = case environment.downcase
|
54
|
+
when 'sandbox'
|
55
|
+
ZuoraClient::SANDBOX_URL
|
56
|
+
else
|
57
|
+
ZuoraClient::PROD_URL
|
58
|
+
end
|
59
|
+
|
60
|
+
zuora_client = ZuoraClient.new(username, password, url)
|
61
|
+
|
62
|
+
result = zuora_client.delete(type, ids)
|
63
|
+
|
64
|
+
puts JSON.pretty_generate(result) if result
|
data/lib/zuora_client.rb
CHANGED
@@ -111,6 +111,16 @@ class ZuoraClient
|
|
111
111
|
result || []
|
112
112
|
end
|
113
113
|
|
114
|
+
def delete(type, ids)
|
115
|
+
begin
|
116
|
+
response = @client.delete(type, ids)
|
117
|
+
result = save_results_to_hash(response)
|
118
|
+
rescue Exception => e
|
119
|
+
puts e.message
|
120
|
+
end
|
121
|
+
result || []
|
122
|
+
end
|
123
|
+
|
114
124
|
private
|
115
125
|
|
116
126
|
def save_results_to_hash(save_results)
|
data/zuora4r.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{zuora4r}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cloocher"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-07}
|
13
13
|
s.description = %q{A client for Zuora API}
|
14
14
|
s.email = %q{gene@ning.com}
|
15
|
-
s.executables = ["zuora-query", "zuora-bill-run", "zuora-payment-run", "zq"]
|
15
|
+
s.executables = ["zuora-query", "zuora-bill-run", "zuora-payment-run", "zuora-delete", "zq"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README.rdoc"
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Rakefile",
|
22
22
|
"bin/zq",
|
23
23
|
"bin/zuora-bill-run",
|
24
|
+
"bin/zuora-delete",
|
24
25
|
"bin/zuora-payment-run",
|
25
26
|
"bin/zuora-query",
|
26
27
|
"lib/zuora/ZUORA.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cloocher
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ executables:
|
|
56
56
|
- zuora-query
|
57
57
|
- zuora-bill-run
|
58
58
|
- zuora-payment-run
|
59
|
+
- zuora-delete
|
59
60
|
- zq
|
60
61
|
extensions: []
|
61
62
|
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- Rakefile
|
67
68
|
- bin/zq
|
68
69
|
- bin/zuora-bill-run
|
70
|
+
- bin/zuora-delete
|
69
71
|
- bin/zuora-payment-run
|
70
72
|
- bin/zuora-query
|
71
73
|
- lib/zuora/ZUORA.rb
|