yaccl 0.1.3 → 0.1.4

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: 8dbc653c78ed22b6352c89440ffa6de173b9bc11
4
- data.tar.gz: 4b5b9fd8a01f265a3dd29c2c23313c3ce482df94
3
+ metadata.gz: 63d1e6cbd2d6ffad0f792e6f96a21e889c3d6fc5
4
+ data.tar.gz: 462107b26e7f12226e0ee9cb70aea2f65c69feba
5
5
  SHA512:
6
- metadata.gz: d70b69768f173d0ee6d9a4dcf8ceadede74a8da3c109a8396116b7c924b0b848415092abfedbcb7bdce3fd5adfec891386af2fcebf71279473e81f555b9b8d0a
7
- data.tar.gz: 7c2db6e0701c2637e9a78a00fbca76b709d885f179c75eb87196a30cebead8a816c3a70379f0a54ad11d4f294ff299eadceb605f6ca5b06b914f47a625d4a0bf
6
+ metadata.gz: 3976d7e6592ad9b51b1b3526bd14fc38e50c143fb07a5573376f826242ba6631627a6238f84caa00439d2464184e78c89e5b59c330e284f240a75421ec616e3d
7
+ data.tar.gz: 105d81e15805b52f57def80769231181a4d26ceefcbc51dcfd0045d0e0f8dd685b8bfd3c2f830b95a79f24a7ce48065fef6a0779946388f5c6eb7b54c7150e99
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
1
  Gemfile.lock
2
-
2
+ *.gem
3
3
  .idea
4
4
  *.iml
@@ -3,7 +3,7 @@ module YACCL
3
3
  class PropertyDefinition
4
4
 
5
5
  attr_accessor :id, :local_name, :query_name,
6
- :description, :inherited, :open_choice,
6
+ :description, :inherited,
7
7
  :orderable, :property_type, :updatability,
8
8
  :display_name, :required, :cardinality, :queryable, :other
9
9
 
@@ -13,7 +13,6 @@ module YACCL
13
13
  @query_name = hash.delete(:queryName)
14
14
  @description = hash.delete(:description)
15
15
  @inherited = hash.delete(:inherited)
16
- @open_choice = hash.delete(:openChoice)
17
16
  @orderable = hash.delete(:orderable)
18
17
  @property_type = hash.delete(:propertyType)
19
18
  @updatability = hash.delete(:updatability)
@@ -51,7 +50,6 @@ module YACCL
51
50
  hash[:queryName] = query_name
52
51
  hash[:description] = description
53
52
  hash[:inherited] = inherited
54
- hash[:openChoice] = open_choice
55
53
  hash[:orderable] = orderable
56
54
  hash[:propertyType] = property_type
57
55
  hash[:updatability] = updatability
@@ -27,6 +27,16 @@ module YACCL
27
27
  name
28
28
  end
29
29
 
30
+ def self.exist?(repository_id)
31
+ found = true
32
+ begin
33
+ Services.get_repository_info(repository_id, true)
34
+ rescue ObjectNotFoundError
35
+ found = false
36
+ end
37
+ found
38
+ end
39
+
30
40
  def self.create(raw_repository)
31
41
  Repository.new(raw_repository)
32
42
  end
@@ -130,9 +140,9 @@ module YACCL
130
140
  has_more_items = true
131
141
  while has_more_items
132
142
  result = Services.query(id, statement, nil, nil, nil, nil, chunk_size, skip_count)
133
- yield(result[:results].map! { |o| ObjectFactory.create(id, o) })
143
+ yield(result[:results].map! { |o| ObjectFactory.create(id, o) }) unless result[:results].empty?
134
144
  has_more_items = result[:hasMoreItems]
135
- skip_count += chunk_size
145
+ skip_count += result[:results].size
136
146
  end
137
147
  end
138
148
 
@@ -25,6 +25,16 @@ module YACCL
25
25
  attr_accessor :allowed_source_types
26
26
  attr_accessor :allowed_target_types
27
27
 
28
+ def self.exist?(repository_id, type_id)
29
+ type_found = true
30
+ begin
31
+ Services.get_type_definition(repository_id, type_id, true)
32
+ rescue ObjectNotFoundError
33
+ type_found = false
34
+ end
35
+ type_found
36
+ end
37
+
28
38
  def self.create(repository_id, raw)
29
39
  type = Type.new(raw)
30
40
  type.repository_id = repository_id
@@ -5,6 +5,7 @@ require 'multi_json'
5
5
  require_relative 'simple_cache'
6
6
 
7
7
  module YACCL
8
+ class ObjectNotFoundError < StandardError; end
8
9
  module Services
9
10
  class CMISRequestError < RuntimeError; end
10
11
 
@@ -54,7 +55,11 @@ module YACCL
54
55
 
55
56
  unless (200...300).include?(response.code.to_i)
56
57
  if result.is_a?(Hash) && result.has_key?(:exception)
57
- raise CMISRequestError, "#{response.code} -- #{result[:exception]} -- #{result[:message]}"
58
+ if response.code.to_i == 404 && result[:exception] == "objectNotFound"
59
+ raise ObjectNotFoundError
60
+ else
61
+ raise CMISRequestError, "#{response.code} -- #{result[:exception]} -- #{result[:message]}"
62
+ end
58
63
  else
59
64
  raise CMISRequestError, "#{response.code} -- #{result}"
60
65
  end
@@ -76,7 +81,7 @@ module YACCL
76
81
  def repository_urls(repository_id)
77
82
  if @@url_cache[repository_id].nil?
78
83
  repository_infos = MultiJson.load(@basement.get(url: @service_url).body , symbolize_keys: false)
79
- raise "No repository found with ID #{repository_id}." unless repository_infos.has_key?(repository_id)
84
+ raise ObjectNotFoundError, "No repository found with ID #{repository_id}." unless repository_infos.has_key?(repository_id)
80
85
  repository_info = repository_infos[repository_id]
81
86
  @@url_cache[repository_id] = { repository_url: repository_info['repositoryUrl'],
82
87
  root_folder_url: repository_info['rootFolderUrl'] }
data/lib/yaccl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YACCL
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Geerts
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-23 00:00:00.000000000 Z
12
+ date: 2014-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.6'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0.6'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: multipart-post
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.1'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.1'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: multi_json
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.5'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.5'
56
56
  description: A Ruby CMIS browser binding client library implementation.
@@ -60,7 +60,7 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
63
+ - ".gitignore"
64
64
  - Gemfile
65
65
  - LICENSE
66
66
  - Rakefile
@@ -113,17 +113,17 @@ require_paths:
113
113
  - lib
114
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.1.10
126
+ rubygems_version: 2.2.1
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: CMIS browser binding client lib.
@@ -139,4 +139,3 @@ test_files:
139
139
  - spec/services/navigation_services_spec.rb
140
140
  - spec/services/object_services_spec.rb
141
141
  - spec/services/repository_services_spec.rb
142
- has_rdoc: