forest_liana 1.3.2 → 1.3.3

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: 023deb01e5ab6c3d680e2012bae8d934880a14d3
4
- data.tar.gz: 3339ad13dcec8a4e67939685780edc35d1c2bccd
3
+ metadata.gz: 0a7a2f5a3320218ddd3d59f8d36d9b020cf39137
4
+ data.tar.gz: 6c9c357d204a9fda74ea7273817d2c963ce8f86d
5
5
  SHA512:
6
- metadata.gz: 5fefe8dd56b61d94393ba5980749faac50f324403dd19bade79b27267e248029f476619ecf5fc51f7e49a562a6f2d4442665f9e9172ed13ec370369e47452b0d
7
- data.tar.gz: e16bd6f6fbf17b4f6f814307e83cf7b54eed5eb88574447cb984d633554d3700426e7064b30b53bb6fdd52268ab8218d94104a68833b484fbc26416a81f6ce07
6
+ metadata.gz: 466f3c4532953d29e9793c3781f41270437e6fd040d2ba0c0674a281fe698e19d35f188bf4b9a0c4daea847b560ae06e33dd9a4187db5ccf210dd6c43af60365
7
+ data.tar.gz: 0eb9233d1138374f2da4726369768e8698194535a11cdbd33e2fcf299ed420cbf07c10b9a1dcf927a14e11b8f43ce7dacdc788c6f1e2590a1dbf75c6fe03b044
@@ -16,13 +16,12 @@ module ForestLiana
16
16
  private
17
17
 
18
18
  def fetch_allowed_users
19
- AllowedUsersGetter.new.perform
19
+ AllowedUsersGetter.new.perform(params['renderingId'])
20
20
  end
21
21
 
22
22
  def check_user
23
23
  ForestLiana.allowed_users.find do |allowed_user|
24
24
  allowed_user['email'] == params['email'] &&
25
- allowed_user['outlines'].include?(params['outlineId']) &&
26
25
  BCrypt::Password.new(allowed_user['password']) == params['password']
27
26
  end
28
27
  end
@@ -39,10 +38,10 @@ module ForestLiana
39
38
  last_name: user['last_name']
40
39
  },
41
40
  relationships: {
42
- outlines: {
41
+ renderings: {
43
42
  data: [{
44
- type: 'outlines',
45
- id: params['outlineId']
43
+ type: 'renderings',
44
+ id: params['renderingId']
46
45
  }]
47
46
  }
48
47
  }
@@ -1,7 +1,7 @@
1
1
  module ForestLiana
2
2
  class AllowedUsersGetter
3
- def perform
4
- uri = URI.parse("#{forest_url}/forest/allowed-users")
3
+ def perform(renderingId)
4
+ uri = URI.parse("#{forest_url}/forest/renderings/#{renderingId}/allowed-users")
5
5
  http = Net::HTTP.new(uri.host, uri.port)
6
6
  http.use_ssl = true if forest_url.start_with?('https')
7
7
  http.start do |client|
@@ -11,13 +11,10 @@ module ForestLiana
11
11
  response = client.request(request)
12
12
 
13
13
  if response.is_a?(Net::HTTPOK)
14
- body = JSON.parse(response.body)['data']
15
- ForestLiana.allowed_users = body.map do |d|
14
+ body = JSON.parse(response.body)
15
+ ForestLiana.allowed_users = body['data'].map do |d|
16
16
  user = d['attributes']
17
17
  user['id'] = d['id']
18
- user['outlines'] = d['relationships']['outlines']['data'].map {
19
- |x| x['id']
20
- }
21
18
 
22
19
  user
23
20
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails