circuit-api 0.0.11 → 0.0.17

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
  SHA256:
3
- metadata.gz: 5f51ac41685250391f61c4675420a1ea31ed345aa6e3c0bce2679c8b5041afdc
4
- data.tar.gz: 47d3c637f4f7571cd0b3875832e27cacd952ad09e647d5ba39d5ed04c39e043b
3
+ metadata.gz: 4b6d0119111f8102ce77f7f647ce2e2cae2e99cd35b9ceac6caddf932a18677f
4
+ data.tar.gz: eba2f93b43db5d385b82e7d977363d5e9b56f7d996cea75ab3c9c51bc6c88d56
5
5
  SHA512:
6
- metadata.gz: 9b324718ad1c75c3817c8f5179c56397ae09fb2757aaaf1c4d66d2ba7f87cc5258d155672e0f30726e14c5b3c1cca7343ea3ab99f28d66b66c7502ff6b0a20fb
7
- data.tar.gz: 163ae15aae5ef12129726d4329c734f19ff662aca990f1f472b02c3caff1b7016da385fcec6107435fefb9c13733e3aa8e32b459b1ceffdc395eaf2548d2f075
6
+ metadata.gz: 7f86818766f5477878dd2a66426dec666be98f285b121783ceea1801d0caa3f9f25a08dea6b18831c6f8f6e1bc618ee4c23bbbc00bc7ab9139380a6b6edb800c
7
+ data.tar.gz: 35fbe9b9f535319b520d7ed5e1946529ce40d205f9512308bff54d2b1a0a807264afdd588257e5379a9041195c581721394199c740d41f1ee5409a763b9974f4
@@ -14,6 +14,7 @@ require 'circuit_api/utils/object'
14
14
  require 'circuit_api/resources/base'
15
15
  require 'circuit_api/resources/conversation'
16
16
  require 'circuit_api/resources/label'
17
+ require 'circuit_api/resources/message_item'
17
18
  require 'circuit_api/resources/message'
18
19
  require 'circuit_api/resources/presence'
19
20
  require 'circuit_api/resources/rtc_session'
@@ -37,6 +37,10 @@ module CircuitApi
37
37
  CircuitApi::Resources::Message.new(self)
38
38
  end
39
39
 
40
+ def message_items
41
+ CircuitApi::Resources::MessageItem.new(self)
42
+ end
43
+
40
44
  def presence
41
45
  CircuitApi::Resources::Presence.new(self)
42
46
  end
@@ -1,6 +1,11 @@
1
1
  module CircuitApi
2
2
  module Resources
3
3
  class Conversation < Base
4
+ DIRECT = 'DIRECT'.freeze
5
+ GROUP = 'GROUP'.freeze
6
+ COMMUNITY = 'COMMUNITY'.freeze
7
+ LARGE = 'LARGE'.freeze
8
+
4
9
  def api_resource
5
10
  'conversations'
6
11
  end
@@ -0,0 +1,101 @@
1
+ module CircuitApi
2
+ module Resources
3
+ class MessageItem < Base
4
+ def api_resource
5
+ 'conversations/:conversation_id/messages/:id'
6
+ end
7
+
8
+ def find(id)
9
+ path = api_resource
10
+ .sub(':conversation_id/', '')
11
+ .sub(':id', id)
12
+
13
+ result = connection(path).get
14
+ response_to_object(result)
15
+ end
16
+
17
+ def all(conversation_id, params = {})
18
+ path = api_resource
19
+ .sub(':conversation_id', conversation_id)
20
+ .sub('messages/:id', 'items')
21
+
22
+ result = connection(path, params).get
23
+ response_to_object(result)
24
+ end
25
+
26
+ def update(conversation_id, id, params)
27
+ path = api_resource
28
+ .sub(':conversation_id', conversation_id)
29
+ .sub(':id', id)
30
+
31
+ result = connection(path, params).put
32
+ response_to_object(result)
33
+ end
34
+
35
+ def delete(conversation_id, id)
36
+ path = api_resource
37
+ .sub(':conversation_id', conversation_id)
38
+ .sub(':id', id)
39
+
40
+ result = connection(path).delete
41
+ response_to_object(result)
42
+ end
43
+
44
+ def pin(conversation_id, id)
45
+ path = api_resource
46
+ .sub(':conversation_id', conversation_id)
47
+ .sub('messages', 'pins')
48
+ .sub(':id', id)
49
+
50
+ result = connection(path).post
51
+ response_to_object(result)
52
+ end
53
+
54
+ def unpin(conversation_id, id)
55
+ path = api_resource
56
+ .sub(':conversation_id', conversation_id)
57
+ .sub('messages', 'pins')
58
+ .sub(':id', id)
59
+
60
+ result = connection(path).delete
61
+ response_to_object(result)
62
+ end
63
+
64
+ def flag(conversation_id, id, params)
65
+ path = api_resource
66
+ .sub(':conversation_id', conversation_id)
67
+ .sub(':id', id)
68
+
69
+ result = connection("#{path}/flag", params).post
70
+ response_to_object(result)
71
+ end
72
+
73
+ def unflag(conversation_id, id)
74
+ path = api_resource
75
+ .sub(':conversation_id', conversation_id)
76
+ .sub(':id', id)
77
+
78
+ result = connection("#{path}/flag").delete
79
+ response_to_object(result)
80
+ end
81
+
82
+ def like(conversation_id, id)
83
+ path = api_resource
84
+ .sub(':conversation_id', conversation_id)
85
+ .sub(':id', id)
86
+
87
+ result = connection("#{path}/like").post
88
+ response_to_object(result)
89
+ end
90
+
91
+ def unlike(conversation_id, id)
92
+ path = api_resource
93
+ .sub(':conversation_id', conversation_id)
94
+ .sub(':id', id)
95
+
96
+ result = connection("#{path}/like").delete
97
+ response_to_object(result)
98
+ end
99
+ end
100
+ end
101
+ end
@@ -1,6 +1,12 @@
1
1
  module CircuitApi
2
2
  module Resources
3
3
  class User < Base
4
+ REGULAR = 'REGULAR'.freeze
5
+ MODERATOR = 'MODERATOR'.freeze
6
+ GUEST = 'GUEST'.freeze
7
+ FORMER = 'FORMER'.freeze
8
+ BOT = 'BOT'.freeze
9
+
4
10
  def api_resource
5
11
  'users'
6
12
  end
@@ -1,6 +1,12 @@
1
1
  module CircuitApi
2
2
  module Resources
3
3
  class Webhook < Base
4
+ CONVERSATION_CREATE = 'CONVERSATION.CREATE'.freeze
5
+ CONVERSATION_UPDATE = 'CONVERSATION.UPDATE'.freeze
6
+ CONVERSATION_ADD_ITEM = 'CONVERSATION.ADD_ITEM'.freeze
7
+ CONVERSATION_UPDATE_ITEM = 'CONVERSATION.UPDATE_ITEM'.freeze
8
+ USER_SUBMIT_FORM = 'USER.SUBMIT_FORM_DATA'.freeze
9
+
4
10
  def api_resource
5
11
  'webhooks'
6
12
  end
@@ -1,3 +1,3 @@
1
1
  module CircuitApi
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuit-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Pochet
@@ -93,6 +93,7 @@ files:
93
93
  - lib/circuit_api/resources/conversation.rb
94
94
  - lib/circuit_api/resources/label.rb
95
95
  - lib/circuit_api/resources/message.rb
96
+ - lib/circuit_api/resources/message_item.rb
96
97
  - lib/circuit_api/resources/presence.rb
97
98
  - lib/circuit_api/resources/rtc_session.rb
98
99
  - lib/circuit_api/resources/user.rb
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  - !ruby/object:Gem::Version
122
123
  version: '0'
123
124
  requirements: []
124
- rubygems_version: 3.0.1
125
+ rubygems_version: 3.1.4
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: Circuit Rest API client