ringcentral_sdk 1.3.3 → 1.3.4

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: b0dc5f696b31adcc5394fc871e99b53dc8588fd1
4
- data.tar.gz: d939e5b3744d2ca8c208feed38e559621f0db388
3
+ metadata.gz: a1a2876be06d2d3859a901c48e2fb82e8f20dbab
4
+ data.tar.gz: d5880e56002faeb10805a63e46495983684ac048
5
5
  SHA512:
6
- metadata.gz: 9a3bf45edd9e57e70de115b83664ba00fd865bf745a4d961d7b8de6630fdc7500983052b5794c836cca06899c1a8e28a3e8cd374393beaf390fae8d0d11ec708
7
- data.tar.gz: 239ccfe42900f49209c6f50e4d6b031ad4f7e5ede3be9a56ce59a8aeda11c3acc5fbabdaa13e21dcb34ffda530e1161a1a7d36890745a0b63b60aa394749ac3d
6
+ metadata.gz: 67094c9631d3e4f3a7836912e5888b0e227993332bab6a162feb872a70971903ed83743e47f80af185be595c01a2a391f71b30abfee87438af10705fc5d1f54c
7
+ data.tar.gz: 96d30902643ddd0f038bc04d8fd81ed1a7c5354f711e589f619f6b35ca3ef7626b34149ed04a1f4408ad62520d279cd8256222a5c880f914f5b85e244b86a88a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  CHANGELOG
2
2
  ---------
3
- - **2016-09-04**: 1.3.2
3
+ - **2016-09-05**: 1.3.4
4
+ - Bugfixes
5
+ - Fix `RingCentralSdk::REST::Subscription` renewal bug
6
+ - **2016-09-04**: 1.3.2 & 1.3.3
4
7
  - Bugfixes
5
8
  - Fix `RingCentralSdk::REST::Subscription` renewal bug
6
9
  - **2016-08-24**: 1.3.1
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ringcentral_sdk (1.3.3)
5
+ dotenv (~> 2.1, >= 2.1.0)
6
+ faraday (~> 0.9, >= 0.9)
7
+ faraday_middleware (~> 0, >= 0)
8
+ faraday_middleware-oauth2_refresh (~> 0)
9
+ jsondoc (~> 0.1, >= 0.1.0)
10
+ logger
11
+ mime (~> 0.4, >= 0.4.3)
12
+ mime-types (~> 3.1)
13
+ mime_builder (~> 0)
14
+ multi_json (~> 1.3)
15
+ oauth2 (~> 1.0, >= 1.0.0)
16
+ pubnub (~> 3.8)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ celluloid (0.17.3)
22
+ celluloid-essentials
23
+ celluloid-extras
24
+ celluloid-fsm
25
+ celluloid-pool
26
+ celluloid-supervision
27
+ timers (>= 4.1.1)
28
+ celluloid-essentials (0.20.5)
29
+ timers (>= 4.1.1)
30
+ celluloid-extras (0.20.5)
31
+ timers (>= 4.1.1)
32
+ celluloid-fsm (0.20.5)
33
+ timers (>= 4.1.1)
34
+ celluloid-pool (0.20.5)
35
+ timers (>= 4.1.1)
36
+ celluloid-supervision (0.20.6)
37
+ timers (>= 4.1.1)
38
+ coveralls (0.8.15)
39
+ json (>= 1.8, < 3)
40
+ simplecov (~> 0.12.0)
41
+ term-ansicolor (~> 1.3)
42
+ thor (~> 0.19.1)
43
+ tins (>= 1.6.0, < 2)
44
+ docile (1.1.5)
45
+ dotenv (2.1.1)
46
+ faraday (0.9.2)
47
+ multipart-post (>= 1.2, < 3)
48
+ faraday_middleware (0.10.0)
49
+ faraday (>= 0.7.4, < 0.10)
50
+ faraday_middleware-oauth2_refresh (0.0.3)
51
+ faraday (~> 0.9, >= 0.9)
52
+ faraday_middleware (~> 0, >= 0)
53
+ hitimes (1.2.4)
54
+ httpclient (2.8.2.3)
55
+ json (1.8.3)
56
+ jsondoc (0.1.3)
57
+ jwt (1.5.4)
58
+ logger (1.2.8)
59
+ metaclass (0.0.4)
60
+ mime (0.4.3)
61
+ mime-types (3.1)
62
+ mime-types-data (~> 3.2015)
63
+ mime-types-data (3.2016.0521)
64
+ mime_builder (0.0.3)
65
+ mime
66
+ mime-types (>= 1.25)
67
+ mocha (1.1.0)
68
+ metaclass (~> 0.0.1)
69
+ multi_json (1.12.1)
70
+ multi_xml (0.5.5)
71
+ multipart-post (2.0.0)
72
+ oauth2 (1.2.0)
73
+ faraday (>= 0.8, < 0.10)
74
+ jwt (~> 1.0)
75
+ multi_json (~> 1.3)
76
+ multi_xml (~> 0.5)
77
+ rack (>= 1.2, < 3)
78
+ power_assert (0.3.0)
79
+ pubnub (3.8.2)
80
+ celluloid (~> 0.17)
81
+ httpclient (~> 2.6)
82
+ json (~> 1.8)
83
+ rack (2.0.1)
84
+ rake (11.2.2)
85
+ simplecov (0.12.0)
86
+ docile (~> 1.1.0)
87
+ json (>= 1.8, < 3)
88
+ simplecov-html (~> 0.10.0)
89
+ simplecov-html (0.10.0)
90
+ term-ansicolor (1.3.2)
91
+ tins (~> 1.0)
92
+ test-unit (3.2.1)
93
+ power_assert
94
+ thor (0.19.1)
95
+ timers (4.1.1)
96
+ hitimes
97
+ tins (1.12.0)
98
+
99
+ PLATFORMS
100
+ ruby
101
+
102
+ DEPENDENCIES
103
+ coveralls
104
+ mocha
105
+ rake
106
+ ringcentral_sdk!
107
+ simplecov
108
+ test-unit
109
+
110
+ BUNDLED WITH
111
+ 1.12.5
@@ -1,5 +1,5 @@
1
1
  module RingCentralSdk
