ringcentral_sdk 1.1.0 → 1.1.1

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: 98d2a8eb022ff4511a3d145f3b5aa893f30ba796
4
- data.tar.gz: 163dd6efc182dda1ab77523d21955fa5ac8b7348
3
+ metadata.gz: 2154bcc7c5ab9744b0e8022fce9182ef79b367f4
4
+ data.tar.gz: e905f7a5bf71557b364010abbab3d9ec3c9988b7
5
5
  SHA512:
6
- metadata.gz: d5d99ea86065b3c9c52af955f6171541205ab90cf047c0a7502f3ff280e4920178a96ef1b772c5c0c276bcb63f08c3c63eb9699a1f39d8db43b595cb758ba2bd
7
- data.tar.gz: 684f7792e42327cc036917a9f41e09d711ccad403e2b7417892b9b3a6b3c2d826f005ad45e90ba0148f8186c959897064538165c97bd8d9f889f91878bc632f3
6
+ metadata.gz: ebf2f8089617611f8bd71ed3e1abf0d36a17f608c0e1e49b47299b641d1a60db1d6e2d869a87c74694c8e09257247c507196f31c1c653b41e21644bdf99f28f1
7
+ data.tar.gz: f62ada05b0b567e60688090e3be51f41e1ce819b05c16f1bdacfa3f830c5ae7282dd55d6bad06128f34b20d019a2cf3fbb934f4dab0e9dd4201dadebd4ae3fdd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  CHANGELOG
2
2
  ---------
3
+ - **2016-02-13**: 1.1.1
4
+ - Additions
5
+ - Add `client.send_request` hash support in addition to `Request::Base` object
6
+ - Add documentation / FAQ for fax `to.name` attribute
7
+ - Bugfixes
8
+ - Fix `RingCentralSdk::REST::Cache::Extensions` bug - old client
9
+ - Fix `RingCentralSdk::REST::Request::Simple` bug - initialize body
3
10
  - **2016-02-07**: 1.1.0
4
11
  - Add Subscription to Retrieve New Messages functionality
5
12
  - `./lib`
@@ -45,11 +52,11 @@ CHANGELOG
45
52
  - Delete `VERSION.txt` file
46
53
  - **2015-10-15**: 0.4.0
47
54
  - Add OAuth `authorization_code` support
48
- - './lib'
55
+ - `./lib`
49
56
  - Add 3-Legged OAuth support via platform `authorize_url` and `authorize_code` methods
50
57
  - Update SDK initialization by converting optional params to options hash
51
58
  - Update `RingCentralSdk::Platform::Platform` to `RingCentralSdk::Platform`
52
- - './scripts'
59
+ - `./scripts`
53
60
  - Add `oauth2-sinatra` demo app in `scripts` directory
54
61
  - Add `call_recording_download.rb` demo script
55
62
  - Add `rc-credentials.json` separate demo credentials file
@@ -1,5 +1,5 @@
1
1
  module RingCentralSdk
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
 
4
4
  RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com'
5
5
  RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com'
@@ -3,7 +3,6 @@ require 'uri'
3
3
 
4
4
  module RingCentralSdk::REST::Cache
5
5
  class Extensions
6
-
7
6
  attr_accessor :client
8
7
  attr_accessor :account_id
9
8
  attr_reader :extensions_hash
@@ -13,6 +12,10 @@ module RingCentralSdk::REST::Cache
13
12
  def initialize(client)
14
13
  @client = client
15
14
  @account_id = '~'
15
+ flush()
16
+ end
17
+
18
+ def flush
16
19
  @extensions_hash = {}
17
20
  @extensions_num2id = {}
18
21
  @last_retrieved = -1
@@ -32,17 +35,17 @@ module RingCentralSdk::REST::Cache
32
35
  end
33
36
  end
34
37
  res.body['records'].each do |extension|
35
- if extension.key?('id') && extension['id']>0
38
+ if extension.key?('id') && extension['id'] > 0
36
39
  @extensions_hash[extension['id'].to_s] = extension
37
40
  end
38
41
  end
39
42
  if retrieve_all
40
43
  while res.body.key?('navigation') && res.body['navigation'].key?('nextPage')
41
- res = rcsdk.client.get do |req|
44
+ res = @client.http.get do |req|
42
45
  req.url res.body['navigation']['nextPage']['uri']
