ringcentral-sdk 0.5.0 → 0.6.0

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: 974a83a81aeb7fc4ebe89f092e37bd2f5263d476
4
- data.tar.gz: 42dd0d044334332b3d460b0d119601885b4be65a
3
+ metadata.gz: bbb5f69a24a6a8f835ff75324620bac5d813a602
4
+ data.tar.gz: 3c2d9b887bd8118d50a0c0e8f24e69b4a6b8b7d0
5
5
  SHA512:
6
- metadata.gz: 2497fce973fec489e9c6146412c57597a38829d84e3e456d9182f1fa18d9e46757672f0f1f8607f4f8b4b5df0ff260014fccc9244d9ec62feb78f77e326e633b
7
- data.tar.gz: ba66d11760095aea93a724ad3582cc4a2c6a74412c3c1da163a892af7af7e3713de9d3771cc4059371c765671d4ffd92fd4f22543e1434930b6d17527649f750
6
+ metadata.gz: 4d4105624d9b70a661986e3f9eff290beab847559a5b202635724d86a0cbb03a72c63b0d8664fbcad99c563586ef617431c35db19b790af49ea680afcb72e023
7
+ data.tar.gz: e27677e5cb71471c482484f973fd04c5ed35b3f24c11f2774bdfcce403438b53b767d242dfeb06ba0cd784c2da78cca9f67a1e6a53be37538dc0098f16f9105d
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Build Status](https://travis-ci.org/ringcentral/ringcentral-ruby.svg?branch=master)](https://travis-ci.org/ringcentral/ringcentral-ruby)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/ringcentral/ringcentral-ruby/badge.svg?branch=master)](https://coveralls.io/github/ringcentral/ringcentral-ruby?branch=master)
5
5
 
6
-
7
6
  Ruby SDK for RingCentral.
8
7
 
9
8
 
@@ -34,6 +33,66 @@ expect('101').to eq(JSON.parse(r.body)['extensionNumber'])
34
33
  ```
35
34
 
36
35
 
36
+ ### Send SMS
37
+
38
+ ```ruby
39
+ r = rc.post('/restapi/v1.0/account/~/extension/~/sms', payload: {
40
+ to: [{phoneNumber: ENV['receiver']}],
41
+ from: {phoneNumber: ENV['username']},
42
+ text: 'Hello world'
43
+ })
44
+ ```
45
+
46
+
47
+ ### Send fax
48
+
49
+ ```ruby
50
+ rc.post('/restapi/v1.0/account/~/extension/~/fax',
51
+ payload: { to: [{ phoneNumber: ENV['receiver'] }] },
52
+ files: [
53
+ 'spec/test.txt;type=text/plain',
54
+ 'spec/test.png;type=image/png'
55
+ ]
56
+ )
57
+ ```
58
+
59
+
60
+ ### Send MMS
61
+
62
+ ```ruby
63
+ r = rc.post('/restapi/v1.0/account/~/extension/~/sms',
64
+ payload: {
65
+ to: [{ phoneNumber: ENV['receiver'] }],
66
+ from: { phoneNumber: ENV['username'] },
67
+ text: 'hello world'
68
+ },
69
+ files: [
70
+ 'spec/test.png;type=image/png'
71
+ ]
72
+ )
73
+ ```
74
+
75
+
76
+ ### PubNub subscription
77
+
78
+ ```ruby
79
+ def createSubscription(callback)
80
+ events = [
81
+ '/restapi/v1.0/account/~/extension/~/message-store',
82
+ ]
83
+ subscription = rc.subscription(events, lambda { |message|
84
+ callback.call(message)
85
+ })
86
+ subscription.subscribe()
87
+ return subscription
88
+ end
89
+
90
+ createSubscription(lambda { |message|
91
+ puts message
92
+ })
93
+ ```
94
+
95
+
37
96
  For more sample code, please refer to the [test cases](/spec).
38
97
 
39
98
 
@@ -1,6 +1,5 @@
1
1
  require 'base64'
2
2
  require 'addressable/uri'
3
- require 'subscription'
4
3
  require 'json'
5
4
  require 'concurrent'
6
5
  require 'faraday'
@@ -152,10 +151,6 @@ class RingCentral
152
151
  end
153
152
  end
154
153
 
155
- def subscription(events, callback)
156
- Subscription.new(self, events, callback)
157
- end
158
-
159
154
  private
160
155
 
161
156
  def basic_key
@@ -3,7 +3,7 @@ require 'concurrent'
3
3
  require 'openssl'
4
4
  require 'base64'
5
5
 
6
- class Subscription
6
+ class PubNub
7
7
  attr_accessor :events
8
8
 
9
9
  def initialize(ringcentral, events, message_callback, status_callback = nil, presence_callback = nil)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'ringcentral-sdk'
3
- gem.version = '0.5.0'
3
+ gem.version = '0.6.0'
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.'
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.add_dependency('addressable', '~> 2.5', '>= 2.5.2')
17
17
  gem.add_dependency('concurrent-ruby', '~> 1.0', '>= 1.0.2')
18
18
  gem.add_dependency('pubnub', '~> 4.0', '>= 4.0.27')
19
- gem.add_dependency('faraday', '~> 0.13', '>= 0.13.1')
19
+ gem.add_dependency('faraday', '~> 0.10', '>= 0.10.0')
20
20
  end
@@ -1,4 +1,5 @@
1
1
  require 'ringcentral'
2
+ require 'subscription'
2
3
  require 'dotenv'
3
4
  require 'rspec'
4
5
 
@@ -10,7 +11,7 @@ def createSubscription(callback)
10
11
  events = [
11
12
  '/restapi/v1.0/account/~/extension/~/message-store',
12
13
  ]
13
- subscription = $rc.subscription(events, lambda { |message|
14
+ subscription = PubNub.new($rc, events, lambda { |message|
14
15
  callback.call(message)
15
16
  })
16
17
  subscription.subscribe()
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: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Liu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -76,20 +76,20 @@ dependencies:
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '0.13'
79
+ version: '0.10'
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.13.1
82
+ version: 0.10.0
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.13'
89
+ version: '0.10'
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 0.13.1
92
+ version: 0.10.0
93
93
  description: Ruby SDK for you to access RingCentral platform API.
94
94
  email:
95
95
  - tyler.liu@ringcentral.com
@@ -131,8 +131,8 @@ signing_key:
131
131
  specification_version: 4
132
132
  summary: RingCentral Ruby SDK.
133
133
  test_files:
134
- - spec/fax_spec.rb
135
- - spec/mms_spec.rb
136
- - spec/ringcentral_spec.rb
137
134
  - spec/spec_helper.rb
135
+ - spec/ringcentral_spec.rb
136
+ - spec/mms_spec.rb
137
+ - spec/fax_spec.rb
138
138
  - spec/subscription_spec.rb