ringcentral-sdk 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecc70101c8a49551105f83e593be979fe25a2ab7
4
- data.tar.gz: 22981b9c0d649af8da86ef9de9d6f507fb82ceac
3
+ metadata.gz: 0e9ec214fa6cb168e753cf367afc4fab5ece8a4d
4
+ data.tar.gz: 7618f9fca3c507b3ecf791ffb888d52bad222561
5
5
  SHA512:
6
- metadata.gz: 052b9067500e5b0d781b3b026ba4670496b27e7fdc3ec8ca532f92869350978104cc7535089d79c6588afac7e844ad03543087ee37b695382046ebcdb77f6610
7
- data.tar.gz: de0b01dff34151dba3ce24c4edc79cf6cf6103707d77b1a767808c79f5380dc1f433763a20df574f04689add934cce619ac80e8e7124e8eff72fe01ec7ebe25b
6
+ metadata.gz: 0c120833dbf80291b4e32e14e545b40a29b3d37a53d6bc387617f0d52df9ef42b6df32dd1e4af299740207597797c62eac11474e4e5c7a03fe341ee8b706ca91
7
+ data.tar.gz: c6e5688b6510026d740fb31a006c2f0613b4a0fe99a3a5847a1544812bf7ddfd1153df0fd9c0d692e42fe1d1c86c79df5dbebbd299acab2f4b9e46475e73a973
data/README.md CHANGED
@@ -46,6 +46,27 @@ expect('101').to eq(r.body['extensionNumber'])
46
46
  ```
47
47
 
48
48
 
49
+ ## How to specify query parameters
50
+
51
+ ### for get & delete
52
+
53
+ ```ruby
54
+ rc.get('/restapi/v1.0/account/~/extension', { hello: 'world' })
55
+ ```
56
+
57
+ ### for post, put & patch
58
+
59
+ ```ruby
60
+ rc.post('/restapi/v1.0/account/~/extension/~/sms', body, { hello: 'world' })
61
+ ```
62
+
63
+ ### multi-value query parameter
64
+
65
+ rc.get('/restapi/v1.0/account/~/extension', { hello: ['world1', 'world2'] })
66
+
67
+ Above will be translated to `/restapi/v1.0/account/~/extension?hello=world1&hello=world2`.
68
+
69
+
49
70
  ### Token Refresh
50
71
 
51
72
  Access token expires. You need to call `rc.refresh()` before it expires.
@@ -25,10 +25,10 @@ class RingCentral
25
25
  @auto_refresh = false
26
26
  @token = nil
27
27
  @timer = nil
28
- @faraday = Faraday.new(url: server) do |faraday|
28
+ @faraday = Faraday.new(url: server, request: { params_encoder: Faraday::FlatParamsEncoder }) do |faraday|
29
29
  faraday.request :multipart
30
30
  faraday.request :url_encoded
31
- faraday.response :json, :content_type => /\bjson$/
31
+ faraday.response :json, content_type: /\bjson$/
32
32
  faraday.adapter Faraday.default_adapter
33
33
  end
34
34
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'ringcentral-sdk'
3
- gem.version = '0.9.2'
3
+ gem.version = '0.9.4'
4
4
  gem.authors = ['Tyler Liu']
5
5
  gem.email = ['tyler.liu@ringcentral.com']
6
6
  gem.description = 'Ruby SDK for you to access RingCentral platform API.'
@@ -0,0 +1,22 @@
1
+ require 'dotenv'
2
+ require 'ringcentral'
3
+
4
+ RSpec.describe 'query params' do
5
+ describe 'single' do
6
+ it 'contain single query param' do
7
+ Dotenv.load
8
+ rc = RingCentral.new(ENV['RINGCENTRAL_CLIENT_ID'], ENV['RINGCENTRAL_CLIENT_SECRET'], ENV['RINGCENTRAL_SERVER_URL'])
9
+ rc.authorize(username: ENV['RINGCENTRAL_USERNAME'], extension: ENV['RINGCENTRAL_EXTENSION'], password: ENV['RINGCENTRAL_PASSWORD'])
10
+ r = rc.get('/restapi/v1.0/account/~/extension/~/address-book/contact', { phoneNumber: '666' })
11
+ expect(r).not_to be_nil
12
+ message = r.body
13
+ expect(message['uri']).to include('phoneNumber=666')
14
+
15
+ r = rc.get('/restapi/v1.0/account/~/extension/~/address-book/contact', { phoneNumber: ['666', '888'] })
16
+ expect(r).not_to be_nil
17
+ message = r.body
18
+ expect(message['uri']).to include('phoneNumber=666&phoneNumber=888')
19
+ rc.revoke()
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ringcentral-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Liu
@@ -123,6 +123,7 @@ files:
123
123
  - ringcentral-sdk.gemspec
124
124
  - spec/fax_spec.rb
125
125
  - spec/mms_spec.rb
126
+ - spec/query_params_spec.rb
126
127
  - spec/ringcentral_spec.rb
127
128
  - spec/spec_helper.rb
128
129
  - spec/subscription_spec.rb
@@ -156,3 +157,4 @@ test_files:
156
157
  - spec/mms_spec.rb
157
158
  - spec/fax_spec.rb
158
159
  - spec/subscription_spec.rb
160
+ - spec/query_params_spec.rb