chargebee 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/chargebee.gemspec +3 -2
- data/lib/chargebee.rb +2 -1
- data/lib/chargebee/environment.rb +9 -6
- data/lib/chargebee/models/time_machine.rb +47 -0
- data/lib/chargebee/result.rb +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38fa6e24a19f0fcffb1a6718d2fd0a74ceb484c4
|
4
|
+
data.tar.gz: 48ff155207c90a59045befe673fcb526d3f8c064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 099cfe74e5bdfbb0060f9bef2c6915c9c62fdd3ed155ba7e6f8cb56a50f832b65f5322afabcf8c377909322097e61716e7383c1083d957b49a75b1fc263125d3
|
7
|
+
data.tar.gz: 0ac8f73639afd209f759be5ba50e200fb4589ca01960b753f4f3f126788ecd2194cb70516e9debc470ed3b7f48e5aa260de001a23cb3d7ba9fba01add26fdb90
|
data/CHANGELOG.md
CHANGED
data/chargebee.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
s.required_ruby_version = '>= 1.9.3'
|
6
6
|
s.name = 'chargebee'
|
7
|
-
s.version = '2.3.
|
8
|
-
s.date = '2017-07-
|
7
|
+
s.version = '2.3.2'
|
8
|
+
s.date = '2017-07-26'
|
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."
|
@@ -62,6 +62,7 @@ Gem::Specification.new do |s|
|
|
62
62
|
lib/chargebee/models/subscription.rb
|
63
63
|
lib/chargebee/models/subscription_estimate.rb
|
64
64
|
lib/chargebee/models/third_party_payment_method.rb
|
65
|
+
lib/chargebee/models/time_machine.rb
|
65
66
|
lib/chargebee/models/transaction.rb
|
66
67
|
lib/chargebee/models/unbilled_charge.rb
|
67
68
|
lib/chargebee/request.rb
|
data/lib/chargebee.rb
CHANGED
@@ -34,10 +34,11 @@ require File.dirname(__FILE__) + '/chargebee/models/site_migration_detail'
|
|
34
34
|
require File.dirname(__FILE__) + '/chargebee/models/resource_migration'
|
35
35
|
require File.dirname(__FILE__) + '/chargebee/models/payment_source'
|
36
36
|
require File.dirname(__FILE__) + '/chargebee/models/unbilled_charge'
|
37
|
+
require File.dirname(__FILE__) + '/chargebee/models/time_machine'
|
37
38
|
|
38
39
|
module ChargeBee
|
39
40
|
|
40
|
-
VERSION = '2.3.
|
41
|
+
VERSION = '2.3.2'
|
41
42
|
|
42
43
|
@@default_env = nil
|
43
44
|
@@verify_ca_certs = true
|
@@ -1,11 +1,15 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Environment
|
3
|
-
API_VERSION = "v2"
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
API_VERSION = "v2"
|
4
|
+
# in seconds
|
5
|
+
TIME_MACHINE_TIMEOUT = 3
|
6
|
+
|
7
|
+
attr_accessor :api_key, :site, :time_machine_sleeptime
|
8
|
+
attr_reader :api_endpoint
|
9
|
+
|
7
10
|
def initialize(options)
|
8
|
-
[:
|
11
|
+
options[:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT
|
12
|
+
[:api_key, :site, :time_machine_sleeptime].each do |attr|
|
9
13
|
instance_variable_set "@#{attr}", options[attr]
|
10
14
|
end
|
11
15
|
if($CHARGEBEE_DOMAIN == nil)
|
@@ -18,6 +22,5 @@ module ChargeBee
|
|
18
22
|
def api_url(url)
|
19
23
|
url = @api_endpoint + url
|
20
24
|
end
|
21
|
-
|
22
25
|
end
|
23
26
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class TimeMachine < Model
|
3
|
+
|
4
|
+
attr_accessor :name, :time_travel_status, :genesis_time, :destination_time, :failure_code, :failure_reason,
|
5
|
+
:error_json
|
6
|
+
def wait_for_time_travel_completion(env = nil)
|
7
|
+
env = env || ChargeBee.default_env
|
8
|
+
sleeptime = env.time_machine_sleeptime
|
9
|
+
|
10
|
+
tm = (1..30).inject(self) do |time_machine|
|
11
|
+
break time_machine if time_machine.time_travel_status != "in_progress"
|
12
|
+
sleep(sleeptime)
|
13
|
+
self.class.retrieve(self.name, env).time_machine
|
14
|
+
end
|
15
|
+
|
16
|
+
# sync last fetched one with the current instance
|
17
|
+
new_values = tm.instance_variable_get("@values")
|
18
|
+
self.instance_variable_set("@values", new_values)
|
19
|
+
self.load(new_values)
|
20
|
+
|
21
|
+
case tm.time_travel_status
|
22
|
+
when "in_progress"
|
23
|
+
raise Error.new('The time travel is taking too much time')
|
24
|
+
when "failed"
|
25
|
+
json_obj = Util.symbolize_keys(JSON.parse(self.error_json))
|
26
|
+
raise OperationFailedError.new(json_obj[:http_code], json_obj)
|
27
|
+
when "not_enabled", "_unknown"
|
28
|
+
raise Error.new("Time travel status is in wrong state #{self.time_travel_status}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
# OPERATIONS
|
32
|
+
#-----------
|
33
|
+
|
34
|
+
def self.retrieve(id, env=nil, headers={})
|
35
|
+
Request.send('get', uri_path("time_machines",id.to_s), {}, env, headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.start_afresh(id, params={}, env=nil, headers={})
|
39
|
+
Request.send('post', uri_path("time_machines",id.to_s,"start_afresh"), params, env, headers)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.travel_forward(id, params={}, env=nil, headers={})
|
43
|
+
Request.send('post', uri_path("time_machines",id.to_s,"travel_forward"), params, env, headers)
|
44
|
+
end
|
45
|
+
|
46
|
+
end # ~TimeMachine
|
47
|
+
end # ~ChargeBee
|
data/lib/chargebee/result.rb
CHANGED
@@ -141,6 +141,11 @@ module ChargeBee
|
|
141
141
|
return resource_migration;
|
142
142
|
end
|
143
143
|
|
144
|
+
def time_machine()
|
145
|
+
time_machine = get(:time_machine, TimeMachine);
|
146
|
+
return time_machine;
|
147
|
+
end
|
148
|
+
|
144
149
|
|
145
150
|
def unbilled_charges()
|
146
151
|
unbilled_charges = get_list(:unbilled_charges, UnbilledCharge,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargebee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajaraman S
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/chargebee/models/subscription.rb
|
118
118
|
- lib/chargebee/models/subscription_estimate.rb
|
119
119
|
- lib/chargebee/models/third_party_payment_method.rb
|
120
|
+
- lib/chargebee/models/time_machine.rb
|
120
121
|
- lib/chargebee/models/transaction.rb
|
121
122
|
- lib/chargebee/models/unbilled_charge.rb
|
122
123
|
- lib/chargebee/request.rb
|