plainrouter-sdk 0.6.0 → 0.6.1

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
  SHA256:
3
- metadata.gz: 0d1302d07cfa93ec0f86d445bde27cc160ecf0eb84c1acb612d52975ba9e7af4
4
- data.tar.gz: 59adbb3ccfa96fdcf0cabce017469a7d304b3f6ca9e705945311ed34631a1a1d
3
+ metadata.gz: a5520d3b56ecefc97c7aad741a1e8491e25c71f643cc7661a88360e659eba0e8
4
+ data.tar.gz: e3f6836fc2fb695602513a2cc77c1ea06c59325635a6976e96f8f3594336c43d
5
5
  SHA512:
6
- metadata.gz: d6d0c69e034706877defeb06c69ff69c9eb92205c48a8158becac5ba2c9b6ddf13e39fe7204f710293d2a57e3d990bdb5cde4d1a34f912a22cad7947c8c688e8
7
- data.tar.gz: af6667e2681e9c344f0ea9034930c627c5c1455b121aace73a3fd48502dbe31c18db25454427e183e679743b3c3a0ecc8f7fae57687cd16f904341cf34e6c93d
6
+ metadata.gz: fc2ada06b63f54534980b71b367c77c96a9c3471c18391b6404d6aeed3b118234bd25d7ef23b12c65fdc0ea90336d19c621da2dc530faf6431aca87d625ccacb
7
+ data.tar.gz: 8d936747bea708f07a5472a5a228660271cf3f9ff1d6962e7eef444dbda4c5a3bcbe55de5b6af673b7e7e27f4b725724ba8fce899b8d3c9dfc050d33698a6ec0
@@ -126,6 +126,12 @@ module PlainRouter
126
126
  super(http_method, path, request, opts.merge(header_params: headers))
127
127
  end
128
128
 
129
+ def build_request_url(path, opts = {})
130
+ return super unless path == "/mcp/launcher/import"
131
+
132
+ @config.base_url(opts[:operation]).sub(%r{/+\z}, "").delete_suffix("/api/v1") + path
133
+ end
134
+
129
135
  private
130
136
 
131
137
  def validate_integer_inputs(http_method, path, opts)
@@ -20,6 +20,7 @@ require 'time'
20
20
  require 'faraday'
21
21
  require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0')
22
22
  require 'marcel'
23
+ require 'pathname'
23
24
 
24
25
 
25
26
  module PlainRouter::OpenAPI
