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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39fe36f20b9679fe0be808b0bdcc0956539fe1c1
4
- data.tar.gz: 7e520d28b9a5cee605acbed7aa436e343c3b4543
3
+ metadata.gz: 96b0d4c90d59df19061062dc50faec859b7499b9
4
+ data.tar.gz: 8dba8eac8975c668140f8d5615d00721ccce4cfe
5
5
  SHA512:
6
- metadata.gz: cfc192286f79c525fe39938df701a66e6207252326c6fda855acb4fcc2a985bea5ef569ff3437fa8fb1f0bd15a5cbc18d278c945d7405d2ef8172e4352ef7c31
7
- data.tar.gz: 90bc5d7bf529b8d015fab991994f110cd91b828aed91bf8a5219ba83d27884e81f5dfc6a32ea50f5481e94ed0e7e911bfe9e4e137acc649416b0bd32906227c3
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.all_groups
30
- groups = glip.groups.all_groups type: 'Group'
31
- groups = glip.groups.all_groups type: 'Team'
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.observer MyObserver.new
41
- glip.posts.observer MyObserver.new
43
+ glip.groups.observe MyObserver.new
44
+ glip.posts.observe MyObserver.new
42
45
  ```
43
46
 
44
47
  ## Example Scripts
@@ -1,5 +1,5 @@
1
1
  module GlipSdk
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'.freeze
3
3
 
4
4
  autoload :REST, 'glip_sdk/rest'
5
5
 
@@ -15,6 +15,7 @@ module GlipSdk
15
15
  def initialize(rc_sdk)
16
16
  @api = rc_sdk
17
17
  @logger = @api.config.logger
18
+ puts ">>>\nGLIP_SCK_LOGGER_NAME [#{@api.config.logger.class.name}]\n<<<\n"
18
19
 
19
20
  @groups_cache = GlipSdk::REST::Cache::Groups.new
20
21
 
@@ -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
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-01-01 00:00:00.000000000 Z
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.5.2
156
+ rubygems_version: 2.6.8
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Glip SDK client for Ruby