oksky-chat-api 0.2.2 → 0.2.7
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 +5 -5
- data/lib/oksky/chat/api/version.rb +1 -1
- data/lib/oksky/chat/httpclient.rb +10 -0
- data/lib/oksky/chat/object.rb +13 -1
- data/lib/oksky/chat/object/administrators_resource.rb +43 -0
- data/lib/oksky/chat/object/clients_resource.rb +70 -0
- data/lib/oksky/chat/object/customers_resource.rb +63 -0
- data/lib/oksky/chat/object/master_keywords_resource.rb +59 -0
- data/lib/oksky/chat/object/memos_resource.rb +62 -0
- data/lib/oksky/chat/object/messages_resource.rb +5 -5
- data/lib/oksky/chat/object/operators_resource.rb +48 -0
- data/lib/oksky/chat/object/rooms_resource.rb +20 -0
- data/lib/oksky/chat/object/suggestions_resource.rb +51 -0
- data/lib/oksky/chat/object/supervisors_resource.rb +42 -0
- data/lib/oksky/chat/object/support_draft_messages_resource.rb +97 -0
- data/lib/oksky/chat/object/supports_resource.rb +25 -0
- data/lib/oksky/chat/object/tracker_entries_resource.rb +88 -0
- data/lib/oksky/chat/object/user_events_resource.rb +62 -0
- data/lib/oksky/chat/object/user_infos_resource.rb +54 -0
- data/lib/oksky/chat/object/users_resource.rb +117 -0
- metadata +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad9e11a007058c413d64041781fb938590f26e8ff4e802105891e3eca07b2b3c
|
4
|
+
data.tar.gz: 4ed1d422f93ff14b5ea76b6681b8998aa4d267f35938958fb444fedbfd9e4b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0d3c380ea69475a6d9e90c4655abb93e01d01b55c081141e509ece3be8175c488e1f66d7efcad84c95a64e93d9b85d3750f223baf03a3c7dc076a62314edb2f
|
7
|
+
data.tar.gz: 8ae9f687f67b9006e6a0046a3287867eb7c7f168407aff5dbdb3e53f42abcd9a77e8ab3677b3c25878fa560cf685febd50453c947ebf09bc5133d3eae9fca0a6
|
@@ -32,6 +32,16 @@ module Oksky
|
|
32
32
|
http(uri).post(uri.request_uri, payload, header)
|
33
33
|
end
|
34
34
|
|
35
|
+
def put(url, payload, header = {})
|
36
|
+
uri = URI(url)
|
37
|
+
http(uri).put(uri.request_uri, payload, header)
|
38
|
+
end
|
39
|
+
|
40
|
+
def patch(url, payload, header = {})
|
41
|
+
uri = URI(url)
|
42
|
+
http(uri).patch(uri.request_uri, payload, header)
|
43
|
+
end
|
44
|
+
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
data/lib/oksky/chat/object.rb
CHANGED
@@ -3,4 +3,16 @@ require 'oksky/chat/object/messages_resource'
|
|
3
3
|
require 'oksky/chat/object/rooms_resource'
|
4
4
|
require 'oksky/chat/object/supports_resource'
|
5
5
|
require 'oksky/chat/object/unsupport_resource'
|
6
|
-
require 'oksky/chat/object/provider_rooms_resource'
|
6
|
+
require 'oksky/chat/object/provider_rooms_resource'
|
7
|
+
require 'oksky/chat/object/clients_resource'
|
8
|
+
require 'oksky/chat/object/users_resource'
|
9
|
+
require 'oksky/chat/object/administrators_resource'
|
10
|
+
require 'oksky/chat/object/operators_resource'
|
11
|
+
require 'oksky/chat/object/supervisors_resource'
|
12
|
+
require 'oksky/chat/object/customers_resource'
|
13
|
+
require 'oksky/chat/object/master_keywords_resource'
|
14
|
+
require 'oksky/chat/object/user_infos_resource'
|
15
|
+
require 'oksky/chat/object/tracker_entries_resource'
|
16
|
+
require 'oksky/chat/object/support_draft_messages_resource'
|
17
|
+
require 'oksky/chat/object/suggestions_resource'
|
18
|
+
require 'oksky/chat/object/user_events_resource'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class AdministratorsResource < UsersResource
|
5
|
+
|
6
|
+
# @return [Array]
|
7
|
+
def present_rooms
|
8
|
+
relationships.dig("present_rooms", "data")
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array]
|
12
|
+
def support_rooms
|
13
|
+
relationships.dig("support_rooms", "data")
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Array]
|
17
|
+
def members
|
18
|
+
relationships.dig("members", "data")
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Array]
|
22
|
+
def supports
|
23
|
+
relationships.dig("supports", "data")
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array]
|
27
|
+
def rooms
|
28
|
+
relationships.dig("rooms", "data")
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array]
|
32
|
+
def starred_rooms
|
33
|
+
relationships.dig("starred_rooms", "data")
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Array]
|
37
|
+
def starred_customers
|
38
|
+
relationships.dig("starred_customers", "data")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class ClientsResource < Base
|
5
|
+
|
6
|
+
def injectable_code
|
7
|
+
content_value("injectable_code")
|
8
|
+
end
|
9
|
+
|
10
|
+
def settings
|
11
|
+
content_value("settings")
|
12
|
+
end
|
13
|
+
|
14
|
+
def title
|
15
|
+
content_value("title")
|
16
|
+
end
|
17
|
+
|
18
|
+
def code
|
19
|
+
content_value("code")
|
20
|
+
end
|
21
|
+
|
22
|
+
def default_embedded_css
|
23
|
+
content_value("default_embedded_css")
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_guest_css
|
27
|
+
content_value("default_guest_css")
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_embedded_html
|
31
|
+
content_value("default_embedded_html")
|
32
|
+
end
|
33
|
+
|
34
|
+
def client
|
35
|
+
if @src.has_key?('attributes')
|
36
|
+
@src['attributes']
|
37
|
+
else
|
38
|
+
@src
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def relationships
|
43
|
+
if exist_relationships?
|
44
|
+
return @src['relationships']
|
45
|
+
else
|
46
|
+
{}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def exist_attributes?
|
52
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
53
|
+
end
|
54
|
+
|
55
|
+
def exist_relationships?
|
56
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
57
|
+
end
|
58
|
+
|
59
|
+
def content_value(key)
|
60
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
61
|
+
return @src['attributes']["#{key}"]
|
62
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
63
|
+
return @src["#{key}"]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class CustomersResource < UsersResource
|
5
|
+
|
6
|
+
# @return [Array]
|
7
|
+
def present_rooms
|
8
|
+
relationships.dig("present_rooms", "data")
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array]
|
12
|
+
def support_rooms
|
13
|
+
relationships.dig("support_rooms", "data")
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Array]
|
17
|
+
def members
|
18
|
+
relationships.dig("members", "data")
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Array]
|
22
|
+
def supports
|
23
|
+
relationships.dig("supports", "data")
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array]
|
27
|
+
def rooms
|
28
|
+
relationships.dig("rooms", "data")
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array]
|
32
|
+
def starred_rooms
|
33
|
+
relationships.dig("starred_rooms", "data")
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Array]
|
37
|
+
def starred_customers
|
38
|
+
relationships.dig("starred_customers", "data")
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Array]
|
42
|
+
def user_supported
|
43
|
+
relationships.dig("user_supported", "data")
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Array]
|
47
|
+
def memos
|
48
|
+
relationships.dig("memos", "data")
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Array]
|
52
|
+
def user_events
|
53
|
+
relationships.dig("user_events", "data")
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Array]
|
57
|
+
def user_infos
|
58
|
+
relationships.dig("user_infos", "data")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class MasterKeywordsResource < Base
|
5
|
+
|
6
|
+
def master_keyword
|
7
|
+
if @src.has_key?('attributes')
|
8
|
+
@src['attributes']
|
9
|
+
else
|
10
|
+
@src
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def key_name
|
15
|
+
content_value.dig("key_name")
|
16
|
+
end
|
17
|
+
|
18
|
+
def key_title
|
19
|
+
content_value.dig("key_title")
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Array]
|
23
|
+
def suggestions
|
24
|
+
content_value.dig("suggestions")
|
25
|
+
end
|
26
|
+
|
27
|
+
def relationships
|
28
|
+
if exist_relationships?
|
29
|
+
return @src['relationships']
|
30
|
+
else
|
31
|
+
{}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Array]
|
36
|
+
def user_infos
|
37
|
+
relationships.dig("user_infos", "data")
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def exist_attributes?
|
42
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
43
|
+
end
|
44
|
+
|
45
|
+
def exist_relationships?
|
46
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
47
|
+
end
|
48
|
+
|
49
|
+
def content_value(key)
|
50
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
51
|
+
return @src['attributes']["#{key}"]
|
52
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
53
|
+
return @src["#{key}"]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class MemosResource < Base
|
5
|
+
|
6
|
+
def resource_id
|
7
|
+
content_value("resource_id")
|
8
|
+
end
|
9
|
+
|
10
|
+
def resource_type
|
11
|
+
content_value("resource_type")
|
12
|
+
end
|
13
|
+
|
14
|
+
def user_id
|
15
|
+
content_value("user_id")
|
16
|
+
end
|
17
|
+
|
18
|
+
def text
|
19
|
+
content_value("text")
|
20
|
+
end
|
21
|
+
|
22
|
+
def created_at_unix
|
23
|
+
content_value("created_at_unix")
|
24
|
+
end
|
25
|
+
|
26
|
+
def memo
|
27
|
+
if @src.has_key?('attributes')
|
28
|
+
@src['attributes']
|
29
|
+
else
|
30
|
+
@src
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def relationships
|
35
|
+
if exist_relationships?
|
36
|
+
return @src['relationships']
|
37
|
+
else
|
38
|
+
{}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def exist_attributes?
|
44
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
45
|
+
end
|
46
|
+
|
47
|
+
def exist_relationships?
|
48
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
def content_value(key)
|
52
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
53
|
+
return @src['attributes']["#{key}"]
|
54
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
55
|
+
return @src["#{key}"]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -105,11 +105,11 @@ module Oksky
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def room_id
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
@src.dig("relationships", "room", "data", "id")
|
109
|
+
end
|
110
|
+
|
111
|
+
def user_id
|
112
|
+
@src.dig("relationships", "user", "data", "id")
|
113
113
|
end
|
114
114
|
|
115
115
|
def relationships
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class OperatorsResource < UsersResource
|
5
|
+
|
6
|
+
# @return [Array]
|
7
|
+
def present_rooms
|
8
|
+
relationships.dig("present_rooms", "data")
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array]
|
12
|
+
def support_rooms
|
13
|
+
relationships.dig("support_rooms", "data")
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [Array]
|
17
|
+
def members
|
18
|
+
relationships.dig("members", "data")
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Array]
|
22
|
+
def supports
|
23
|
+
relationships.dig("supports", "data")
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Array]
|
27
|
+
def rooms
|
28
|
+
relationships.dig("rooms", "data")
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array]
|
32
|
+
def starred_rooms
|
33
|
+
relationships.dig("starred_rooms", "data")
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Array]
|
37
|
+
def starred_customers
|
38
|
+
relationships.dig("starred_customers", "data")
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Array]
|
42
|
+
def reassign_requests
|
43
|
+
relationships.dig("reassign_requests", "data")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -83,6 +83,22 @@ module Oksky
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
def support_group_id
|
87
|
+
@src.dig("relationships", "relationships", "data", "id")
|
88
|
+
end
|
89
|
+
|
90
|
+
def create_user_id
|
91
|
+
@src.dig("relationships", "create_user", "data", "id")
|
92
|
+
end
|
93
|
+
|
94
|
+
def client_id
|
95
|
+
@src.dig("relationships", "client", "data", "id")
|
96
|
+
end
|
97
|
+
|
98
|
+
def helped_room_id
|
99
|
+
@src.dig("relationships", "helped_room", "data", "id")
|
100
|
+
end
|
101
|
+
|
86
102
|
def relationships
|
87
103
|
if exist_relationships?
|
88
104
|
return @src['relationships']
|
@@ -96,6 +112,10 @@ module Oksky
|
|
96
112
|
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
97
113
|
end
|
98
114
|
|
115
|
+
def exist_relationships?
|
116
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
117
|
+
end
|
118
|
+
|
99
119
|
def content_value(key)
|
100
120
|
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
101
121
|
return @src['attributes']["#{key}"]
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class SuggestionsResource < Base
|
5
|
+
|
6
|
+
# @return [Array]
|
7
|
+
def suggestion_messages_data
|
8
|
+
content_value("suggestion_messages_data")
|
9
|
+
end
|
10
|
+
|
11
|
+
def suggestion
|
12
|
+
if @src.has_key?('attributes')
|
13
|
+
@src['attributes']
|
14
|
+
else
|
15
|
+
@src
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def relationships
|
20
|
+
if exist_relationships?
|
21
|
+
return @src['relationships']
|
22
|
+
else
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def room_id
|
28
|
+
relationships.dig("room", "id")
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def exist_attributes?
|
33
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
def exist_relationships?
|
37
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
38
|
+
end
|
39
|
+
|
40
|
+
def content_value(key)
|
41
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
42
|
+
return @src['attributes']["#{key}"]
|
43
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
44
|
+
return @src["#{key}"]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class SupervisorsResource < UsersResource
|
5
|
+
# @return [Array]
|
6
|
+
def present_rooms
|
7
|
+
relationships.dig("present_rooms", "data")
|
8
|
+
end
|
9
|
+
|
10
|
+
# @return [Array]
|
11
|
+
def support_rooms
|
12
|
+
relationships.dig("support_rooms", "data")
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array]
|
16
|
+
def members
|
17
|
+
relationships.dig("members", "data")
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Array]
|
21
|
+
def supports
|
22
|
+
relationships.dig("supports", "data")
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Array]
|
26
|
+
def rooms
|
27
|
+
relationships.dig("rooms", "data")
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Array]
|
31
|
+
def starred_rooms
|
32
|
+
relationships.dig("starred_rooms", "data")
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Array]
|
36
|
+
def starred_customers
|
37
|
+
relationships.dig("starred_customers", "data")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class SupportDraftMessageResource < Base
|
5
|
+
|
6
|
+
def message_content
|
7
|
+
content_value("message_content")
|
8
|
+
end
|
9
|
+
|
10
|
+
def kind
|
11
|
+
content_value("kind")
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Hash]
|
15
|
+
def settings
|
16
|
+
content_value("settings")
|
17
|
+
end
|
18
|
+
|
19
|
+
# @return [String]
|
20
|
+
# in_review
|
21
|
+
def status
|
22
|
+
content_value("status")
|
23
|
+
end
|
24
|
+
|
25
|
+
def resolved_time_unix
|
26
|
+
content_value("resolved_time_unix")
|
27
|
+
end
|
28
|
+
|
29
|
+
def comment
|
30
|
+
content_value("comment")
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_user_resolved_read_time_unix
|
34
|
+
content_value("create_user_resolved_read_time_unix")
|
35
|
+
end
|
36
|
+
|
37
|
+
def created_at_unix
|
38
|
+
content_value("created_at_unix")
|
39
|
+
end
|
40
|
+
|
41
|
+
def updated_at_unix
|
42
|
+
content_value("updated_at_unix")
|
43
|
+
end
|
44
|
+
|
45
|
+
def support_draft_message
|
46
|
+
if @src.has_key?('attributes')
|
47
|
+
@src['attributes']
|
48
|
+
else
|
49
|
+
@src
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def relationships
|
54
|
+
if exist_relationships?
|
55
|
+
return @src['relationships']
|
56
|
+
else
|
57
|
+
{}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def support_id
|
62
|
+
relationships.dig("support", "data", "id")
|
63
|
+
end
|
64
|
+
|
65
|
+
def resolved_user_id
|
66
|
+
relationships.dig("resolved_user", "data", "id")
|
67
|
+
end
|
68
|
+
|
69
|
+
def created_user_id
|
70
|
+
relationships.dig("created_user", "data", "id")
|
71
|
+
end
|
72
|
+
|
73
|
+
def room_id
|
74
|
+
relationships.dig("room", "data", "id")
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
def exist_attributes?
|
79
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
80
|
+
end
|
81
|
+
|
82
|
+
def exist_relationships?
|
83
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
84
|
+
end
|
85
|
+
|
86
|
+
def content_value(key)
|
87
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
88
|
+
return @src['attributes']["#{key}"]
|
89
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
90
|
+
return @src["#{key}"]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -29,11 +29,36 @@ module Oksky
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
def user_id
|
33
|
+
relationships.dig("user", "data", "id")
|
34
|
+
end
|
35
|
+
|
36
|
+
def room_id
|
37
|
+
relationships.dig("room", "data", "id")
|
38
|
+
end
|
39
|
+
|
40
|
+
def latest_message_id
|
41
|
+
relationships.dig("latest_message", "data", "id")
|
42
|
+
end
|
43
|
+
|
44
|
+
def customer_id
|
45
|
+
relationships.dig("customer", "data", "id")
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Array]
|
49
|
+
def members
|
50
|
+
relationships.dig("members", "data")
|
51
|
+
end
|
52
|
+
|
32
53
|
private
|
33
54
|
def exist_attributes?
|
34
55
|
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
35
56
|
end
|
36
57
|
|
58
|
+
def exist_relationships?
|
59
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
60
|
+
end
|
61
|
+
|
37
62
|
def content_value(key)
|
38
63
|
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
39
64
|
return @src['attributes']["#{key}"]
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class TrackerEntriesResource < Base
|
5
|
+
|
6
|
+
# @return [String]
|
7
|
+
def time_unix
|
8
|
+
content_value("time_unix")
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Hash]
|
12
|
+
# "payload":{
|
13
|
+
# "ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
|
14
|
+
# "p":"Win32",
|
15
|
+
# "r":"",
|
16
|
+
# "l":"https://www.google.co.jp/?gfe_rd=cr&dcr=0&ei=2Qq-WtP_MPDd8Aebq6b4Bg&gws_rd=ssl",
|
17
|
+
# "t":1522404097400,
|
18
|
+
# "tz":"Asia/Tokyo"
|
19
|
+
# }
|
20
|
+
def payload
|
21
|
+
content_value("payload")
|
22
|
+
end
|
23
|
+
|
24
|
+
def user_uuid
|
25
|
+
content_value("user_uuid")
|
26
|
+
end
|
27
|
+
|
28
|
+
def t
|
29
|
+
content_value("t")
|
30
|
+
end
|
31
|
+
|
32
|
+
def ua
|
33
|
+
content_value("ua")
|
34
|
+
end
|
35
|
+
|
36
|
+
def p
|
37
|
+
content_value("p")
|
38
|
+
end
|
39
|
+
|
40
|
+
def r
|
41
|
+
content_value("r")
|
42
|
+
end
|
43
|
+
|
44
|
+
def l
|
45
|
+
content_value("l")
|
46
|
+
end
|
47
|
+
|
48
|
+
def tz
|
49
|
+
content_value("tz")
|
50
|
+
end
|
51
|
+
|
52
|
+
def tracker_entry
|
53
|
+
if @src.has_key?('attributes')
|
54
|
+
@src['attributes']
|
55
|
+
else
|
56
|
+
@src
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def relationships
|
61
|
+
if exist_relationships?
|
62
|
+
return @src['relationships']
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
def exist_attributes?
|
70
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
71
|
+
end
|
72
|
+
|
73
|
+
def exist_relationships?
|
74
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
75
|
+
end
|
76
|
+
|
77
|
+
def content_value(key)
|
78
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
79
|
+
return @src['attributes']["#{key}"]
|
80
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
81
|
+
return @src["#{key}"]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class UserEventsResource < Base
|
5
|
+
|
6
|
+
def resource_type
|
7
|
+
content_value("resource_type")
|
8
|
+
end
|
9
|
+
|
10
|
+
def kind
|
11
|
+
content_value("kind")
|
12
|
+
end
|
13
|
+
|
14
|
+
def resource_id
|
15
|
+
content_value("resource_id")
|
16
|
+
end
|
17
|
+
|
18
|
+
def created_at_unix
|
19
|
+
content_value("created_at_unix")
|
20
|
+
end
|
21
|
+
|
22
|
+
def user_event
|
23
|
+
if @src.has_key?('attributes')
|
24
|
+
@src['attributes']
|
25
|
+
else
|
26
|
+
@src
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def relationships
|
31
|
+
if exist_relationships?
|
32
|
+
return @src['relationships']
|
33
|
+
else
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def user_id
|
39
|
+
relationships.dig("user", "id")
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def exist_attributes?
|
44
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
45
|
+
end
|
46
|
+
|
47
|
+
def exist_relationships?
|
48
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
def content_value(key)
|
52
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
53
|
+
return @src['attributes']["#{key}"]
|
54
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
55
|
+
return @src["#{key}"]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class UserInfosResource < Base
|
5
|
+
|
6
|
+
def value_data
|
7
|
+
content_value("value_data")
|
8
|
+
end
|
9
|
+
|
10
|
+
def user_info
|
11
|
+
if @src.has_key?('attributes')
|
12
|
+
@src['attributes']
|
13
|
+
else
|
14
|
+
@src
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def relationships
|
19
|
+
if exist_relationships?
|
20
|
+
return @src['relationships']
|
21
|
+
else
|
22
|
+
{}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def user_id
|
27
|
+
relationships.dig("user", "data", "id")
|
28
|
+
end
|
29
|
+
|
30
|
+
def master_keyword_id
|
31
|
+
relationships.dig("master_keyword", "data", "id")
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def exist_attributes?
|
36
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
37
|
+
end
|
38
|
+
|
39
|
+
def exist_relationships?
|
40
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def content_value(key)
|
44
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
45
|
+
return @src['attributes']["#{key}"]
|
46
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
47
|
+
return @src["#{key}"]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Oksky
|
2
|
+
module Chat
|
3
|
+
module Object
|
4
|
+
class UsersResource < Base
|
5
|
+
|
6
|
+
def uuid
|
7
|
+
content_value("uuid")
|
8
|
+
end
|
9
|
+
|
10
|
+
def username
|
11
|
+
content_value("username")
|
12
|
+
end
|
13
|
+
|
14
|
+
def full_name
|
15
|
+
content_value("full_name")
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
content_value("name")
|
20
|
+
end
|
21
|
+
|
22
|
+
def gravatar_id
|
23
|
+
content_value("gravatar_id")
|
24
|
+
end
|
25
|
+
|
26
|
+
def email
|
27
|
+
content_value("email")
|
28
|
+
end
|
29
|
+
|
30
|
+
def avatar_url
|
31
|
+
content_value("avatar_url")
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_avatar_url
|
35
|
+
content_value("default_avatar_url")
|
36
|
+
end
|
37
|
+
|
38
|
+
def user_type
|
39
|
+
content_value("user_type")
|
40
|
+
end
|
41
|
+
|
42
|
+
def status
|
43
|
+
content_value("status")
|
44
|
+
end
|
45
|
+
|
46
|
+
def max_support_count
|
47
|
+
content_value("max_support_count")
|
48
|
+
end
|
49
|
+
|
50
|
+
def timezone
|
51
|
+
content_value("timezone")
|
52
|
+
end
|
53
|
+
|
54
|
+
def in_training
|
55
|
+
content_value("in_training")
|
56
|
+
end
|
57
|
+
|
58
|
+
def login_count
|
59
|
+
content_value("login_count")
|
60
|
+
end
|
61
|
+
|
62
|
+
def is_active
|
63
|
+
content_value("is_active")
|
64
|
+
end
|
65
|
+
|
66
|
+
def created_at
|
67
|
+
content_value("created_at")
|
68
|
+
end
|
69
|
+
|
70
|
+
def created_at_unix
|
71
|
+
content_value("created_at_unix")
|
72
|
+
end
|
73
|
+
|
74
|
+
def user_typings
|
75
|
+
content_value("user_typings")
|
76
|
+
end
|
77
|
+
|
78
|
+
def language
|
79
|
+
content_value("language")
|
80
|
+
end
|
81
|
+
|
82
|
+
def user
|
83
|
+
if @src.has_key?('attributes')
|
84
|
+
@src['attributes']
|
85
|
+
else
|
86
|
+
@src
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def relationships
|
91
|
+
if exist_relationships?
|
92
|
+
return @src['relationships']
|
93
|
+
else
|
94
|
+
{}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
def exist_attributes?
|
100
|
+
!@src.empty? && @src.has_key?('attributes') && !@src['attributes'].empty?
|
101
|
+
end
|
102
|
+
|
103
|
+
def exist_relationships?
|
104
|
+
!@src.empty? && @src.has_key?('relationships') && !@src['relationships'].empty?
|
105
|
+
end
|
106
|
+
|
107
|
+
def content_value(key)
|
108
|
+
if exist_attributes? && @src['attributes'].has_key?("#{key}") && !@src['attributes']["#{key}"].empty?
|
109
|
+
return @src['attributes']["#{key}"]
|
110
|
+
elsif @src.has_key?("#{key}") && !@src["#{key}"].empty?
|
111
|
+
return @src["#{key}"]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
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.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SOLAIRO, INC.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,12 +110,25 @@ files:
|
|
110
110
|
- lib/oksky/chat/client.rb
|
111
111
|
- lib/oksky/chat/httpclient.rb
|
112
112
|
- lib/oksky/chat/object.rb
|
113
|
+
- lib/oksky/chat/object/administrators_resource.rb
|
113
114
|
- lib/oksky/chat/object/base.rb
|
115
|
+
- lib/oksky/chat/object/clients_resource.rb
|
116
|
+
- lib/oksky/chat/object/customers_resource.rb
|
117
|
+
- lib/oksky/chat/object/master_keywords_resource.rb
|
118
|
+
- lib/oksky/chat/object/memos_resource.rb
|
114
119
|
- lib/oksky/chat/object/messages_resource.rb
|
120
|
+
- lib/oksky/chat/object/operators_resource.rb
|
115
121
|
- lib/oksky/chat/object/provider_rooms_resource.rb
|
116
122
|
- lib/oksky/chat/object/rooms_resource.rb
|
123
|
+
- lib/oksky/chat/object/suggestions_resource.rb
|
124
|
+
- lib/oksky/chat/object/supervisors_resource.rb
|
125
|
+
- lib/oksky/chat/object/support_draft_messages_resource.rb
|
117
126
|
- lib/oksky/chat/object/supports_resource.rb
|
127
|
+
- lib/oksky/chat/object/tracker_entries_resource.rb
|
118
128
|
- lib/oksky/chat/object/unsupport_resource.rb
|
129
|
+
- lib/oksky/chat/object/user_events_resource.rb
|
130
|
+
- lib/oksky/chat/object/user_infos_resource.rb
|
131
|
+
- lib/oksky/chat/object/users_resource.rb
|
119
132
|
- lib/oksky/chat/request.rb
|
120
133
|
- lib/oksky/chat/whclient.rb
|
121
134
|
- oksky-chat-api.gemspec
|
@@ -138,8 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
151
|
- !ruby/object:Gem::Version
|
139
152
|
version: '0'
|
140
153
|
requirements: []
|
141
|
-
|
142
|
-
rubygems_version: 2.6.11
|
154
|
+
rubygems_version: 3.0.3
|
143
155
|
signing_key:
|
144
156
|
specification_version: 4
|
145
157
|
summary: ''
|