@@ -14,175 +14,90 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module PlainRouter::OpenAPI
17
- class GetAccountInventory404Response < ApiModelBase
18
- attr_accessor :message
19
-
20
- class EnumAttributeValidator
21
- attr_reader :datatype
22
- attr_reader :allowable_values
23
-
24
- def initialize(datatype, allowable_values)
25
- @allowable_values = allowable_values.map do |value|
26
- case datatype.to_s
27
- when /Integer/i
28
- value.to_i
29
- when /Float/i
30
- value.to_f
31
- else
32
- value
33
- end
34
- end
35
- end
36
-
37
- def valid?(value)
38
- !value || allowable_values.include?(value)
39
- end
40
- end
41
-
42
- # Attribute mapping from ruby-style variable name to JSON key.
43
- def self.attribute_map
44
- {
45
- :'message' => :'message'
46
- }
47
- end
48
-
49
- # Returns attribute mapping this model knows about
50
- def self.acceptable_attribute_map
51
- attribute_map
52
- end
53
-
54
- # Returns all the JSON keys this model knows about
55
- def self.acceptable_attributes
56
- acceptable_attribute_map.values
57
- end
58
-
59
- # Attribute type mapping.
60
- def self.openapi_types
61
- {
62
- :'message' => :'String'
63
- }
64
- end
65
-
66
- # List of attributes with nullable: true
67
- def self.openapi_nullable
68
- Set.new([
69
- ])
70
- end
71
-
72
- # Initializes the object
73
- # @param [Hash] attributes Model attributes in the form of hash
74
- def initialize(attributes = {})
75
- if (!attributes.is_a?(Hash))
76
- fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::GetAccountInventory404Response` initialize method"
17
+ module GetAccountInventory404Response
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'ApiRouteNotFound',
23
+ :'GetAccountInventory404ResponseAnyOf'
24
+ ]
77
25
  end
78
26
 
79
- # check to see if the attribute exists and convert string to symbol for hash key
80
- acceptable_attribute_map = self.class.acceptable_attribute_map
81
- attributes = attributes.each_with_object({}) { |(k, v), h|
82
- if (!acceptable_attribute_map.key?(k.to_sym))
83
- fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::GetAccountInventory404Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
84
43
  end
85
- h[k.to_sym] = v
86
- }
87
44
 
88
- if attributes.key?(:'message')
89
- self.message = attributes[:'message']
90
- else
91
- self.message = nil
45
+ openapi_any_of.include?(:AnyType) ? data : nil
92
46
  end
93
- end
94
47
 
95
- # Show invalid properties with the reasons. Usually used together with valid?
96
- # @return Array for valid properties with the reasons
97
- def list_invalid_properties
98
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
- invalid_properties = Array.new
100
- if @message.nil?
101
- invalid_properties.push('invalid value for "message", message cannot be nil.')
102
- end
103
-
104
- invalid_properties
105
- end
106
-
107
- # Check to see if the all the properties in the model are valid
108
- # @return true if the model is valid
109
- def valid?
110
- warn '[DEPRECATED] the `valid?` method is obsolete'
111
- return false if @message.nil?
112
- message_validator = EnumAttributeValidator.new('String', ["Account not found."])
113
- return false unless message_validator.valid?(@message)
114
- true
115
- end
116
-
117
- # Custom attribute writer method checking allowed values (enum).
118
- # @param [Object] message Object to be assigned
119
- def message=(message)
120
- validator = EnumAttributeValidator.new('String', ["Account not found."])
121
- unless validator.valid?(message)
122
- fail ArgumentError, "invalid value for \"message\", must be one of #{validator.allowable_values}."
123
- end
124
- @message = message
125
- end
126
-
127
- # Checks equality by comparing each attribute.
128
- # @param [Object] Object to be compared
129
- def ==(o)
130
- return true if self.equal?(o)
131
- self.class == o.class &&
132
- message == o.message
133
- end
134
-
135
- # @see the `==` method
136
- # @param [Object] Object to be compared
137
- def eql?(o)
138
- self == o
139
- end
140
-
141
- # Calculates hash code according to all attributes.
142
- # @return [Integer] Hash code
143
- def hash
144
- [message].hash
145
- end
146
-
147
- # Builds the object from hash
148
- # @param [Hash] attributes Model attributes in the form of hash
149
- # @return [Object] Returns the model itself
150
- def self.build_from_hash(attributes)
151
- return nil unless attributes.is_a?(Hash)
152
- attributes = attributes.transform_keys(&:to_sym)
153
- transformed_hash = {}
154
- openapi_types.each_pair do |key, type|
155
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
- transformed_hash["#{key}"] = nil
157
- elsif type =~ /\AArray<(.*)>/i
158
- # check to ensure the input is an array given that the attribute
159
- # is documented as an array but the input is not
160
- if attributes[attribute_map[key]].is_a?(Array)
161
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = PlainRouter::OpenAPI.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
162
93
  end
163
- elsif !attributes[attribute_map[key]].nil?
164
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
- end
166
- end
167
- new(transformed_hash)
168
- end
169
-
170
- # Returns the object in the form of hash
171
- # @return [Hash] Returns the object in the form of hash
172
- def to_hash
173
- hash = {}
174
- self.class.attribute_map.each_pair do |attr, param|
175
- value = self.send(attr)
176
- if value.nil?
177
- is_nullable = self.class.openapi_nullable.include?(attr)
178
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
94
  end
180
95
 
181
- hash[param] = _to_hash(value)
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
182
99
  end
183
- hash
184
100
  end
185
-
186
101
  end
187
102
 
188
103
  end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #Plainrouter Conversion API
3
+
4
+ #Plainrouter public Signals Conversion API.
5
+
6
+ The version of the OpenAPI document: 0.5.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PlainRouter::OpenAPI
17
+ class GetAccountInventory404ResponseAnyOf < ApiModelBase
18
+ attr_accessor :message
19
+
20
+ class EnumAttributeValidator
21
+ attr_reader :datatype
22
+ attr_reader :allowable_values
23
+
24
+ def initialize(datatype, allowable_values)
25
+ @allowable_values = allowable_values.map do |value|
26
+ case datatype.to_s
27
+ when /Integer/i
28
+ value.to_i
29
+ when /Float/i
30
+ value.to_f
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+
37
+ def valid?(value)
38
+ !value || allowable_values.include?(value)
39
+ end
40
+ end
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'message' => :'message'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'message' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PlainRouter::OpenAPI::GetAccountInventory404ResponseAnyOf` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PlainRouter::OpenAPI::GetAccountInventory404ResponseAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'message')
89
+ self.message = attributes[:'message']
90
+ else
91
+ self.message = nil
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ if @message.nil?
101
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
102
+ end
103
+
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
+ return false if @message.nil?
112
+ message_validator = EnumAttributeValidator.new('String', ["Account not found."])
113
+ return false unless message_validator.valid?(@message)
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method checking allowed values (enum).
118
+ # @param [Object] message Object to be assigned
119
+ def message=(message)
120
+ validator = EnumAttributeValidator.new('String', ["Account not found."])
121
+ unless validator.valid?(message)
122
+ fail ArgumentError, "invalid value for \"message\", must be one of #{validator.allowable_values}."
123
+ end
124
+ @message = message
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ message == o.message
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [message].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attributes = attributes.transform_keys(&:to_sym)
153
+ transformed_hash = {}
154
+ openapi_types.each_pair do |key, type|
155
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = nil
157
+ elsif type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the attribute
159
+ # is documented as an array but the input is not
160
+ if attributes[attribute_map[key]].is_a?(Array)
161
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
162
+ end
163
+ elsif !attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
165
+ end
166
+ end
167
+ new(transformed_hash)
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = self.send(attr)
176
+ if value.nil?
177
+ is_nullable = self.class.openapi_nullable.include?(attr)
178
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
+ end
180
+
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ end
187
+
188
+ end
@@ -11,5 +11,5 @@ Generator version: 7.25.0
11
11
  =end
12
12
 
13
13
  module PlainRouter::OpenAPI
14
- VERSION = '0.6.0'
14
+ VERSION = '0.6.1'
15
15
  end
@@ -188,6 +188,7 @@ require 'plainrouter/openapi/models/execute_deployment_plan_request'
188
188
  require 'plainrouter/openapi/models/get_account_inventory200_response'
189
189
  require 'plainrouter/openapi/models/get_account_inventory200_response_summary'
190
190
  require 'plainrouter/openapi/models/get_account_inventory404_response'
191
+ require 'plainrouter/openapi/models/get_account_inventory404_response_any_of'
191
192
  require 'plainrouter/openapi/models/get_cookie_declaration404_response'
192
193
  require 'plainrouter/openapi/models/get_emq_report200_response'
193
194
  require 'plainrouter/openapi/models/get_emq_report200_response_snapshots_inner'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlainRouter
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  CONTRACT_VERSION = "0.5.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plainrouter-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Plainrouter
@@ -271,6 +271,7 @@ files:
271
271
  - lib/plainrouter/openapi/models/get_account_inventory200_response.rb
272
272
  - lib/plainrouter/openapi/models/get_account_inventory200_response_summary.rb
273
273
  - lib/plainrouter/openapi/models/get_account_inventory404_response.rb
274
+ - lib/plainrouter/openapi/models/get_account_inventory404_response_any_of.rb
274
275
  - lib/plainrouter/openapi/models/get_cookie_declaration404_response.rb
275
276
  - lib/plainrouter/openapi/models/get_emq_report200_response.rb
276
277
  - lib/plainrouter/openapi/models/get_emq_report200_response_snapshots_inner.rb
@@ -401,7 +402,7 @@ metadata:
401
402
  documentation_uri: https://plainrouter.com/docs/sdk/ruby
402
403
  homepage_uri: https://plainrouter.com
403
404
  rubygems_mfa_required: 'true'
404
- source_code_uri: https://github.com/plainrouter/sdk/tree/ruby-v0.6.0/packages/ruby
405
+ source_code_uri: https://github.com/plainrouter/sdk/tree/ruby-v0.6.1/packages/ruby
405
406
  rdoc_options: []
406
407
  require_paths:
407
408
  - lib