occi-core 5.0.0.beta.9 → 5.0.0.beta.10

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccf964beebc12970fdcaf0ab624593f4bb73b74f
4
- data.tar.gz: 2d8c4b87e3c5948beef5be425e5042478f4734c7
3
+ metadata.gz: afd95a13c2ec93db744f907fec0ebe077a424f7b
4
+ data.tar.gz: 1526f8f20ffb41189e25455c759eb5ae79062268
5
5
  SHA512:
6
- metadata.gz: 7ad87812e470b99636a412f54b09e881d30acbaa01cb371f52f72821cf1166a76cbcf125ab610e292b9443d3dfeb14053acd0232d709889ec16ed03c9e5382a4
7
- data.tar.gz: b8be9a5d023b5a944a756f19ae8ff5756671d46c48f910377729d8ba5a51bdd6f1bd7741540203db868c9cf15e3e9d4538a6c466c457d1cb23b6facf86f50fc8
6
+ metadata.gz: 8a1d1e1b9d6d547d3035c5e9ac2928e8b18395235644158309b7e565c1fba1eecd2f4c5fba1889bae56bb02e3e7679d2d42de716374e00531186f3d15024df5b
7
+ data.tar.gz: e94eca874b8252507c247a172a45f2c16a448695a73f2785af7d70aa5ab09de10ae7dc33250d65192381a84eba60f299f7691b4cf5fd1eb75ed3a1164debd032
@@ -29,7 +29,7 @@ module Occi
29
29
  logger.debug "Identified #{action.class}[#{action.identifier}]"
30
30
  ai = Occi::Core::ActionInstance.new(action: action)
31
31
  ep = Entity.new(model: model)
32
- ep.set_attributes!(ai.attributes, parsed[:attributes]) if parsed[:attributes]
32
+ ep.set_attributes!(ai, parsed[:attributes]) if parsed[:attributes]
33
33
 
34
34
  logger.debug "Parsed into ActionInstance #{ai.inspect}" if logger_debug?
35
35
  ai
@@ -70,8 +70,8 @@ module Occi
70
70
  logger.debug "Converting #{hash.inspect} into a single instance" if logger_debug?
71
71
  instance = @_ib.get hash[:kind], mixins: lookup(hash[:mixins]), actions: lookup(hash[:actions])
72
72
 
73
- set_attributes! instance.attributes, hash[:attributes]
74
- set_links! instance.links, hash[:links] if instance.respond_to?(:links)
73
+ set_attributes! instance, hash[:attributes]
74
+ set_links! instance, hash[:links] if instance.respond_to?(:links)
75
75
  set_target! instance, hash[:target] if instance.respond_to?(:target)
76
76
 
77
77
  logger.debug "Created instance #{instance.inspect}" if logger_debug?
@@ -96,18 +96,19 @@ module Occi
96
96
 
97
97
  # :nodoc:
98
98
  def lookup(ary)
99
- set = Set.new
100
- return set if ary.blank?
101
- ary.each { |i| set << handle(Occi::Core::Errors::ParsingError) { model.find_by_identifier!(i) } }
102
- set
99
+ return Set.new if ary.blank?
100
+ cats = ary.map do |item|
101
+ handle(Occi::Core::Errors::ParsingError) { model.find_by_identifier!(item) }
102
+ end
103
+ Set.new cats
103
104
  end
104
105
 
105
106
  # :nodoc:
106
- def set_attributes!(attributes, hash)
107
+ def set_attributes!(instance, hash)
107
108
  return if hash.blank?
108
109
  hash.each_pair do |name, value|
109
110
  logger.debug "Setting attribute #{name} to #{value.inspect}" if logger_debug?
110
- attribute = attributes[name.to_s]
111
+ attribute = instance.attributes[name.to_s]
111
112
  unless attribute
112
113
  raise Occi::Core::Errors::ParsingError,
113
114
  "Attribute #{name.inspect} is not allowed for this entity"
@@ -116,9 +117,10 @@ module Occi
116
117
  end
117
118
  end
118
119
 
119
- def set_links!(links, ary)
120
+ # :nodoc:
121
+ def set_links!(instance, ary)
120
122
  return if ary.blank?
121
- ary.each { |l| links << json_single(l).first }
123
+ ary.each { |l| instance.add_link(json_single(l).first) }
122
124
  end
123
125
 
124
126
  # :nodoc:
@@ -175,7 +175,7 @@ module Occi
175
175
 
176
176
  link = plain_oglink_instance(md)
177
177
  link.location = handle(Occi::Core::Errors::ParsingError) { URI.parse md[:self] }
178
- entity.links << link
178
+ entity.add_link link
179
179
 
180
180
  plain_oglink_attributes! md, link
181
181
 
@@ -3,7 +3,7 @@ module Occi
3
3
  MAJOR_VERSION = 5 # Major update constant
4
4
  MINOR_VERSION = 0 # Minor update constant
5
5
  PATCH_VERSION = 0 # Patch/Fix version constant
6
- STAGE_VERSION = 'beta.9'.freeze # use `nil` for production releases
6
+ STAGE_VERSION = 'beta.10'.freeze # use `nil` for production releases
7
7
 
8
8
  unless defined?(::Occi::Core::VERSION)
9
9
  VERSION = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.beta.9
4
+ version: 5.0.0.beta.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-26 00:00:00.000000000 Z
13
+ date: 2017-07-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json