oksky-chat-api 0.1.3 → 0.1.4
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 +4 -4
- data/lib/oksky/chat/api/version.rb +1 -1
- data/lib/oksky/chat/client/message.rb +2 -1
- data/lib/oksky/chat/client/room.rb +1 -0
- data/lib/oksky/chat/client/suggestion.rb +1 -0
- data/lib/oksky/chat/client/support.rb +8 -8
- data/lib/oksky/chat/httpclient.rb +6 -1
- data/lib/oksky/chat/request.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208df13505446839f47a4328ede2afee77509917
|
4
|
+
data.tar.gz: b0f36264a40750e663664689a03c72016e0f99c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4308f0100d171a328b94fba1732b033f981413ff650ec3ce3dd17f241d74e9a01c8d04af015cac3539301f8fd85396556b26b9f1b4b7d143fc74f67adb6613
|
7
|
+
data.tar.gz: 39002fa802b66bf67ece97d4ce05159cf6a1f1cdba7de6b4204f92f02b83af0dcc0cb3de51a40bfdd3d94bd03e11d68d875f25c6176f1f0fec7b65e5f82cdff1
|
@@ -62,7 +62,7 @@ module Oksky
|
|
62
62
|
# @return [Oksky::Chat::Event::Message]
|
63
63
|
def get_message_content(message_id, option = {}, is_parse = true)
|
64
64
|
endpoint_path = "/messages/#{message_id}"
|
65
|
-
result = get(endpoint_path)
|
65
|
+
result = get(endpoint_path, option)
|
66
66
|
|
67
67
|
if is_parse
|
68
68
|
json = JSON.parse(result.body)
|
@@ -85,6 +85,7 @@ module Oksky
|
|
85
85
|
config.endpoint = endpoint
|
86
86
|
config.endpoint_path = endpoint_path
|
87
87
|
config.credentials = credentials
|
88
|
+
config.payload = option
|
88
89
|
end
|
89
90
|
|
90
91
|
request.get
|
@@ -42,9 +42,13 @@ module Oksky
|
|
42
42
|
|
43
43
|
if is_parse
|
44
44
|
json = JSON.parse(result.body)
|
45
|
-
json["data"].
|
46
|
-
|
47
|
-
|
45
|
+
if json.has_key?("data") && !json["data"].empty?
|
46
|
+
json["data"].map{|d|
|
47
|
+
Oksky::Chat::Event::Support.new(d)
|
48
|
+
}
|
49
|
+
else
|
50
|
+
return []
|
51
|
+
end
|
48
52
|
else
|
49
53
|
return result
|
50
54
|
end
|
@@ -75,16 +79,12 @@ module Oksky
|
|
75
79
|
def get(endpoint_path, option = {})
|
76
80
|
raise Oksky::Chat::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
|
77
81
|
|
78
|
-
unless option.empty?
|
79
|
-
params = URI.encode_www_form(option)
|
80
|
-
endpoint_path = "#{endpoint_path}?#{params}"
|
81
|
-
end
|
82
|
-
|
83
82
|
request = Request.new do |config|
|
84
83
|
config.httpclient = httpclient
|
85
84
|
config.endpoint = endpoint
|
86
85
|
config.endpoint_path = endpoint_path
|
87
86
|
config.credentials = credentials
|
87
|
+
config.payload = option
|
88
88
|
end
|
89
89
|
|
90
90
|
request.get
|
@@ -14,11 +14,16 @@ module Oksky
|
|
14
14
|
http.use_ssl = true
|
15
15
|
end
|
16
16
|
|
17
|
+
http.set_debug_output($stderr) if ENV["RAILS_ENV"] == "development"
|
18
|
+
|
17
19
|
http
|
18
20
|
end
|
19
21
|
|
20
|
-
def get(url, header = {})
|
22
|
+
def get(url, payload = {}, header = {})
|
21
23
|
uri = URI(url)
|
24
|
+
unless payload.empty?
|
25
|
+
uri.query = URI.encode_www_form(payload)
|
26
|
+
end
|
22
27
|
http(uri).get(uri.request_uri, header)
|
23
28
|
end
|
24
29
|
|
data/lib/oksky/chat/request.rb
CHANGED
@@ -17,7 +17,7 @@ module Oksky
|
|
17
17
|
|
18
18
|
# @return [Hash]
|
19
19
|
def payload
|
20
|
-
!@payload.empty? && @payload.kind_of?(Hash) ? @payload.delete_if{|k, v| v.nil?}
|
20
|
+
!@payload.empty? && @payload.kind_of?(Hash) ? @payload.delete_if{|k, v| v.nil?} : {}
|
21
21
|
end
|
22
22
|
|
23
23
|
# @return [Hash]
|
@@ -37,7 +37,7 @@ module Oksky
|
|
37
37
|
# @return [Net::HTTPResponse]
|
38
38
|
def get
|
39
39
|
assert_for_getting_message
|
40
|
-
httpclient.get(endpoint + endpoint_path, header)
|
40
|
+
httpclient.get(endpoint + endpoint_path, payload, header)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Post content of specified URL.
|
@@ -47,7 +47,7 @@ module Oksky
|
|
47
47
|
# @return [Net::HTTPResponse]
|
48
48
|
def post
|
49
49
|
assert_for_posting_message
|
50
|
-
httpclient.post(endpoint + endpoint_path, payload, header)
|
50
|
+
httpclient.post(endpoint + endpoint_path, payload.to_json, header)
|
51
51
|
end
|
52
52
|
|
53
53
|
def assert_for_getting_message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oksky-chat-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SOLAIRO, INC.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|