ringcentral_sdk 0.0.3
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 +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +20 -0
- data/README.md +194 -0
- data/Rakefile +19 -0
- data/VERSION.txt +1 -0
- data/lib/ringcentral_sdk.rb +5 -0
- data/lib/ringcentral_sdk/helpers.rb +3 -0
- data/lib/ringcentral_sdk/helpers/fax.rb +130 -0
- data/lib/ringcentral_sdk/platform.rb +5 -0
- data/lib/ringcentral_sdk/platform/auth.rb +20 -0
- data/lib/ringcentral_sdk/platform/parser.rb +5 -0
- data/lib/ringcentral_sdk/platform/platform.rb +89 -0
- data/lib/ringcentral_sdk/sdk.rb +15 -0
- data/test/test_setup.rb +18 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53f1dff65956dcafa9e3bd77501e187cf7c67e98
|
4
|
+
data.tar.gz: 8176d3c80e94ff445be20793393d48e6fae8d0f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e1742a2c45d5c7764a9623f435c674cce3b9f6a4140a2f7c9738a9b43c89ecbb55cdc74a330839ff6de139aca7d4a4db52acfe249e3ac21ef911b6574a44d03
|
7
|
+
data.tar.gz: f8eb9a7e19aeb738fec47dc18af2c5825fe701ff34b8aaf7690258efbd58398ed2f0fcf3604088c511468985f6e299dc27e3b2d4900486ed537a096906d2b206
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 John Wang
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
RingCentral SDK
|
2
|
+
===============
|
3
|
+
|
4
|
+
This is an unofficial Ruby SDK for the RingCentral Connect Platform REST API (https://developers.ringcentral.com).
|
5
|
+
|
6
|
+
The core SDK objects follow the general design of the [official RingCentral SDKs](https://github.com/ringcentral). The SDK helper additions are included to make it easier to interact with features of the API.
|
7
|
+
|
8
|
+
This SDK is an early stage library and subject to breaking changes.
|
9
|
+
|
10
|
+
## Included
|
11
|
+
|
12
|
+
* OAuth authorization
|
13
|
+
* Faraday client with OAuth bearer token handling
|
14
|
+
* Fax helper to create multipart/mixed messages
|
15
|
+
|
16
|
+
## To Do
|
17
|
+
|
18
|
+
The following items are still needed for this SDK. Contributions are most welcome.
|
19
|
+
|
20
|
+
* Token refresh
|
21
|
+
* Subscriptions
|
22
|
+
* Additional tests
|
23
|
+
|
24
|
+
Installation
|
25
|
+
============
|
26
|
+
|
27
|
+
## RubyGems
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ gem install ringcentral_sdk
|
31
|
+
```
|
32
|
+
|
33
|
+
Usage
|
34
|
+
=====
|
35
|
+
|
36
|
+
## Initialization
|
37
|
+
|
38
|
+
The RingCentral server URLs can be populated manually or via the included constants:
|
39
|
+
|
40
|
+
* `RingCentralSdk::Sdk::RC_SERVER_PRODUCTION`
|
41
|
+
* `RingCentralSdk::Sdk::RC_SERVER_SANDBOX`
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
## Initialization ##
|
45
|
+
|
46
|
+
require 'ringcentral_sdk'
|
47
|
+
|
48
|
+
rcsdk = RingCentralSdk::Sdk.new(
|
49
|
+
"myAppKey",
|
50
|
+
"myAppSecret",
|
51
|
+
RingCentralSdk::Sdk::RC_SERVER_SANDBOX
|
52
|
+
)
|
53
|
+
platform = rcsdk.platform
|
54
|
+
```
|
55
|
+
|
56
|
+
## Authentication
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
# Initialize using user phone number without extension number
|
60
|
+
|
61
|
+
platform.authorize("myUsername", nil, "myPassword")
|
62
|
+
|
63
|
+
# Initialize using main phone number and extension number
|
64
|
+
|
65
|
+
platform.authorize("myUsername", "myExtension", "myPassword")
|
66
|
+
```
|
67
|
+
|
68
|
+
## Creating Requests
|
69
|
+
|
70
|
+
Requests are made using the inclued Faraday client.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
client = rcsdk.platform.client
|
74
|
+
```
|
75
|
+
|
76
|
+
## Create SMS Message
|
77
|
+
|
78
|
+
SMS and other requests are directly without helpers.
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
# Send SMS - POST request
|
82
|
+
|
83
|
+
response = client.post do |req|
|
84
|
+
req.url 'account/~/extension/~/sms'
|
85
|
+
req.headers['Content-Type'] = 'application/json'
|
86
|
+
req.body = {
|
87
|
+
:from => { :phoneNumber => '16505551212' },
|
88
|
+
:to => [ { :phoneNumber => '14155551212'} ],
|
89
|
+
:text => 'RingCentral SMS demo using Ruby!'
|
90
|
+
}
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
94
|
+
## Create Fax Message
|
95
|
+
|
96
|
+
A fax helper is included that can be used to create the `multipart/mixed` HTTP request.
|
97
|
+
|
98
|
+
This consists of instantiating a fax helper object and then executing a Faraday POST request.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
# 1) Fax Helper for Text Message
|
102
|
+
|
103
|
+
fax = RingCentralSdk::Helpers::CreateFaxRequest.new(
|
104
|
+
{ account_id => '~', extension_id => '~' }, # Can be nil or {} for defaults '~'
|
105
|
+
{
|
106
|
+
# phone numbers are in E.164 format with or without leading '+'
|
107
|
+
:to => [{ :phoneNumber => '+16505551212' }],
|
108
|
+
:faxResolution => 'High',
|
109
|
+
:coverPageText => 'RingCentral fax text demo using Ruby!'
|
110
|
+
},
|
111
|
+
:text => 'RingCentral Fax via Ruby!'
|
112
|
+
)
|
113
|
+
# send the fax using Faraday below
|
114
|
+
|
115
|
+
# 2) Fax Helper for File as Raw Bytes (e.g. PDF or TIFF)
|
116
|
+
|
117
|
+
# Sending a file as a plain octet-stream is useful in
|
118
|
+
# production as it can decrease file size by 30%.
|
119
|
+
|
120
|
+
fax = RingCentralSdk::Helpers::CreateFaxRequest.new(
|
121
|
+
{ account_id => '~', extension_id => '~' }, # Can be nil or {} for defaults '~'
|
122
|
+
{
|
123
|
+
# phone numbers are in E.164 format with or without leading '+'
|
124
|
+
:to => [{ :phoneNumber => '+16505551212' }],
|
125
|
+
:faxResolution => 'High',
|
126
|
+
:coverPageText => 'RingCentral fax PDF demo using Ruby!'
|
127
|
+
},
|
128
|
+
:file_name => '/path/to/my_file.pdf'
|
129
|
+
)
|
130
|
+
# send the fax using Faraday below
|
131
|
+
|
132
|
+
# 3) Fax Helper for File Base64 Encoded (e.g. PDF or TIFF)
|
133
|
+
|
134
|
+
# Sending a file base64 encoded is useful for debugging
|
135
|
+
# purposes as the file can be copy and pasted.
|
136
|
+
|
137
|
+
fax = RingCentralSdk::Helpers::CreateFaxRequest.new(
|
138
|
+
{ account_id => '~', extension_id => '~' }, # Can be nil or {} for defaults '~'
|
139
|
+
{
|
140
|
+
# phone numbers are in E.164 format with or without leading '+'
|
141
|
+
:to => [{ :phoneNumber => '+16505551212' }],
|
142
|
+
:faxResolution => 'High',
|
143
|
+
:coverPageText => 'RingCentral fax TIFF base64 demo using Ruby!'
|
144
|
+
},
|
145
|
+
:file_name => '/path/to/my_file.tif',
|
146
|
+
:base64_encode => true
|
147
|
+
)
|
148
|
+
# send the fax using Faraday below
|
149
|
+
|
150
|
+
# Sending the fax
|
151
|
+
|
152
|
+
response = client.post do |req|
|
153
|
+
req.url fax.url
|
154
|
+
req.headers['Content-Type'] = fax.content_type
|
155
|
+
req.body = fax.body
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
159
|
+
Change Log
|
160
|
+
==========
|
161
|
+
|
162
|
+
- **2015-05-13**: 0.0.3
|
163
|
+
- Initial public release
|
164
|
+
|
165
|
+
Links
|
166
|
+
=====
|
167
|
+
|
168
|
+
Project Repo
|
169
|
+
|
170
|
+
* https://github.com/grokify/ringcentral-sdk-ruby
|
171
|
+
|
172
|
+
RingCentral API Docs
|
173
|
+
|
174
|
+
* https://developers.ringcentral.com/library.html
|
175
|
+
|
176
|
+
RingCentral API Explorer
|
177
|
+
|
178
|
+
* http://ringcentral.github.io/api-explorer
|
179
|
+
|
180
|
+
RingCentral Official SDKs
|
181
|
+
|
182
|
+
* https://github.com/ringcentral
|
183
|
+
|
184
|
+
Problems, Comments, Suggestions?
|
185
|
+
================================
|
186
|
+
|
187
|
+
All of the above are most welcome. johncwang@gmail.com
|
188
|
+
|
189
|
+
License
|
190
|
+
=======
|
191
|
+
|
192
|
+
RingCentral SDK is available under an MIT-style license. See {file:LICENSE.txt} for details.
|
193
|
+
|
194
|
+
RingCentral SDK © 2015 by John Wang
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
desc 'Default: run unit tests.'
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
desc 'Test the library.'
|
8
|
+
Rake::TestTask.new do |t|
|
9
|
+
t.libs << 'lib'
|
10
|
+
t.pattern = 'test/**/test_*.rb'
|
11
|
+
t.verbose = false
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Generate YARD documentation.'
|
15
|
+
task :gendoc do
|
16
|
+
# puts 'yard doc generation disabled until JRuby build native extensions for redcarpet or yard removes the dependency.'
|
17
|
+
system "yardoc"
|
18
|
+
system "yard stats --list-undoc"
|
19
|
+
end
|
data/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'mime'
|
3
|
+
require 'mime-types'
|
4
|
+
require 'multi_json'
|
5
|
+
|
6
|
+
module RingCentralSdk::Helpers
|
7
|
+
class CreateFaxRequest
|
8
|
+
attr_reader :msg
|
9
|
+
|
10
|
+
def initialize(path_params=nil,metadata=nil,options=nil)
|
11
|
+
|
12
|
+
@msg = MIME::Multipart::Mixed.new
|
13
|
+
@msg.headers.delete('Content-Id')
|
14
|
+
|
15
|
+
@path_params = path_params
|
16
|
+
|
17
|
+
if metadata.is_a?(Hash) || metadata.is_a?(String)
|
18
|
+
add_metadata(metadata)
|
19
|
+
end
|
20
|
+
|
21
|
+
if options.is_a?(Hash)
|
22
|
+
if options.has_key?(:file_name)
|
23
|
+
if options.has_key?(:base64_encode) && options[:base64_encode]
|
24
|
+
add_file_base64(options[:file_name],options[:file_content_type])
|
25
|
+
else
|
26
|
+
add_file_octet_stream(options[:file_name])
|
27
|
+
end
|
28
|
+
elsif options.has_key?(:text)
|
29
|
+
add_file_text(options[:text])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_metadata(json=nil)
|
35
|
+
if json.is_a?(Hash)
|
36
|
+
json = MultiJson.encode(json)
|
37
|
+
end
|
38
|
+
if json.is_a?(String)
|
39
|
+
json_part = MIME::Text.new(json)
|
40
|
+
json_part.headers.delete('Content-Id')
|
41
|
+
json_part.headers.set('Content-Type','application/json')
|
42
|
+
@msg.add(json_part)
|
43
|
+
return true
|
44
|
+
end
|
45
|
+
return false
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_file_text(text=nil,charset='UTF-8')
|
49
|
+
return unless text.is_a?(String)
|
50
|
+
text_part = MIME::Text.new(text,'plain')
|
51
|
+
text_part.headers.delete('Content-Id')
|
52
|
+
@msg.add(text_part)
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_file_base64(file_name=nil,content_type=nil)
|
56
|
+
unless file_name.is_a?(String) && File.file?(file_name)
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
|
60
|
+
content_type = (content_type.is_a?(String) && content_type =~ /^[^\/\s]+\/[^\/\s]+/) \
|
61
|
+
? content_type : MIME::Types.type_for(file_name).first.content_type
|
62
|
+
|
63
|
+
file_base64 = Base64.encode64(File.binread(file_name))
|
64
|
+
|
65
|
+
base64_part = MIME::Text.new(file_base64)
|
66
|
+
base64_part.headers.delete('Content-Id')
|
67
|
+
base64_part.headers.set('Content-Type',content_type)
|
68
|
+
base64_part.headers.set('Content-Transfer-Encoding','base64')
|
69
|
+
|
70
|
+
@msg.add(base64_part)
|
71
|
+
return true
|
72
|
+
end
|
73
|
+
|
74
|
+
def add_file_octet_stream(file_name=nil)
|
75
|
+
unless file_name.is_a?(String) && File.file?(file_name)
|
76
|
+
return false
|
77
|
+
end
|
78
|
+
|
79
|
+
base_name = File.basename(file_name)
|
80
|
+
file_bytes = File.binread(file_name)
|
81
|
+
|
82
|
+
file_part = MIME::Application.new(file_bytes)
|
83
|
+
file_part.headers.delete('Content-Id')
|
84
|
+
file_part.headers.set('Content-Type','application/octet-stream')
|
85
|
+
if base_name.is_a?(String) && base_name.length>0
|
86
|
+
file_part.headers.set('Content-Disposition', "attachment; filename=\"#{base_name}\"")
|
87
|
+
else
|
88
|
+
file_part.headers.set('Content-Disposition', 'attachment')
|
89
|
+
end
|
90
|
+
|
91
|
+
@msg.add(file_part)
|
92
|
+
return true
|
93
|
+
end
|
94
|
+
|
95
|
+
def url()
|
96
|
+
account_id = "~"
|
97
|
+
extension_id = "~"
|
98
|
+
if @path_params.is_a?(Hash)
|
99
|
+
if @path_params.has?(:account_id) && @path_params[:account_id].length>0
|
100
|
+
account_id = @path_params[:account_id]
|
101
|
+
end
|
102
|
+
if @path_params.has?(:extension_id) && @path_params[:extension_id].length>0
|
103
|
+
account_id = @path_params[:extension_id]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
url = "account/#{account_id}/extension/#{extension_id}/fax"
|
107
|
+
return url
|
108
|
+
end
|
109
|
+
|
110
|
+
def content_type()
|
111
|
+
return @msg.headers.get('Content-Type').to_s
|
112
|
+
end
|
113
|
+
|
114
|
+
def body()
|
115
|
+
return @msg.body.to_s
|
116
|
+
end
|
117
|
+
|
118
|
+
# Experimental
|
119
|
+
def _add_file(file_name=nil)
|
120
|
+
if file_name.is_a?(String) && File.file?(file_name)
|
121
|
+
file_msg = MIME::DiscreteMediaFactory.create(file_name)
|
122
|
+
file_msg.headers.delete('Content-Id')
|
123
|
+
@msg.add(file_msg)
|
124
|
+
return true
|
125
|
+
end
|
126
|
+
return false
|
127
|
+
end
|
128
|
+
private :_add_file
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RingCentralSdk::Platform
|
2
|
+
class Auth
|
3
|
+
attr_accessor :data
|
4
|
+
attr_accessor :remember
|
5
|
+
|
6
|
+
attr_reader :access_token
|
7
|
+
|
8
|
+
def initialize()
|
9
|
+
@data = nil
|
10
|
+
@remember = nil
|
11
|
+
end
|
12
|
+
def set_data(data={})
|
13
|
+
return unless data.is_a?(Hash)
|
14
|
+
|
15
|
+
@access_token = data["access_token"] ? data["access_token"] : ''
|
16
|
+
@token_type = data["token_type"] ? data["token_type"] : ''
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
4
|
+
|
5
|
+
module RingCentralSdk::Platform
|
6
|
+
class Platform
|
7
|
+
|
8
|
+
ACCESS_TOKEN_TTL = 600 # 10 minutes
|
9
|
+
REFRESH_TOKEN_TTL = 36000 # 10 hours
|
10
|
+
REFRESH_TOKEN_TTL_REMEMBER = 604800 # 1 week
|
11
|
+
ACCOUNT_PREFIX = '/account/'
|
12
|
+
ACCOUNT_ID = '~'
|
13
|
+
TOKEN_ENDPOINT = '/restapi/oauth/token'
|
14
|
+
REVOKE_ENDPOINT = '/restapi/oauth/revoke'
|
15
|
+
API_VERSION = 'v1.0'
|
16
|
+
URL_PREFIX = '/restapi'
|
17
|
+
|
18
|
+
attr_reader :client
|
19
|
+
|
20
|
+
def initialize(app_key='',app_secret='',server_url='https://platform.devtest.ringcentral.com')
|
21
|
+
|
22
|
+
@app_key = app_key
|
23
|
+
@app_secret = app_secret
|
24
|
+
@server_url = server_url
|
25
|
+
@auth = RingCentralSdk::Platform::Auth.new
|
26
|
+
|
27
|
+
@client = Faraday.new(:url => get_api_version_url()) do |conn|
|
28
|
+
conn.request :json
|
29
|
+
conn.request :url_encoded
|
30
|
+
conn.response :json, :content_type => 'application/json'
|
31
|
+
conn.adapter Faraday.default_adapter
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_api_version_url()
|
37
|
+
return @server_url + URL_PREFIX + '/' + API_VERSION
|
38
|
+
end
|
39
|
+
|
40
|
+
def authorize(username='',extension='',password='',remember=false)
|
41
|
+
|
42
|
+
response = auth_call({}, {
|
43
|
+
:grant_type => 'password',
|
44
|
+
:username => username,
|
45
|
+
:extension => extension.is_a?(String) || extension.is_a?(Integer) ? extension : '',
|
46
|
+
:password => password,
|
47
|
+
:access_token_ttl => ACCESS_TOKEN_TTL,
|
48
|
+
:refresh_token_ttl => remember ? REFRESH_TOKEN_TTL_REMEMBER : REFRESH_TOKEN_TTL
|
49
|
+
})
|
50
|
+
|
51
|
+
@auth.set_data( response.body )
|
52
|
+
@auth.remember = remember
|
53
|
+
|
54
|
+
if response.body.has_key?("access_token") && response.body["access_token"].is_a?(String)
|
55
|
+
@client.headers['Authorization'] = 'Bearer ' + response.body["access_token"]
|
56
|
+
end
|
57
|
+
|
58
|
+
return response
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_api_key()
|
62
|
+
if @app_key.is_a?(String) && @app_secret.is_a?(String)
|
63
|
+
return Base64.encode64(@app_key + ":" + @app_secret).gsub(/[\s\r\n]/,"")
|
64
|
+
else
|
65
|
+
return ''
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_auth_header()
|
70
|
+
if @auth.token_type.is_a?(String) && @auth.access_token.is_a?(String)
|
71
|
+
return @auth.token_type + ' ' + @auth.access_token
|
72
|
+
end
|
73
|
+
return ''
|
74
|
+
end
|
75
|
+
|
76
|
+
def auth_call(queryParams={},body={})
|
77
|
+
return @client.post do |req|
|
78
|
+
req.url TOKEN_ENDPOINT
|
79
|
+
req.headers['Authorization'] = 'Basic ' + get_api_key()
|
80
|
+
req.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
|
81
|
+
if body.is_a?(Hash) && body.size > 0
|
82
|
+
req.body = body
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
private :auth_call, :get_api_key, :get_api_version_url, :get_auth_header
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RingCentralSdk
|
2
|
+
class Sdk
|
3
|
+
|
4
|
+
RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com'
|
5
|
+
RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com'
|
6
|
+
|
7
|
+
attr_reader :parser
|
8
|
+
attr_reader :platform
|
9
|
+
|
10
|
+
def initialize(app_key=nil,app_secret=nil,server_url=nil)
|
11
|
+
@parser = RingCentralSdk::Platform::Parser.new
|
12
|
+
@platform = RingCentralSdk::Platform::Platform.new(app_key, app_secret, server_url)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/test/test_setup.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'ringcentral_sdk'
|
3
|
+
|
4
|
+
class RingCentralSdkTest < Test::Unit::TestCase
|
5
|
+
def testSetup
|
6
|
+
|
7
|
+
rcsdk = RingCentralSdk::Sdk.new(
|
8
|
+
"myAppKey",
|
9
|
+
"myAppSecret",
|
10
|
+
RingCentralSdk::Sdk::RC_SERVER_SANDBOX
|
11
|
+
)
|
12
|
+
|
13
|
+
assert_equal "RingCentralSdk::Sdk", rcsdk.class.name
|
14
|
+
assert_equal "RingCentralSdk::Platform::Platform", rcsdk.platform.class.name
|
15
|
+
assert_equal "Faraday::Connection", rcsdk.platform.client.class.name
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ringcentral_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Wang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: faraday_middleware
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: mime
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: mime-types
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.5'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.5'
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.5'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.5'
|
93
|
+
description: An unofficial Ruby SDK for the RingCentral Connect Platform API
|
94
|
+
email: johncwang@gmail.com
|
95
|
+
executables: []
|
96
|
+
extensions: []
|
97
|
+
extra_rdoc_files: []
|
98
|
+
files:
|
99
|
+
- CHANGELOG.md
|
100
|
+
- LICENSE.txt
|
101
|
+
- README.md
|
102
|
+
- Rakefile
|
103
|
+
- VERSION.txt
|
104
|
+
- lib/ringcentral_sdk.rb
|
105
|
+
- lib/ringcentral_sdk/helpers.rb
|
106
|
+
- lib/ringcentral_sdk/helpers/fax.rb
|
107
|
+
- lib/ringcentral_sdk/platform.rb
|
108
|
+
- lib/ringcentral_sdk/platform/auth.rb
|
109
|
+
- lib/ringcentral_sdk/platform/parser.rb
|
110
|
+
- lib/ringcentral_sdk/platform/platform.rb
|
111
|
+
- lib/ringcentral_sdk/sdk.rb
|
112
|
+
- test/test_setup.rb
|
113
|
+
homepage: https://github.com/grokify/
|
114
|
+
licenses: []
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.2.1
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: RingCentral SDK - Unofficial Ruby SDK for the RingCentral Connect Platform
|
136
|
+
API
|
137
|
+
test_files: []
|