yaccl 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTA3YTEyNmIzMWE4OGNjN2U0ODVhMTZiZTlmYmJjMjIzM2Q1NzlmNw==
4
+ ZmE5ZDI1MGRlMjMwMjczOGY3MzY3MjkyMzEzMzk0NjExNWVhNWQ3NQ==
5
5
  data.tar.gz: !binary |-
6
- ZWQ5MGIzZjQ5MjdjYjU1MzY5YTQyMmNjODhkMTQ1YmYwZTEyZTA5ZQ==
6
+ NzA4NjM3YTAxYTA2MGI1MjIzODY0ZDEwNjQ5ZjU0MTEzYTk4NjEyNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YTVlMzAxOGYzY2M1MTQxYzAzMzUxNTE5NmJlZmJhOTM4OWRiM2FkYzExZDMx
10
- ODAzNmU0MzI2ODg3YWUzOGI5MzIyY2VlM2IwMGMzOTgwODU3YjU2MzgzY2Q5
11
- YmNiN2NjNjVmNzAzMDk2MThkZTRjMjlkNWU0NmI3MGY0NWVlOTI=
9
+ NWMxYmQ1ODFmMjAxM2JmNTE4NGI3Y2E2MDdmNmMzM2ZiOWMwMGQxM2M5M2Fl
10
+ ZTQ1NDc2ZjhiZmUyMzcxNDMzYTY2ZTYzNzU5MGY3MzdkYzQ5NjA2NTMwZDY5
11
+ MWI5ZTY5OWQ0ODg4MWQ5YzhiMDQ2MDdiZDY5YzFkMGMxNTc5Nzc=
12
12
  data.tar.gz: !binary |-
13
- ODYyMDFlMDk5ODAzNmY3ZDllZWVjM2E3OTQ1OTE1YjU2YmE0ZDM5YWUzMWE4
14
- Y2Q4N2VhNjAxZmIzYzk5MDI0NjUyYTcxNDg1Y2I4Mzk3YTUxNGQzMDU5Y2Jk
15
- MzQ3ZDg5YTAwYWY2NGM2NjViNzgzMTVlZTcyMmZlNDhkMTcxZjE=
13
+ NWRhOGJjMzkwZjY5ODNmYzBiNTlkODQ4NGM3N2Y2MDNkNDQ1NTBlYTEzYzI3
14
+ OTY0MDg3M2RmOTMzZWEyMDZhZGIyYzY0YzZiNjFlOWY2ZGFmNjNiYTY5NjMx
15
+ OGY5NzVmNzYzZDRlNmU5NGEzMTJmOWUxYWRkYTYyNDQwNGUyOGI=
@@ -37,4 +37,4 @@ type.add_property_definition(
37
37
 
38
38
  full_type = repository.create_type(type)
39
39
  puts full_type.to_hash
40
- repository.delete_type(type.id)
40
+ full_type.delete
@@ -97,6 +97,20 @@ module YACCL
97
97
  object_id.nil?
98
98
  end
99
99
 
100
+ # utility
101
+
102
+ def can_be_deleted?
103
+ allowable_actions[:canDeleteObject]
104
+ end
105
+
106
+ def can_get_parents?
107
+ allowable_actions[:canGetObjectParents]
108
+ end
109
+
110
+ def can_update_properties
111
+ allowable_actions[:canUpdateProperties]
112
+ end
113
+
100
114
  private
101
115
 
102
116
  def get_properties_map(raw)
@@ -0,0 +1,41 @@
1
+ module YACCL
2
+ module Model
3
+ class PropertyDefinition
4
+
5
+ attr_accessor :id, :local_name, :query_name, :inherited,
6
+ :open_choise, :orderable, :property_type, :updatability,
7
+ :display_name, :required, :cardinality, :queryable
8
+
9
+ def initialize(hash={})
10
+ @id = hash[:id]
11
+ @local_name = hash[:localName]
12
+ @query_name = hash[:queryName]
13
+ @inherited = hash[:inherited]
14
+ @open_choice = hash[:openChoice]
15
+ @orderable = hash[:orderable]
16
+ @property_type = hash[:propertyType]
17
+ @updatability = hash[:updatability]
18
+ @display_name = hash[:displayName]
19
+ @required = hash[:required]
20
+ @cardinality = hash[:cardinality]
21
+ @queryable = hash[:queryable]
22
+ end
23
+
24
+ def readonly?
25
+ updatability == 'readonly'
26
+ end
27
+
28
+ def oncreate?
29
+ updatability == 'oncreate'
30
+ end
31
+
32
+ def readwrite?
33
+ updatability == 'readwrite'
34
+ end
35
+
36
+ def to_hash
37
+ # TODO (Needed for updating type?)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -83,14 +83,6 @@ module YACCL
83
83
  Type.create(id, Services.create_type(id, type.to_hash))
84
84
  end
85
85
 
86
- def update_type(type)
87
- Type.create(id, Services.update_type(id, type.to_hash))
88
- end
89
-
90
- def delete_type(type_id)
91
- Services.delete_type(id, type_id)
92
- end
93
-
94
86
  # relationship
95
87
 
96
88
  def create(object)
@@ -46,8 +46,9 @@ module YACCL
46
46
  @controllable_policy = hash[:controllablePolicy]
47
47
  @controllable_acl = hash[:controllableACL]
48
48
  @fulltext_indexed = hash[:fulltextIndexed]
49
- @included_in_supertype_query = hash[:includedInSupertype_query]
49
+ @included_in_supertype_query = hash[:includedInSupertypeQuery]
50
50
  @property_definitions = hash[:propertyDefinitions] || {}
51
+ @property_definitions.each { |k, v| @property_definitions[k] = PropertyDefinition.new(v) }
51
52
  # document type
52
53
  @versionable = hash[:versionable]
53
54
  @content_stream_allowed = hash[:contentStreamAllowed]
@@ -60,6 +61,14 @@ module YACCL
60
61
  @property_definitions[property[:id]] = property
61
62
  end
62
63
 
64
+ def save
65
+ Type.create(repository_id, Services.update_type(repository_id, to_hash))
66
+ end
67
+
68
+ def delete
69
+ Services.delete_type(repository_id, id)
70
+ end
71
+
63
72
  def new_object
64
73
  object = case base_id
65
74
  when 'cmis:document'
@@ -79,6 +88,26 @@ module YACCL
79
88
  object
80
89
  end
81
90
 
91
+ def document_type?
92
+ base_id == 'cmis:document'
93
+ end
94
+
95
+ def folder_type?
96
+ base_id == 'cmis:folder'
97
+ end
98
+
99
+ def relationship_type?
100
+ base_id == 'cmis:relationship'
101
+ end
102
+
103
+ def policy_type?
104
+ base_id == 'cmis:policy'
105
+ end
106
+
107
+ def item_type?
108
+ base_id == 'cmis:item'
109
+ end
110
+
82
111
  def to_hash
83
112
  hash = {}
84
113
  hash[:id] = id
@@ -96,7 +125,7 @@ module YACCL
96
125
  hash[:controllableACL]= controllable_acl
97
126
  hash[:fulltextIndexed]= fulltext_indexed
98
127
  hash[:includedInSupertypeQuery]= included_in_supertype_query
99
- hash[:propertyDefinitions]= property_definitions
128
+ hash[:propertyDefinitions]= property_definitions.to_hash
100
129
  # document type
101
130
  hash[:versionable] = versionable unless versionable.nil?
102
131
  hash[:contentStreamAllowed] = content_stream_allowed unless content_stream_allowed.nil?
data/lib/yaccl/model.rb CHANGED
@@ -7,4 +7,5 @@ require 'yaccl/model/policy'
7
7
  require 'yaccl/model/relationship'
8
8
  require 'yaccl/model/repository'
9
9
  require 'yaccl/model/type'
10
+ require 'yaccl/model/property_definition'
10
11
  require 'yaccl/model/server'
data/lib/yaccl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YACCL
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
@@ -131,7 +131,7 @@ describe YACCL::Model::Repository do
131
131
  t.should be_a_kind_of YACCL::Model::Type
132
132
  t.id.should eq type_id
133
133
  end
134
- @repo.delete_type(type_id)
134
+ @repo.type(type_id).delete
135
135
  end unless @repo.cmis_version_supported < '1.1'
136
136
  end
137
137
  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.0.11
4
+ version: 0.0.12
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-12 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -87,6 +87,7 @@ files:
87
87
  - lib/yaccl/model/object.rb
88
88
  - lib/yaccl/model/object_factory.rb
89
89
  - lib/yaccl/model/policy.rb
90
+ - lib/yaccl/model/property_definition.rb
90
91
  - lib/yaccl/model/relationship.rb
91
92
  - lib/yaccl/model/repository.rb
92
93
  - lib/yaccl/model/server.rb