glip_sdk 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/lib/glip_sdk.rb +1 -1
- data/lib/glip_sdk/rest/client.rb +1 -0
- data/lib/glip_sdk/rest/posts.rb +11 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b0d4c90d59df19061062dc50faec859b7499b9
|
4
|
+
data.tar.gz: 8dba8eac8975c668140f8d5615d00721ccce4cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6928fa85cd7232039ba18789c2d32a917e01350a41f28c74a340cc5c1de4dd421a292e971f673977c0417907d1f9558126bfcff640d1209dd5a430fd865a7557
|
7
|
+
data.tar.gz: 6e5af46c8786fb27b4eb4383724692ab653c7c68860f8007a24932311ec12310aef6e1eefd146d642238602196b762485b780308357128984856eeed451e8505
|
data/README.md
CHANGED
@@ -24,11 +24,14 @@ glip = GlipSdk::REST::Client.new rc_sdk
|
|
24
24
|
# For HTTP calls, params are the same as REST API, e.g. camelCase
|
25
25
|
res = glip.posts.post groupId: '12345', text: 'Hi there!'
|
26
26
|
|
27
|
-
# Get all groups will successfully call `prevPageToken` as provided
|
28
27
|
# All params can be provided:
|
29
|
-
groups = glip.groups.
|
30
|
-
groups = glip.groups.
|
31
|
-
|
28
|
+
groups = glip.groups.get # => Faraday::Response
|
29
|
+
groups = glip.groups.get groupId: 12345 # => Faraday::Response
|
30
|
+
|
31
|
+
# Get all groups will continue call `prevPageToken` as provided
|
32
|
+
groups = glip.groups.all_groups # => Array group hash
|
33
|
+
groups = glip.groups.all_groups type: 'Group' # => ..where type == 'Group'
|
34
|
+
groups = glip.groups.all_groups type: 'Team' # => ..where type == 'Team'
|
32
35
|
|
33
36
|
# Subscribe for updates
|
34
37
|
class MyObserver
|
@@ -37,8 +40,8 @@ class MyObserver
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
glip.groups.
|
41
|
-
glip.posts.
|
43
|
+
glip.groups.observe MyObserver.new
|
44
|
+
glip.posts.observe MyObserver.new
|
42
45
|
```
|
43
46
|
|
44
47
|
## Example Scripts
|
data/lib/glip_sdk.rb
CHANGED
data/lib/glip_sdk/rest/client.rb
CHANGED
data/lib/glip_sdk/rest/posts.rb
CHANGED
@@ -7,6 +7,7 @@ module GlipSdk
|
|
7
7
|
|
8
8
|
def initialize(rc_sdk)
|
9
9
|
@api = rc_sdk
|
10
|
+
@logger_prefix = " -- #{self.class.name}: "
|
10
11
|
end
|
11
12
|
|
12
13
|
def post(opts = {})
|
@@ -25,13 +26,21 @@ module GlipSdk
|
|
25
26
|
end
|
26
27
|
|
27
28
|
params = { groupId: group_id, text: opts[:text] }
|
28
|
-
puts MultiJson.encode params
|
29
29
|
|
30
|
-
@api.http.post do |req|
|
30
|
+
res = @api.http.post do |req|
|
31
31
|
req.url 'glip/posts'
|
32
32
|
req.headers['Content-Type'] = 'application/json'
|
33
33
|
req.body = { groupId: group_id, text: opts[:text] }
|
34
34
|
end
|
35
|
+
|
36
|
+
if res.status >= 400
|
37
|
+
@api.config.logger.warn("#{@logger_prefix}Glip API Response Status #{res.status}")
|
38
|
+
@api.config.logger.warn("#{@logger_prefix}Response Body: #{MultiJson.encode(res.body)}")
|
39
|
+
else
|
40
|
+
@api.config.logger.info("#{@logger_prefix}Glip API Response Status #{res.status}")
|
41
|
+
end
|
42
|
+
|
43
|
+
res
|
35
44
|
end
|
36
45
|
|
37
46
|
def get(opts = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glip_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ringcentral_sdk
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.6.8
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Glip SDK client for Ruby
|