43
46
  end
44
- res.body['records'].each do |record|
45
- if extension.key?('id') && extension['id'].length>0
47
+ res.body['records'].each do |extension|
48
+ if extension.key?('id') && extension['id'] > 0
46
49
  @extensions_hash[extension['id'].to_s] = extension
47
50
  end
48
51
  end
@@ -59,7 +62,7 @@ module RingCentralSdk::REST::Cache
59
62
  def inflate_num2id()
60
63
  num2id = {}
61
64
  @extensions_hash.each do |k,v|
62
- if v.key?('id') && v['id']>0 &&
65
+ if v.key?('id') && v['id'] > 0 &&
63
66
  v.key?('extensionNumber') && v['extensionNumber'].length>0
64
67
  num2id[v['extensionNumber']] = v['id'].to_s
65
68
  end
@@ -116,6 +119,5 @@ module RingCentralSdk::REST::Cache
116
119
 
117
120
  return members
118
121
  end
119
-
120
122
  end
121
- end
123
+ end
@@ -167,14 +167,16 @@ module RingCentralSdk::REST
167
167
  return api_key
168
168
  end
169
169
 
170
- def send_request(request_sdk = nil)
171
- unless request_sdk.is_a?(RingCentralSdk::REST::Request::Base)
170
+ def send_request(request_sdk = {})
171
+ if request_sdk.is_a? Hash
172
+ request_sdk = RingCentralSdk::REST::Request::Simple.new(request_sdk)
173
+ elsif !request_sdk.is_a? RingCentralSdk::REST::Request::Base
172
174
  fail 'Request is not a RingCentralSdk::REST::Request::Base'
173
175
  end
174
176
 
175
177
  res = nil
176
-
177
178
  method = request_sdk.method.downcase
179
+
178
180
  case method
179
181
  when 'delete'
180
182
  res = @http.delete { |req| req = inflate_request(req, request_sdk) }
@@ -185,7 +187,7 @@ module RingCentralSdk::REST
185
187
  when 'put'
186
188
  res = @http.put { |req| req = inflate_request(req, request_sdk) }
187
189
  else
188
- fail "#{method} not support"
190
+ fail "#{method} not supported"
189
191
  end
190
192
  return res
191
193
  end
@@ -5,8 +5,8 @@ module RingCentralSdk::REST::Request
5
5
  @url = opts[:url]
6
6
  @params = opts[:params]
7
7
  @headers = opts[:headers]
8
- @body = body.nil? ? '' : body
9
- if body.is_a? Hash
8
+ @body = opts[:body].nil? ? {} : opts[:body]
9
+ if @body.is_a? Hash
10
10
  @headers = {} unless @headers.is_a? Hash
11
11
  @headers['Content-Type'] = 'application/json'
12
12
  end
@@ -7,7 +7,7 @@ version = $1
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'ringcentral_sdk'
9
9
  s.version = version
10
- s.date = '2016-02-07'
10
+ s.date = '2016-02-13'
11
11
  s.summary = 'RingCentral SDK - Ruby SDK for the RingCentral Connect Platform API'
12
12
  s.description = 'A Ruby SDK for the RingCentral Connect Platform API'
13
13
  s.authors = ['John Wang']
data/test/test_client.rb CHANGED
@@ -266,9 +266,20 @@ class RingCentralSdkPlatformTest < Test::Unit::TestCase
266
266
  token = client.authorize('my_test_username', 'my_test_extension', 'my_test_password')
267
267
 
268
268
  res = client.messages.sms.create(
269
- :from => '+16505551212',
270
- :to => '+14155551212',
271
- :text => 'test'
269
+ from: '+16505551212',
270
+ to: '+14155551212',
271
+ text: 'test'
272
+ )
273
+ assert_equal 'Faraday::Response', res.class.name
274
+
275
+ res = client.send_request(
276
+ method: 'post',
277
+ url: 'account/~/extension/~/sms',
278
+ body: {
279
+ from: {phoneNumber: '+16505551212'},
280
+ to: {phoneNumber: '+14155551212'},
281
+ text: 'Hi there!'
282
+ }
272
283
  )
273
284
  assert_equal 'Faraday::Response', res.class.name
274
285
  end
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.1.0
4
+ version: 1.1.1
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-02-07 00:00:00.000000000 Z
11
+ date: 2016-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv