manageiq-api-common 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: bf558ff2ddd7a2cbed5ffca066b2f769523d4fdd3b835d9497c280d97838f81b
4
- data.tar.gz: 160883b30284ec6b53f0c14c43b66413ac9b9ab75a87766ebc91bdfb15b4c658
3
+ metadata.gz: 505d9b26de12a65214f045cba58f0cd0d3f03f24b52e34c9f91c93438107593a
4
+ data.tar.gz: 93742f14fcc2493740e3b85b42cbcd8f3bc2e06b0b1e35ee3e306dc5eacb6564
5
5
  SHA512:
6
- metadata.gz: 108cba357408d2e2889321672976053c8a2d45a0b2f189ad5c6534b6d1d9d0f30e9637681c6e45751b157acc38061f93cf805c08c5ecba2b367284e639061f44
7
- data.tar.gz: 30f9ab415d4b6d949b1ae62d40ee22a53f0f0ec5c5a938da3cec4a98b926b472e95e33531cf7cb7f3f914d9ba3ca204916175ee1ca7a1dc4c8ac18f0dfa826b5
6
+ metadata.gz: 46a55bf1c465a7de8ef16d7245f182dc60b1e14a6a650ac4f882f894889df8fe481e160c76a8701b3882c2abd72656f1bd38d0cdadf1467dff70d4f6e29e9206
7
+ data.tar.gz: 90ece62ebe786c71c3bc94d20d6bbbacced40abe5168ab9aabf93d628289ab5ef47fd6a982958dd228c7c72fd90dc9dff8fbba4ac8173767d15aa452fc38bbb8
@@ -23,11 +23,11 @@ module ManageIQ
23
23
  type = determine_string_attribute_type(attribute)
24
24
  send(type, k, v)
25
25
  else
26
- errors.add("unsupported attribute type for: #{k}")
26
+ errors << "unsupported attribute type for: #{k}"
27
27
  end
28
28
  end
29
29
 
30
- raise ManageIQ::API::Common::Filter::Error.new(:error_document => errors) unless errors.blank?
30
+ raise(ManageIQ::API::Common::Filter::Error, errors.join(", ")) unless errors.blank?
31
31
  query
32
32
  end
33
33
 
@@ -35,18 +35,12 @@ module ManageIQ
35
35
 
36
36
  attr_accessor :query
37
37
 
38
- class Error < ArgumentError
39
- attr_reader :error_document
40
-
41
- def initialize(attrs)
42
- @error_document = attrs[:error_document]
43
- end
44
- end
38
+ class Error < ArgumentError; end
45
39
 
46
40
  def attribute_for_key(key)
47
41
  attribute = api_doc_definition.properties[key.to_s]
48
42
  return attribute if attribute
49
- errors.add("found unpermitted parameter: #{key}")
43
+ errors << "found unpermitted parameter: #{key}"
50
44
  nil
51
45
  end
52
46
 
@@ -57,7 +51,7 @@ module ManageIQ
57
51
  end
58
52
 
59
53
  def errors
60
- @errors ||= ManageIQ::API::Common::ErrorDocument.new
54
+ @errors ||= []
61
55
  end
62
56
 
63
57
  def string(k, val)
@@ -81,7 +75,7 @@ module ManageIQ
81
75
  return if value.nil?
82
76
  send("comparator_#{requested_comparator}", key, value)
83
77
  else
84
- errors.add("unsupported #{type} comparator: #{requested_comparator}")
78
+ errors << "unsupported #{type} comparator: #{requested_comparator}"
85
79
  end
86
80
  end
87
81
 
@@ -100,7 +94,7 @@ module ManageIQ
100
94
 
101
95
  DateTime.parse(value)
102
96
  rescue ArgumentError
103
- errors.add("invalid timestamp: #{value}")
97
+ errors << "invalid timestamp: #{value}"
104
98
  return nil
105
99
  end
106
100
 
@@ -5,7 +5,7 @@ module ManageIQ
5
5
  class Docs
6
6
  class ObjectDefinition < Hash
7
7
  def all_attributes
8
- properties.keys
8
+ properties.map { |key, val| all_attributes_recursive(key, val) }
9
9
  end
10
10
 
11
11
  def read_only_attributes
@@ -19,6 +19,18 @@ module ManageIQ
19
19
  def properties
20
20
  self["properties"]
21
21
  end
22
+
23
+ private
24
+
25
+ def all_attributes_recursive(key, value)
26
+ if value["properties"]
27
+ {
28
+ key => value["properties"].map { |k, v| all_attributes_recursive(k, v) }
29
+ }
30
+ else
31
+ key
32
+ end
33
+ end
22
34
  end
23
35
  end
24
36
  end
@@ -5,9 +5,9 @@ module ManageIQ
5
5
  require 'rbac-api-client'
6
6
 
7
7
  class Seed
8
- def initialize(seed_file, user_file)
8
+ def initialize(seed_file, user_file = nil)
9
9
  @acl_data = YAML.load_file(seed_file)
10
- @request = create_request(user_file)
10
+ @request = ManageIQ::API::Common::Request.current || create_request(user_file)
11
11
  end
12
12
 
13
13
  def process
@@ -1,7 +1,7 @@
1
1
  module ManageIQ
2
2
  module API
3
3
  module Common
4
- VERSION = "2.0.0".freeze
4
+ VERSION = "2.0.1".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-api-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-17 00:00:00.000000000 Z
11
+ date: 2019-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_tenant