layer-ruby 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/layer/client.rb +8 -2
- data/lib/layer/operations/delete.rb +1 -0
- data/lib/layer/operations/find.rb +1 -1
- 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: 1175f3c645d381961648fee03212ff4148a4cce7
|
4
|
+
data.tar.gz: 57265f20d7c15ff918cd4e96b34c0211b1b8c488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 419b39243567daeaca8e3b18ede67330b460f8dd478b4851cb1afb6e4529af84f33807b618909e66d5e477caf9c9c01c25d77326a4cef8a2cad3c4b0cbe0d726
|
7
|
+
data.tar.gz: e9a09eb831bd7759f177397c8e9a9e9fd301c793f833dd68a9a2367d7d27156a282d5add4371b6dddbb5a2d58062a7c45dab8ca567440f15994b0e9417021160
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ conversation = Layer::Conversation.find('CONVERSATION_ID_HERE')
|
|
59
59
|
conversation.messages.create({ sender: { name: 'Server' }, parts: [{ body: 'Hello!', mime_type: 'text/plain' }])
|
60
60
|
```
|
61
61
|
|
62
|
-
### Sending
|
62
|
+
### Sending Announcements
|
63
63
|
|
64
64
|
You can send a announcements like this:
|
65
65
|
|
data/lib/layer/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rest-client'
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
module Layer
|
4
5
|
class Client
|
@@ -16,12 +17,16 @@ module Layer
|
|
16
17
|
def configure
|
17
18
|
yield self
|
18
19
|
end
|
20
|
+
|
21
|
+
def normalize_id(id)
|
22
|
+
id.to_s.split('/').last
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
attr_reader :app_id, :token
|
22
27
|
|
23
28
|
def initialize(app_id = self.class.app_id, token = self.class.token)
|
24
|
-
@app_id = app_id
|
29
|
+
@app_id = self.class.normalize_id(app_id)
|
25
30
|
@token = token
|
26
31
|
end
|
27
32
|
|
@@ -61,7 +66,8 @@ module Layer
|
|
61
66
|
headers = {
|
62
67
|
'Authorization' => "Bearer #{token}",
|
63
68
|
'Accept' => 'application/vnd.layer+json; version=1.0',
|
64
|
-
'Content-Type' => 'application/json'
|
69
|
+
'Content-Type' => 'application/json',
|
70
|
+
'If-None-Match' => SecureRandom.uuid
|
65
71
|
}.merge(headers)
|
66
72
|
|
67
73
|
payload = payload.to_json
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benedikt Deicke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|