ringcentral-sdk 0.9.2 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/ringcentral.rb +2 -2
- data/ringcentral-sdk.gemspec +1 -1
- data/spec/query_params_spec.rb +22 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e9ec214fa6cb168e753cf367afc4fab5ece8a4d
|
4
|
+
data.tar.gz: 7618f9fca3c507b3ecf791ffb888d52bad222561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/ringcentral.rb
CHANGED
@@ -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, :
|
31
|
+
faraday.response :json, content_type: /\bjson$/
|
32
32
|
faraday.adapter Faraday.default_adapter
|
33
33
|
end
|
34
34
|
end
|
data/ringcentral-sdk.gemspec
CHANGED
@@ -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.
|
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
|