From bbf7560496c890602cc09fe1e130176793e4ed4d Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 5 Dec 2023 23:36:34 +0000 Subject: [PATCH] SDK updates --- docs/generated/AuthMethods.md | 8 +- docs/generated/MagicLinkAuthMethod.md | 22 ++ ...EmailSmsAuthMethod.md => OtpAuthMethod.md} | 4 +- ...keyAuthMethod.md => PasskeysAuthMethod.md} | 4 +- docs/generated/UpdateMagicLinkAuthMethod.md | 22 ++ ...msAuthMethod.md => UpdateOtpAuthMethod.md} | 4 +- ...hMethod.md => UpdatePasskeysAuthMethod.md} | 4 +- lib/openapi_client/api_client.rb | 1 - lib/openapi_client/models/auth_methods.rb | 26 +- .../models/magic_link_auth_method.rb | 302 ++++++++++++++++++ ..._sms_auth_method.rb => otp_auth_method.rb} | 11 +- ...auth_method.rb => passkeys_auth_method.rb} | 8 +- lib/openapi_client/models/ttl_display_unit.rb | 2 +- .../models/update_magic_link_auth_method.rb | 276 ++++++++++++++++ ...th_method.rb => update_otp_auth_method.rb} | 6 +- ...thod.rb => update_passkeys_auth_method.rb} | 6 +- 16 files changed, 665 insertions(+), 41 deletions(-) create mode 100644 docs/generated/MagicLinkAuthMethod.md rename docs/generated/{EmailSmsAuthMethod.md => OtpAuthMethod.md} (82%) rename docs/generated/{PasskeyAuthMethod.md => PasskeysAuthMethod.md} (71%) create mode 100644 docs/generated/UpdateMagicLinkAuthMethod.md rename docs/generated/{UpdateEmailSmsAuthMethod.md => UpdateOtpAuthMethod.md} (81%) rename docs/generated/{UpdatePasskeyAuthMethod.md => UpdatePasskeysAuthMethod.md} (69%) create mode 100644 lib/openapi_client/models/magic_link_auth_method.rb rename lib/openapi_client/models/{email_sms_auth_method.rb => otp_auth_method.rb} (95%) rename lib/openapi_client/models/{passkey_auth_method.rb => passkeys_auth_method.rb} (95%) create mode 100644 lib/openapi_client/models/update_magic_link_auth_method.rb rename lib/openapi_client/models/{update_email_sms_auth_method.rb => update_otp_auth_method.rb} (96%) rename lib/openapi_client/models/{update_passkey_auth_method.rb => update_passkeys_auth_method.rb} (95%) diff --git a/docs/generated/AuthMethods.md b/docs/generated/AuthMethods.md index 0b21197..1252f4a 100644 --- a/docs/generated/AuthMethods.md +++ b/docs/generated/AuthMethods.md @@ -4,9 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **passkey** | [**PasskeyAuthMethod**](PasskeyAuthMethod.md) | | | -| **otp** | [**EmailSmsAuthMethod**](EmailSmsAuthMethod.md) | | | -| **magic_link** | [**EmailSmsAuthMethod**](EmailSmsAuthMethod.md) | | | +| **passkeys** | [**PasskeysAuthMethod**](PasskeysAuthMethod.md) | | | +| **otp** | [**OtpAuthMethod**](OtpAuthMethod.md) | | | +| **magic_link** | [**MagicLinkAuthMethod**](MagicLinkAuthMethod.md) | | | ## Example @@ -14,7 +14,7 @@ require 'openapi_client' instance = OpenapiClient::AuthMethods.new( - passkey: null, + passkeys: null, otp: null, magic_link: null ) diff --git a/docs/generated/MagicLinkAuthMethod.md b/docs/generated/MagicLinkAuthMethod.md new file mode 100644 index 0000000..c1af093 --- /dev/null +++ b/docs/generated/MagicLinkAuthMethod.md @@ -0,0 +1,22 @@ +# OpenapiClient::MagicLinkAuthMethod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | | | +| **ttl** | **Integer** | Maximum time (IN SECONDS) for the auth to expire. | [default to 300] | +| **ttl_display_unit** | [**TtlDisplayUnit**](TtlDisplayUnit.md) | | | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::MagicLinkAuthMethod.new( + enabled: null, + ttl: null, + ttl_display_unit: null +) +``` + diff --git a/docs/generated/EmailSmsAuthMethod.md b/docs/generated/OtpAuthMethod.md similarity index 82% rename from docs/generated/EmailSmsAuthMethod.md rename to docs/generated/OtpAuthMethod.md index cdbf459..0a05bf1 100644 --- a/docs/generated/EmailSmsAuthMethod.md +++ b/docs/generated/OtpAuthMethod.md @@ -1,4 +1,4 @@ -# OpenapiClient::EmailSmsAuthMethod +# OpenapiClient::OtpAuthMethod ## Properties @@ -13,7 +13,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::EmailSmsAuthMethod.new( +instance = OpenapiClient::OtpAuthMethod.new( enabled: null, ttl: null, ttl_display_unit: null diff --git a/docs/generated/PasskeyAuthMethod.md b/docs/generated/PasskeysAuthMethod.md similarity index 71% rename from docs/generated/PasskeyAuthMethod.md rename to docs/generated/PasskeysAuthMethod.md index a37a104..1925c1e 100644 --- a/docs/generated/PasskeyAuthMethod.md +++ b/docs/generated/PasskeysAuthMethod.md @@ -1,4 +1,4 @@ -# OpenapiClient::PasskeyAuthMethod +# OpenapiClient::PasskeysAuthMethod ## Properties @@ -11,7 +11,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::PasskeyAuthMethod.new( +instance = OpenapiClient::PasskeysAuthMethod.new( enabled: null ) ``` diff --git a/docs/generated/UpdateMagicLinkAuthMethod.md b/docs/generated/UpdateMagicLinkAuthMethod.md new file mode 100644 index 0000000..4aa7cfe --- /dev/null +++ b/docs/generated/UpdateMagicLinkAuthMethod.md @@ -0,0 +1,22 @@ +# OpenapiClient::UpdateMagicLinkAuthMethod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | | [optional] | +| **ttl** | **Integer** | Maximum time (IN SECONDS) for the auth to expire. | [optional][default to 300] | +| **ttl_display_unit** | [**TtlDisplayUnit**](TtlDisplayUnit.md) | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::UpdateMagicLinkAuthMethod.new( + enabled: null, + ttl: null, + ttl_display_unit: null +) +``` + diff --git a/docs/generated/UpdateEmailSmsAuthMethod.md b/docs/generated/UpdateOtpAuthMethod.md similarity index 81% rename from docs/generated/UpdateEmailSmsAuthMethod.md rename to docs/generated/UpdateOtpAuthMethod.md index 1ff383d..8a084fb 100644 --- a/docs/generated/UpdateEmailSmsAuthMethod.md +++ b/docs/generated/UpdateOtpAuthMethod.md @@ -1,4 +1,4 @@ -# OpenapiClient::UpdateEmailSmsAuthMethod +# OpenapiClient::UpdateOtpAuthMethod ## Properties @@ -13,7 +13,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::UpdateEmailSmsAuthMethod.new( +instance = OpenapiClient::UpdateOtpAuthMethod.new( enabled: null, ttl: null, ttl_display_unit: null diff --git a/docs/generated/UpdatePasskeyAuthMethod.md b/docs/generated/UpdatePasskeysAuthMethod.md similarity index 69% rename from docs/generated/UpdatePasskeyAuthMethod.md rename to docs/generated/UpdatePasskeysAuthMethod.md index 6888e64..595d723 100644 --- a/docs/generated/UpdatePasskeyAuthMethod.md +++ b/docs/generated/UpdatePasskeysAuthMethod.md @@ -1,4 +1,4 @@ -# OpenapiClient::UpdatePasskeyAuthMethod +# OpenapiClient::UpdatePasskeysAuthMethod ## Properties @@ -11,7 +11,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::UpdatePasskeyAuthMethod.new( +instance = OpenapiClient::UpdatePasskeysAuthMethod.new( enabled: null ) ``` diff --git a/lib/openapi_client/api_client.rb b/lib/openapi_client/api_client.rb index 4f8f936..aebf514 100644 --- a/lib/openapi_client/api_client.rb +++ b/lib/openapi_client/api_client.rb @@ -122,7 +122,6 @@ def build_request(http_method, path, request, opts = {}) request.url url request.params = query_params - request end diff --git a/lib/openapi_client/models/auth_methods.rb b/lib/openapi_client/models/auth_methods.rb index 3bcb529..7d226c7 100644 --- a/lib/openapi_client/models/auth_methods.rb +++ b/lib/openapi_client/models/auth_methods.rb @@ -16,7 +16,7 @@ module OpenapiClient # Denotes what methods this app is allowed to use for authentication with configurations class AuthMethods - attr_accessor :passkey + attr_accessor :passkeys attr_accessor :otp @@ -25,7 +25,7 @@ class AuthMethods # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'passkey' => :'passkey', + :'passkeys' => :'passkeys', :'otp' => :'otp', :'magic_link' => :'magic_link' } @@ -39,9 +39,9 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'passkey' => :'PasskeyAuthMethod', - :'otp' => :'EmailSmsAuthMethod', - :'magic_link' => :'EmailSmsAuthMethod' + :'passkeys' => :'PasskeysAuthMethod', + :'otp' => :'OtpAuthMethod', + :'magic_link' => :'MagicLinkAuthMethod' } end @@ -66,10 +66,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'passkey') - self.passkey = attributes[:'passkey'] + if attributes.key?(:'passkeys') + self.passkeys = attributes[:'passkeys'] else - self.passkey = nil + self.passkeys = nil end if attributes.key?(:'otp') @@ -90,8 +90,8 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @passkey.nil? - invalid_properties.push('invalid value for "passkey", passkey cannot be nil.') + if @passkeys.nil? + invalid_properties.push('invalid value for "passkeys", passkeys cannot be nil.') end if @otp.nil? @@ -109,7 +109,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @passkey.nil? + return false if @passkeys.nil? return false if @otp.nil? return false if @magic_link.nil? true @@ -120,7 +120,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - passkey == o.passkey && + passkeys == o.passkeys && otp == o.otp && magic_link == o.magic_link end @@ -134,7 +134,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [passkey, otp, magic_link].hash + [passkeys, otp, magic_link].hash end # Builds the object from hash diff --git a/lib/openapi_client/models/magic_link_auth_method.rb b/lib/openapi_client/models/magic_link_auth_method.rb new file mode 100644 index 0000000..31b7cc2 --- /dev/null +++ b/lib/openapi_client/models/magic_link_auth_method.rb @@ -0,0 +1,302 @@ +=begin +#Passage Management API + +#Passage's management API to manage your Passage apps and users. + +The version of the OpenAPI document: 1 +Contact: support@passage.id +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0 + +=end + +require 'date' +require 'time' + +module OpenapiClient + class MagicLinkAuthMethod + attr_accessor :enabled + + # Maximum time (IN SECONDS) for the auth to expire. + attr_accessor :ttl + + attr_accessor :ttl_display_unit + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'ttl' => :'ttl', + :'ttl_display_unit' => :'ttl_display_unit' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'ttl' => :'Integer', + :'ttl_display_unit' => :'TtlDisplayUnit' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'UpdateMagicLinkAuthMethod' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::MagicLinkAuthMethod` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::MagicLinkAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + else + self.enabled = nil + end + + if attributes.key?(:'ttl') + self.ttl = attributes[:'ttl'] + else + self.ttl = 300 + end + + if attributes.key?(:'ttl_display_unit') + self.ttl_display_unit = attributes[:'ttl_display_unit'] + else + self.ttl_display_unit = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @enabled.nil? + invalid_properties.push('invalid value for "enabled", enabled cannot be nil.') + end + + if @ttl.nil? + invalid_properties.push('invalid value for "ttl", ttl cannot be nil.') + end + + if @ttl < 60 + invalid_properties.push('invalid value for "ttl", must be greater than or equal to 60.') + end + + if @ttl_display_unit.nil? + invalid_properties.push('invalid value for "ttl_display_unit", ttl_display_unit cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @enabled.nil? + return false if @ttl.nil? + return false if @ttl < 60 + return false if @ttl_display_unit.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] ttl Value to be assigned + def ttl=(ttl) + if ttl.nil? + fail ArgumentError, 'ttl cannot be nil' + end + + if ttl < 60 + fail ArgumentError, 'invalid value for "ttl", must be greater than or equal to 60.' + end + + @ttl = ttl + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + ttl == o.ttl && + ttl_display_unit == o.ttl_display_unit + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, ttl, ttl_display_unit].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/openapi_client/models/email_sms_auth_method.rb b/lib/openapi_client/models/otp_auth_method.rb similarity index 95% rename from lib/openapi_client/models/email_sms_auth_method.rb rename to lib/openapi_client/models/otp_auth_method.rb index c8df3ca..148650f 100644 --- a/lib/openapi_client/models/email_sms_auth_method.rb +++ b/lib/openapi_client/models/otp_auth_method.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class EmailSmsAuthMethod + class OtpAuthMethod attr_accessor :enabled # Maximum time (IN SECONDS) for the auth to expire. @@ -76,7 +76,7 @@ def self.openapi_nullable # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :'UpdateEmailSmsAuthMethod' + :'UpdateOtpAuthMethod' ] end @@ -84,13 +84,13 @@ def self.openapi_all_of # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::EmailSmsAuthMethod` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::OtpAuthMethod` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::EmailSmsAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::OtpAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } @@ -156,6 +156,9 @@ def ttl=(ttl) fail ArgumentError, 'ttl cannot be nil' end + if ttl < 60 + fail ArgumentError, 'invalid value for "ttl", must be greater than or equal to 60.' + end @ttl = ttl end diff --git a/lib/openapi_client/models/passkey_auth_method.rb b/lib/openapi_client/models/passkeys_auth_method.rb similarity index 95% rename from lib/openapi_client/models/passkey_auth_method.rb rename to lib/openapi_client/models/passkeys_auth_method.rb index a0918fc..7348b8f 100644 --- a/lib/openapi_client/models/passkey_auth_method.rb +++ b/lib/openapi_client/models/passkeys_auth_method.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class PasskeyAuthMethod + class PasskeysAuthMethod attr_accessor :enabled # Attribute mapping from ruby-style variable name to JSON key. @@ -45,7 +45,7 @@ def self.openapi_nullable # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :'UpdatePasskeyAuthMethod' + :'UpdatePasskeysAuthMethod' ] end @@ -53,13 +53,13 @@ def self.openapi_all_of # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PasskeyAuthMethod` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PasskeysAuthMethod` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PasskeyAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PasskeysAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/lib/openapi_client/models/ttl_display_unit.rb b/lib/openapi_client/models/ttl_display_unit.rb index 6e43a81..2838333 100644 --- a/lib/openapi_client/models/ttl_display_unit.rb +++ b/lib/openapi_client/models/ttl_display_unit.rb @@ -35,7 +35,7 @@ def self.build_from_hash(value) # @param [String] The enum value in the form of the string # @return [String] The enum value def build_from_hash(value) - return value if TtlDisplayUnit.all_vars.include?(value) || value == "" + return value if TtlDisplayUnit.all_vars.include?(value) raise "Invalid ENUM value #{value} for class #TtlDisplayUnit" end end diff --git a/lib/openapi_client/models/update_magic_link_auth_method.rb b/lib/openapi_client/models/update_magic_link_auth_method.rb new file mode 100644 index 0000000..bf82bc6 --- /dev/null +++ b/lib/openapi_client/models/update_magic_link_auth_method.rb @@ -0,0 +1,276 @@ +=begin +#Passage Management API + +#Passage's management API to manage your Passage apps and users. + +The version of the OpenAPI document: 1 +Contact: support@passage.id +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0 + +=end + +require 'date' +require 'time' + +module OpenapiClient + class UpdateMagicLinkAuthMethod + attr_accessor :enabled + + # Maximum time (IN SECONDS) for the auth to expire. + attr_accessor :ttl + + attr_accessor :ttl_display_unit + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'ttl' => :'ttl', + :'ttl_display_unit' => :'ttl_display_unit' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'ttl' => :'Integer', + :'ttl_display_unit' => :'TtlDisplayUnit' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateMagicLinkAuthMethod` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateMagicLinkAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'ttl') + self.ttl = attributes[:'ttl'] + else + self.ttl = 300 + end + + if attributes.key?(:'ttl_display_unit') + self.ttl_display_unit = attributes[:'ttl_display_unit'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ttl.nil? && @ttl < 60 + invalid_properties.push('invalid value for "ttl", must be greater than or equal to 60.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ttl.nil? && @ttl < 60 + true + end + + # Custom attribute writer method with validation + # @param [Object] ttl Value to be assigned + def ttl=(ttl) + if ttl.nil? + fail ArgumentError, 'ttl cannot be nil' + end + + if ttl < 60 + fail ArgumentError, 'invalid value for "ttl", must be greater than or equal to 60.' + end + + @ttl = ttl + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + ttl == o.ttl && + ttl_display_unit == o.ttl_display_unit + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, ttl, ttl_display_unit].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/openapi_client/models/update_email_sms_auth_method.rb b/lib/openapi_client/models/update_otp_auth_method.rb similarity index 96% rename from lib/openapi_client/models/update_email_sms_auth_method.rb rename to lib/openapi_client/models/update_otp_auth_method.rb index d4d73bc..7e4e2b6 100644 --- a/lib/openapi_client/models/update_email_sms_auth_method.rb +++ b/lib/openapi_client/models/update_otp_auth_method.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class UpdateEmailSmsAuthMethod + class UpdateOtpAuthMethod attr_accessor :enabled # Maximum time (IN SECONDS) for the auth to expire. @@ -77,13 +77,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateEmailSmsAuthMethod` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateOtpAuthMethod` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateEmailSmsAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateOtpAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/lib/openapi_client/models/update_passkey_auth_method.rb b/lib/openapi_client/models/update_passkeys_auth_method.rb similarity index 95% rename from lib/openapi_client/models/update_passkey_auth_method.rb rename to lib/openapi_client/models/update_passkeys_auth_method.rb index 02f7164..86d4fbc 100644 --- a/lib/openapi_client/models/update_passkey_auth_method.rb +++ b/lib/openapi_client/models/update_passkeys_auth_method.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class UpdatePasskeyAuthMethod + class UpdatePasskeysAuthMethod attr_accessor :enabled # Attribute mapping from ruby-style variable name to JSON key. @@ -46,13 +46,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdatePasskeyAuthMethod` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdatePasskeysAuthMethod` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdatePasskeyAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdatePasskeysAuthMethod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v }