chargebee 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/chargebee.gemspec +2 -3
- data/lib/chargebee.rb +2 -2
- data/lib/chargebee/models/event.rb +1 -1
- data/lib/chargebee/models/subscription.rb +4 -0
- data/lib/chargebee/rest.rb +3 -3
- metadata +2 -3
- data/lib/chargebee/model.rb +0 -52
data/chargebee.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'chargebee'
|
7
|
-
s.version = '1.2.
|
8
|
-
s.date = '2013-08-
|
7
|
+
s.version = '1.2.5'
|
8
|
+
s.date = '2013-08-19'
|
9
9
|
|
10
10
|
s.summary = "Ruby client for Chargebee API."
|
11
11
|
s.description = "Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com."
|
@@ -36,7 +36,6 @@ Gem::Specification.new do |s|
|
|
36
36
|
lib/chargebee/api_error.rb
|
37
37
|
lib/chargebee/environment.rb
|
38
38
|
lib/chargebee/list_result.rb
|
39
|
-
lib/chargebee/model.rb
|
40
39
|
lib/chargebee/models/addon.rb
|
41
40
|
lib/chargebee/models/address.rb
|
42
41
|
lib/chargebee/models/card.rb
|
data/lib/chargebee.rb
CHANGED
@@ -7,7 +7,7 @@ require File.dirname(__FILE__) + '/chargebee/list_result'
|
|
7
7
|
|
8
8
|
require File.dirname(__FILE__) + '/chargebee/api_error'
|
9
9
|
|
10
|
-
require File.dirname(__FILE__) + '/chargebee/model'
|
10
|
+
require File.dirname(__FILE__) + '/chargebee/models/model'
|
11
11
|
require File.dirname(__FILE__) + '/chargebee/models/subscription'
|
12
12
|
require File.dirname(__FILE__) + '/chargebee/models/customer'
|
13
13
|
require File.dirname(__FILE__) + '/chargebee/models/card'
|
@@ -24,7 +24,7 @@ require File.dirname(__FILE__) + '/chargebee/models/coupon'
|
|
24
24
|
|
25
25
|
module ChargeBee
|
26
26
|
|
27
|
-
VERSION = '1.2.
|
27
|
+
VERSION = '1.2.5'
|
28
28
|
|
29
29
|
@@default_env = nil
|
30
30
|
@@verify_ca_certs = true
|
@@ -48,5 +48,9 @@ module ChargeBee
|
|
48
48
|
Request.send('post', "/subscriptions/#{id.to_s}/reactivate", params, env)
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.add_credit(id, params, env=nil)
|
52
|
+
Request.send('post', "/subscriptions/#{id.to_s}/add_credit", params, env)
|
53
|
+
end
|
54
|
+
|
51
55
|
end # ~Subscription
|
52
56
|
end # ~ChargeBee
|
data/lib/chargebee/rest.rb
CHANGED
@@ -27,11 +27,11 @@ module ChargeBee
|
|
27
27
|
payload = params
|
28
28
|
end
|
29
29
|
|
30
|
+
user_agent = "Chargebee-Ruby-Client v#{ChargeBee::VERSION}"
|
30
31
|
headers = {
|
31
|
-
"User-Agent" =>
|
32
|
+
"User-Agent" => user_agent,
|
32
33
|
:accept => :json
|
33
|
-
}.merge(headers)
|
34
|
-
|
34
|
+
}.merge(headers)
|
35
35
|
opts = {
|
36
36
|
:method => method,
|
37
37
|
:url => env.api_url(url),
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: chargebee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rajaraman S
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2013-08-
|
14
|
+
date: 2013-08-19 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json_pure
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- lib/chargebee/api_error.rb
|
78
78
|
- lib/chargebee/environment.rb
|
79
79
|
- lib/chargebee/list_result.rb
|
80
|
-
- lib/chargebee/model.rb
|
81
80
|
- lib/chargebee/models/addon.rb
|
82
81
|
- lib/chargebee/models/address.rb
|
83
82
|
- lib/chargebee/models/card.rb
|
data/lib/chargebee/model.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module ChargeBee
|
2
|
-
class Model
|
3
|
-
|
4
|
-
def initialize(values, sub_types={})
|
5
|
-
@values = values
|
6
|
-
@sub_types = sub_types
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_s(*args)
|
10
|
-
JSON.pretty_generate(@values)
|
11
|
-
end
|
12
|
-
|
13
|
-
def inspect()
|
14
|
-
"#<#{self.class}:0x#{self.object_id.to_s(16)} > JSON: " + JSON.pretty_generate(@values)
|
15
|
-
end
|
16
|
-
|
17
|
-
def load(values)
|
18
|
-
instance_eval do
|
19
|
-
values.each do |k, v|
|
20
|
-
set_val = nil
|
21
|
-
case v
|
22
|
-
when Hash
|
23
|
-
set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
|
24
|
-
when Array
|
25
|
-
if(@sub_types[k] != nil)
|
26
|
-
set_val = v.map { |item| @sub_types[k].construct(item)}
|
27
|
-
else
|
28
|
-
set_val = v
|
29
|
-
end
|
30
|
-
else
|
31
|
-
set_val = v
|
32
|
-
end
|
33
|
-
instance_variable_set("@#{k}", set_val)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def method_missing(m, *args, &block)
|
39
|
-
puts "There's no method called #{m} #{args} here -- please try again."
|
40
|
-
puts @values
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.construct(values, sub_types = {})
|
44
|
-
if(values != nil)
|
45
|
-
obj = self.new(values, sub_types)
|
46
|
-
obj.load(values)
|
47
|
-
obj
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|