yaccl 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWI2YmU0MjQ1N2Y3ZjEzMzc1MzU2ZmYxMmE2NmYxMjM4NTFjM2ExYg==
4
+ ZWFlZTRhYTExOGExZTYyNzczZDZmYTA5Mzc1NDJiYmJjMjk1NDEzYg==
5
5
  data.tar.gz: !binary |-
6
- OWEzZTlkMzcyYWVmYTBkYjM5NzEyNTdhNThhMzFiYjU2NmNjNTcwOQ==
6
+ OGI5ZjFlZTg4MjM5ZmY0MDlkMmUzZjQ5NDFjMmQ5NTZhMzk4MzkwNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDM5M2U4NDIxNjZjZmIwNTNjMmE3ZGJlZTFmMWIzZTRjMzQyMWNhNDhkMjUy
10
- MGQ4NzY3MmVlZGQwYzk4MzUzZWUwOTYwNTZjYjBkZTFkOGNmOWI0ZjI2ZWFl
11
- ODg3OGQwOTE4NDMyMWU2OTBiZjdhZjE4ZGQwOTdmYmVmMGQ3MGM=
9
+ Zjc0ZmZiNmI3ZDUyMDExNjYyMGIyMzk1NDY2NmEwZTI5MzNkYjliOGIzMmIw
10
+ OTgxMjJkMzQwMzYyYzU2MTQyZjc3MzQ0ZjQ2ZGQzZWExNjRiZmM3N2Q5YmFh
11
+ OWYzZTM0NGM0YWViODhlMmZlNTljYjRhZjJlZTc0YjkyNWJjM2Y=
12
12
  data.tar.gz: !binary |-
13
- MGQ2Y2Y2MTU3MmQzNzExMWQ2MDZhMDBjOGY1MThhMzA2YTJkZjlkYmZkOGMw
14
- MWYyZTAzYTdkMjFhNWZhZmYxMTEyNzNiNzA3MmI4MTdmZDFiOTJmOWRkNGVl
15
- OGNjNDYzYjQ2MWJkM2ZmMDc3OWUxNTQ3NjRmOTdlZDM0YmFlYTE=
13
+ MDhlZTBkZTViOTYxNzA1MmZmODk4NmJlZDUwNDRiMTllZTU0NzhhZjA1NmYx
14
+ NTNiODBlOTU4MzVhNTU3YWI4NzhkNzRhMDI2OTgxOGVkZjIwYzNmNWRlNjE1
15
+ NjQyZTAxODA2NWYzMTU5ODQ2OGY1Y2RiOTk2YzU3Yjc0YjdkYTg=
@@ -1,7 +1,7 @@
1
1
  require 'httparty'
2
2
  require 'net/http/post/multipart'
3
3
  require 'multi_json'
4
- require 'lrucache'
4
+ require 'volatile_hash'
5
5
 
6
6
  module YACCL
7
7
  module Services
@@ -15,8 +15,8 @@ module YACCL
15
15
 
16
16
  @succinct_properties = succinct_properties
17
17
 
18
- @repository_urls = LRUCache.new(ttl: 3600)
19
- @root_folder_urls = LRUCache.new(ttl: 3600)
18
+ @repository_urls = VolatileHash.new(strategy: 'lru')
19
+ @root_folder_urls = VolatileHash.new(strategy: 'lru')
20
20
  end
21
21
 
22
22
  def perform_request(required_params={}, optional_params={})
@@ -42,10 +42,15 @@ module YACCL
42
42
  result = response.body
43
43
  if response.content_type == 'application/json'
44
44
  result = MultiJson.load(result, symbolize_keys: true)
45
+ end
46
+ unless (200...300).include?(response.code.to_i)
45
47
  if result.is_a?(Hash) && result.has_key?(:exception)
46
48
  raise CMISRequestError, "#{result[:exception]} -- #{result[:message]}"
49
+ else
50
+ raise CMISRequestError, "#{result}"
47
51
  end
48
52
  end
53
+
49
54
  result
50
55
  end
51
56
 
@@ -56,18 +61,19 @@ module YACCL
56
61
  @service_url
57
62
  else
58
63
  if object_id.nil?
59
- if @repository_urls.fetch(repository_id).nil?
60
- raise "No repository found with ID: #{repository_id}." unless @basement.get(@service_url)[repository_id]
61
- repository_url = @basement.get(@service_url)[repository_id]['repositoryUrl']
62
- @repository_urls.store(repository_id, repository_url)
64
+ if @repository_urls[repository_id].nil?
65
+ base = @basement.get(@service_url)
66
+ raise "No repository found with ID: #{repository_id}." unless base[repository_id]
67
+ repository_url = base[repository_id]['repositoryUrl']
68
+ @repository_urls[repository_id] = repository_url
63
69
  end
64
- return @repository_urls.fetch(repository_id)
70
+ return @repository_urls[repository_id]
65
71
  else
66
- if @root_folder_urls.fetch(repository_id).nil?
72
+ if @root_folder_urls[repository_id].nil?
67
73
  root_folder_url = @basement.get(@service_url)[repository_id]['rootFolderUrl']
68
- @root_folder_urls.store(repository_id, root_folder_url)
74
+ @root_folder_urls[repository_id] = root_folder_url
69
75
  end
70
- return @root_folder_urls.fetch(repository_id)
76
+ return @root_folder_urls[repository_id]
71
77
  end
72
78
  end
73
79
  end
data/lib/yaccl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YACCL
2
- VERSION = '0.0.20'
2
+ VERSION = '0.0.21'
3
3
  end
data/yaccl.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'httparty', '~> 0.10'
16
16
  s.add_dependency 'multipart-post', '~> 1.1'
17
17
  s.add_dependency 'multi_json', '~> 1.5'
18
- s.add_dependency 'lrucache', '~> 0.1'
18
+ s.add_dependency 'volatile_hash', '~> 0.0.2'
19
19
 
20
20
  s.files = `git ls-files`.split("\n")
21
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaccl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Geerts
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-29 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -54,19 +54,19 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.5'
56
56
  - !ruby/object:Gem::Dependency
57
- name: lrucache
57
+ name: volatile_hash
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '0.1'
62
+ version: 0.0.2
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0.1'
69
+ version: 0.0.2
70
70
  description: A Ruby CMIS browser binding client library implementation.
71
71
  email:
72
72
  - gem@up-nxt.com