layer-ruby 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/layer/conversation.rb +41 -2
- data/lib/layer/identity.rb +11 -0
- data/lib/layer/version.rb +1 -1
- 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: 7e330978c530e5b073e3862a781956883f1a5e3c
|
4
|
+
data.tar.gz: f6ddf78a841b10618b5dd7063b33d8df3c49a96d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560c1c59d76250aee0b52c380de3c21fea72505210bc2b45b983de91b7c2b36f75c0fc811c1acc53b84aca9d51c35f541b8363bd3aa24cd012b186f252420a48
|
7
|
+
data.tar.gz: 3d24d1e1d13e454002950057ba82bed4f25c1f26a0ea40199c802125c4f49c764bedd7f868544a55e6311f3bb5567fd8e4706fe8a4f0b9b1c4543380c7df0976
|
data/lib/layer/conversation.rb
CHANGED
@@ -25,8 +25,31 @@ module Layer
|
|
25
25
|
# @!parse extend Layer::Operations::Find::ClassMethods
|
26
26
|
# @!parse extend Layer::Operations::Paginate::ClassMethods
|
27
27
|
# @!parse extend Layer::Operations::Create::ClassMethods
|
28
|
-
|
29
|
-
#
|
28
|
+
|
29
|
+
# Deletes the resource with the given id
|
30
|
+
#
|
31
|
+
# In the REST API, this deletes the conversation for the current user only
|
32
|
+
#
|
33
|
+
# @param id [String] the resource's id
|
34
|
+
# @param options [Hash] the options for the delete request (REST API only: `leave: true/false`, `mode: all_participants/my_devices`)
|
35
|
+
# @param client [Layer::Client] the client to use to make this request
|
36
|
+
# @raise [Layer::Exceptions::Exception] a subclass of Layer::Exceptions::Exception describing the error
|
37
|
+
def self.delete(id, options = {}, client = self.client)
|
38
|
+
id = Layer::Client.normalize_id(id)
|
39
|
+
options = { mode: :my_devices }.merge(options)
|
40
|
+
client.delete("#{url}/#{id}", {}, { params: options })
|
41
|
+
end
|
42
|
+
|
43
|
+
# Destroys the resource with the given id
|
44
|
+
#
|
45
|
+
# In the REST API, this deletes the conversation for everyone
|
46
|
+
#
|
47
|
+
# @param id [String] the resource's id
|
48
|
+
# @param client [Layer::Client] the client to use to make this request
|
49
|
+
# @raise [Layer::Exceptions::Exception] a subclass of Layer::Exceptions::Exception describing the error
|
50
|
+
def self.destroy(id, client = self.client)
|
51
|
+
delete(id, { mode: :all_participants }, client)
|
52
|
+
end
|
30
53
|
|
31
54
|
# Returns the conversations messages
|
32
55
|
#
|
@@ -87,5 +110,21 @@ module Layer
|
|
87
110
|
Time.parse(attributes['created_at'])
|
88
111
|
end
|
89
112
|
|
113
|
+
# Destroys the conversation, removing it for everyone
|
114
|
+
#
|
115
|
+
# @raise [Layer::Exceptions::Exception] a subclass of Layer::Exceptions::Exception describing the error
|
116
|
+
def destroy
|
117
|
+
delete(mode: :all_participants)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deletes the conversation, removing it from the user's devices by default
|
121
|
+
#
|
122
|
+
# @param options [Hash] the options for the delete request (REST API only: `leave: true/false`, `mode: all_participants/my_devices`)
|
123
|
+
# @raise [Layer::Exceptions::Exception] a subclass of Layer::Exceptions::Exception describing the error
|
124
|
+
def delete(options = {})
|
125
|
+
options = { mode: :my_devices }.merge(options)
|
126
|
+
client.delete(url, {}, { params: options })
|
127
|
+
end
|
128
|
+
|
90
129
|
end
|
91
130
|
end
|
data/lib/layer/identity.rb
CHANGED
@@ -17,5 +17,16 @@ module Layer
|
|
17
17
|
def self.url
|
18
18
|
'/identity'
|
19
19
|
end
|
20
|
+
|
21
|
+
def attributes=(attributes)
|
22
|
+
attributes['metadata'] ||= {}
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def metadata=(metadata)
|
27
|
+
metadata.each_pair do |key, value|
|
28
|
+
self.metadata[key] = value
|
29
|
+
end
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
data/lib/layer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: layer-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benedikt Deicke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|