yaccl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  require 'httparty'
2
2
  require 'net/http/post/multipart'
3
3
  require 'multi_json'
4
+ require 'lrucache'
4
5
 
5
6
  module YACCL
6
7
  module Services
@@ -10,6 +11,8 @@ module YACCL
10
11
  class BrowserBindingService
11
12
  def initialize(service_url)
12
13
  @service_url = service_url
14
+ @repository_urls = LRUCache.new(ttl: 1.hour)
15
+ @root_folder_urls = LRUCache.new(ttl: 1.hour)
13
16
  end
14
17
 
15
18
  def perform_request(required_params={}, optional_params={})
@@ -46,8 +49,19 @@ module YACCL
46
49
  if repository_id.nil?
47
50
  @service_url
48
51
  else
49
- repository_info = Basement.get(@service_url)[repository_id]
50
- repository_info[object_id.nil? ? 'repositoryUrl' : 'rootFolderUrl']
52
+ if object_id.nil?
53
+ if @repository_urls.fetch(repository_id).nil?
54
+ repository_url = Basement.get(@service_url)[repository_id]['repositoryUrl']
55
+ @repository_urls.store(repository_id, repository_url)
56
+ end
57
+ return @repository_urls.fetch(repository_id)
58
+ else
59
+ if @root_folder_urls.fetch(repository_id).nil?
60
+ root_folder_url = Basement.get(@service_url)[repository_id]['rootFolderUrl']
61
+ @root_folder_urls.store(repository_id, root_folder_url)
62
+ end
63
+ return @root_folder_urls.fetch(repository_id)
64
+ end
51
65
  end
52
66
  end
53
67
 
data/lib/yaccl.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module YACCL
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
 
4
4
  def self.init(url)
5
5
  YACCL.const_set('SERVICE_URL', url)
data/spec/helper.rb CHANGED
@@ -23,7 +23,3 @@ end
23
23
  def delete_repository(id)
24
24
  YACCL::Model::Server.repository('meta').object(id).delete
25
25
  end
26
-
27
- repo = create_repository('lala')
28
- puts repo.capabilities
29
- delete_repository('lala')
data/yaccl.gemspec CHANGED
@@ -12,9 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.summary = 'Ruby CMIS browser binding client lib.'
13
13
  s.description = 'Ruby CMIS browser binding client lib.'
14
14
 
15
- s.add_dependency 'httparty', '~> 0.10.2'
16
- s.add_dependency 'multipart-post', '~> 1.1.5'
15
+ s.add_dependency 'httparty', '~> 0.10'
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
19
 
19
20
  s.files = `git ls-files`.split("\n")
20
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-28 00:00:00.000000000 Z
13
+ date: 2013-03-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.10.2
22
+ version: '0.10'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- version: 0.10.2
30
+ version: '0.10'
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: multipart-post
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: 1.1.5
38
+ version: '1.1'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 1.1.5
46
+ version: '1.1'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -60,6 +60,22 @@ dependencies:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.5'
63
+ - !ruby/object:Gem::Dependency
64
+ name: lrucache
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '0.1'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: '0.1'
63
79
  description: Ruby CMIS browser binding client lib.
64
80
  email:
65
81
  - kenneth@up-nxt.com