2
- VERSION = '1.3.3'
2
+ VERSION = '1.3.4'
3
3
 
4
4
  RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com'
5
5
  RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com'
@@ -22,6 +22,7 @@ module RingCentralSdk::REST
22
22
 
23
23
  attr_reader :app_config
24
24
  attr_reader :http
25
+ attr_reader :logger
25
26
  attr_reader :oauth2client
26
27
  attr_reader :user_agent
27
28
  attr_reader :messages
@@ -39,6 +40,12 @@ module RingCentralSdk::REST
39
40
  end
40
41
 
41
42
  @instance_headers = opts[:headers] || {}
43
+ if opts.key? :logger
44
+ @logger = opts[:logger]
45
+ else
46
+ @logger = Logger.new(STDOUT)
47
+ @logger.level = :info
48
+ end
42
49
 
43
50
  @messages = RingCentralSdk::REST::Messages.new self
44
51
  end
@@ -205,6 +212,7 @@ module RingCentralSdk::REST
205
212
  else
206
213
  fail "method [#{method}] not supported"
207
214
  end
215
+
208
216
  return res
209
217
  end
210
218
 
@@ -19,6 +19,7 @@ module RingCentralSdk::REST
19
19
  @_timeout = nil
20
20
  @_subscription = nil_subscription()
21
21
  @_pubnub = nil
22
+ @_logger_prefix = " -- #{self.class.name}: "
22
23
  end
23
24
 
24
25
  def nil_subscription()
@@ -103,23 +104,21 @@ module RingCentralSdk::REST
103
104
  if !@event_filters.is_a?(Array) || @event_filters.length ==0
104
105
  raise 'Events are undefined'
105
106
  end
106
-
107
- _clear_timeout()
107
+ _clear_timeout
108
108
 
109
109
  begin
110
- response = @_client.http.put do |req|
111
- req.url 'subscription/' + @_subscription['id'].to_s
110
+ response = @_client.http.post do |req|
111
+ req.url uri_join(@_subscription['uri'], 'renew')
112
112
  req.headers['Content-Type'] = 'application/json'
113
- req.body = {
114
- eventFilters: @_client.create_urls(@event_filters)
115
- }
116
113
  end
117
114
 
118
115
  set_subscription response.body
119
116
  changed
120
117
  notify_observers response
118
+
121
119
  return response
122
120
  rescue StandardError => e
121
+ puts "RingCentralSdk::REST::Subscription: RENEW_ERROR #{e}"
123
122
  reset()
124
123
  changed
125
124
  notify_observers e
@@ -162,9 +161,9 @@ module RingCentralSdk::REST
162
161
  end
163
162
 
164
163
  def set_subscription(data)
165
- _clear_timeout()
164
+ _clear_timeout
166
165
  @_subscription = data
167
- _set_timeout()
166
+ _set_timeout
168
167
  end
169
168
 
170
169
  def reset
@@ -202,6 +201,10 @@ module RingCentralSdk::REST
202
201
  end
203
202
 
204
203
  def _notify(message)
204
+ count = count_observers
205
+ count_string = " -- RingCentralSdk::REST::Subscription: Notify #{count.to_s} observers"
206
+ puts count_string
207
+
205
208
  message = _decrypt message
206
209
  changed
207
210
  notify_observers message
@@ -246,6 +249,8 @@ module RingCentralSdk::REST
246
249
  end
247
250
 
248
251
  def _set_timeout
252
+ _clear_timeout
253
+
249
254
  time_to_expiration = @_subscription['expiresIn'] - RENEW_HANDICAP
250
255
 
251
256
  @_timeout = Thread.new do
@@ -255,10 +260,13 @@ module RingCentralSdk::REST
255
260
  end
256
261
 
257
262
  def _clear_timeout
258
- unless @_timeout.nil?
259
- @_timeout.exit
260
- @_timeout = nil
261
- end
263
+ @_timeout.exit if @_timeout.is_a?(Thread) && @_timeout.status == 'sleep'
264
+ @_timeout = nil
265
+ end
266
+
267
+ def uri_join(*args)
268
+ url = args.join('/').gsub(/\/+/, '/')
269
+ return url.gsub(/^(https?:\/)/i, '\1/')
262
270
  end
263
271
 
264
272
  def new_pubnub(subscribe_key='', ssl_on=false, publish_key='', my_logger=nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ringcentral_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-04 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -292,6 +292,7 @@ extra_rdoc_files: []
292
292
  files:
293
293
  - CHANGELOG.md
294
294
  - Gemfile
295
+ - Gemfile.lock
295
296
  - LICENSE.txt
296
297
  - README.md
297
298
  - Rakefile