lifen 1.2.0 → 1.3.0

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
  SHA1:
3
- metadata.gz: 892ab61ff3b07c5171f3627d98eebcf2ec772a87
4
- data.tar.gz: eaadb00f864025512401a0f095d4f162f6e710c3
3
+ metadata.gz: b4f6a2bcc4a95dc803258ac22cbcbdf5aee81a88
4
+ data.tar.gz: 02d67533b4e1d82d924bee7bba2091ce0c407417
5
5
  SHA512:
6
- metadata.gz: 458453b20d8211dc2bf8a0369ab3a3683f4a68cc5a289e8cac6c35c9f10d4127e98036258092f3ac6a76526d933904e1544fed7405031c8c0910aa782312f8d7
7
- data.tar.gz: 7c6f77974e97e926cbb934aaf9b5874c7570baca6ac6db9482b33ea22a286dd55ae7f6f6d050f79ff17c69ffaacdc4ccfc9d9613c9fb3cafdcf8e9c2534a60ff
6
+ metadata.gz: 846793b6866706aea642508cf5f8621417eb58133aabccf3b63c053efa96628143661171ff449c30f8a8e9fca5ce25ac638124631fd3008e60c5358c2c7133ca
7
+ data.tar.gz: 2bd8188f21635e003fcde565a2201edcb6668a1c42a1a960813b090d7a08e8ea17cf0daeafffacb4846778107be577b4015dd8bce1af1bf8c853d07b51cfac7c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.3.0
2
+ -----
3
+
4
+ - Added flow update
5
+
1
6
  1.2.0
2
7
  -----
3
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lifen (1.2.0)
4
+ lifen (1.3.0)
5
5
  faraday (>= 0.9)
6
6
  inflecto
7
7
  virtus (>= 1.0)
data/README.md CHANGED
@@ -69,6 +69,7 @@ flow = Lifen::Flow.new(user: user, title: "honestica Rocks !")
69
69
  flow.create
70
70
  flow.attach_users(user)
71
71
  flow.detach_users(user)
72
+ flow.save
72
73
 
73
74
  # alternate strategy
74
75
  flow = Lifen::Flow.new(user: user, title: "honestica Rocks !", users: [user_1, user_2])
data/lib/lifen/client.rb CHANGED
@@ -25,6 +25,10 @@ module Lifen
25
25
  request(:post, url, params)
26
26
  end
27
27
 
28
+ def put(url, params = {})
29
+ request(:put, url, params)
30
+ end
31
+
28
32
  def get(url, params = {})
29
33
  request(:get, url, params)
30
34
  end
data/lib/lifen/flow.rb CHANGED
@@ -28,6 +28,14 @@ module Lifen
28
28
  self
29
29
  end
30
30
 
31
+ def save
32
+ params = {title: title, uuid: uuid}
33
+
34
+ json = client.put("central/api/chats/#{uuid}", params)
35
+
36
+ self.title = json["title"]
37
+ end
38
+
31
39
  def attach_users(users_to_attach)
32
40
  params = extract_users_uuids(users_to_attach)
33
41
 
data/lib/lifen/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lifen
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://develop.lifen.fr/central/api/chats/11e6c916-efae-4e35-8c16-0242ac110002
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"title":"New title","uuid":"11e6c916-efae-4e35-8c16-0242ac110002"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.10.0
12
+ Authorization:
13
+ - Bearer valid_token
14
+ Content-Type:
15
+ - application/json
16
+ Accept:
17
+ - application/json
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - Apache-Coyote/1.1
27
+ X-B3-Sampled:
28
+ - '1'
29
+ X-B3-Spanid:
30
+ - 3edad02968708a1
31
+ X-B3-Traceid:
32
+ - 3edad02968708a1
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ Cache-Control:
38
+ - no-cache, no-store, max-age=0, must-revalidate
39
+ Pragma:
40
+ - no-cache
41
+ Expires:
42
+ - '0'
43
+ Content-Type:
44
+ - application/json;charset=UTF-8
45
+ Transfer-Encoding:
46
+ - chunked
47
+ Date:
48
+ - Fri, 23 Dec 2016 15:04:59 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"uuid":"11e6c916-efae-4e35-8c16-0242ac110002","version":2,"title":"New
54
+ title","type":"regular"}'
55
+ http_version:
56
+ recorded_at: Fri, 23 Dec 2016 15:04:11 GMT
57
+ recorded_with: VCR 3.0.3
data/spec/flows_spec.rb CHANGED
@@ -110,6 +110,22 @@ describe Lifen::Flow do
110
110
  end
111
111
  end
112
112
 
113
+ describe 'save' do
114
+
115
+ let(:flow) { Lifen::Flow.new(user: user, uuid: "11e6c916-efae-4e35-8c16-0242ac110002") }
116
+
117
+ it 'updates the title' do
118
+
119
+ flow.title = "New title"
120
+
121
+ VCR.use_cassette "flows/update_valid_title" do
122
+ flow.save
123
+ end
124
+
125
+ expect(flow.title).to eq "New title"
126
+ end
127
+ end
128
+
113
129
  describe 'attach_users' do
114
130
 
115
131
  # let(:valid_token_value) { "REPLACE_ME" }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Etienne Depaulis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-19 00:00:00.000000000 Z
11
+ date: 2016-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -177,6 +177,7 @@ files:
177
177
  - spec/cassettes/flows/internal_error.yml
178
178
  - spec/cassettes/flows/internal_error_without_trace_id.yml
179
179
  - spec/cassettes/flows/invalid_token.yml
180
+ - spec/cassettes/flows/update_valid_title.yml
180
181
  - spec/cassettes/flows/valid_token.yml
181
182
  - spec/cassettes/messages/valid_message.yml
182
183
  - spec/cassettes/settings/initial_state.yml
@@ -231,6 +232,7 @@ test_files:
231
232
  - spec/cassettes/flows/internal_error.yml
232
233
  - spec/cassettes/flows/internal_error_without_trace_id.yml
233
234
  - spec/cassettes/flows/invalid_token.yml
235
+ - spec/cassettes/flows/update_valid_title.yml
234
236
  - spec/cassettes/flows/valid_token.yml
235
237
  - spec/cassettes/messages/valid_message.yml
236
238
  - spec/cassettes/settings/initial_state.yml