diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index ca6ed5e..6ccfd91 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -15,7 +15,6 @@ lib/tremendous/models/channel.rb lib/tremendous/models/create_api_key200_response.rb lib/tremendous/models/create_campaign201_response.rb lib/tremendous/models/create_campaign_request.rb -lib/tremendous/models/create_invoice.rb lib/tremendous/models/create_invoice200_response.rb lib/tremendous/models/create_invoice_request.rb lib/tremendous/models/create_member.rb @@ -28,7 +27,6 @@ lib/tremendous/models/create_organization200_response.rb lib/tremendous/models/create_organization200_response_organization.rb lib/tremendous/models/create_organization_request.rb lib/tremendous/models/create_organization_request_copy_settings.rb -lib/tremendous/models/create_public_key.rb lib/tremendous/models/create_webhook200_response.rb lib/tremendous/models/create_webhook_request.rb lib/tremendous/models/currency_codes.rb @@ -138,7 +136,6 @@ lib/tremendous/models/organization.rb lib/tremendous/models/payment_details.rb lib/tremendous/models/payment_details_refund.rb lib/tremendous/models/product.rb -lib/tremendous/models/public_key.rb lib/tremendous/models/recipient.rb lib/tremendous/models/refund_details.rb lib/tremendous/models/resend_reward422_response.rb @@ -162,15 +159,12 @@ lib/tremendous/models/reward_without_link_delivery.rb lib/tremendous/models/role.rb lib/tremendous/models/simulate_webhook_request.rb lib/tremendous/models/single_reward_order.rb -lib/tremendous/models/single_reward_order1.rb -lib/tremendous/models/single_reward_order1_payment.rb -lib/tremendous/models/single_reward_order1_reward.rb -lib/tremendous/models/single_reward_order1_reward_custom_fields_inner.rb -lib/tremendous/models/single_reward_order1_reward_delivery.rb +lib/tremendous/models/single_reward_order_payment.rb lib/tremendous/models/single_reward_order_reward.rb +lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb +lib/tremendous/models/single_reward_order_reward_delivery.rb lib/tremendous/models/single_reward_order_without_link.rb lib/tremendous/models/single_reward_order_without_link_order.rb -lib/tremendous/models/test_public_key.rb lib/tremendous/models/update_campaign.rb lib/tremendous/models/update_campaign_request.rb lib/tremendous/models/update_fraud_rule_list200_response.rb diff --git a/lib/tremendous.rb b/lib/tremendous.rb index 7b956d5..c6da843 100644 --- a/lib/tremendous.rb +++ b/lib/tremendous.rb @@ -29,7 +29,6 @@ require 'tremendous/models/create_api_key200_response' require 'tremendous/models/create_campaign201_response' require 'tremendous/models/create_campaign_request' -require 'tremendous/models/create_invoice' require 'tremendous/models/create_invoice200_response' require 'tremendous/models/create_invoice_request' require 'tremendous/models/create_member' @@ -42,7 +41,6 @@ require 'tremendous/models/create_organization200_response_organization' require 'tremendous/models/create_organization_request' require 'tremendous/models/create_organization_request_copy_settings' -require 'tremendous/models/create_public_key' require 'tremendous/models/create_webhook200_response' require 'tremendous/models/create_webhook_request' require 'tremendous/models/currency_codes' @@ -152,7 +150,6 @@ require 'tremendous/models/payment_details' require 'tremendous/models/payment_details_refund' require 'tremendous/models/product' -require 'tremendous/models/public_key' require 'tremendous/models/recipient' require 'tremendous/models/refund_details' require 'tremendous/models/resend_reward422_response' @@ -176,15 +173,12 @@ require 'tremendous/models/role' require 'tremendous/models/simulate_webhook_request' require 'tremendous/models/single_reward_order' -require 'tremendous/models/single_reward_order1' -require 'tremendous/models/single_reward_order1_payment' -require 'tremendous/models/single_reward_order1_reward' -require 'tremendous/models/single_reward_order1_reward_custom_fields_inner' -require 'tremendous/models/single_reward_order1_reward_delivery' +require 'tremendous/models/single_reward_order_payment' require 'tremendous/models/single_reward_order_reward' +require 'tremendous/models/single_reward_order_reward_custom_fields_inner' +require 'tremendous/models/single_reward_order_reward_delivery' require 'tremendous/models/single_reward_order_without_link' require 'tremendous/models/single_reward_order_without_link_order' -require 'tremendous/models/test_public_key' require 'tremendous/models/update_campaign' require 'tremendous/models/update_campaign_request' require 'tremendous/models/update_fraud_rule_list200_response' diff --git a/lib/tremendous/models/base_order_for_create.rb b/lib/tremendous/models/base_order_for_create.rb index a153613..a69bc6d 100644 --- a/lib/tremendous/models/base_order_for_create.rb +++ b/lib/tremendous/models/base_order_for_create.rb @@ -37,7 +37,7 @@ def self.acceptable_attributes def self.openapi_types { :'external_id' => :'String', - :'payment' => :'SingleRewardOrder1Payment' + :'payment' => :'SingleRewardOrderPayment' } end diff --git a/lib/tremendous/models/create_invoice.rb b/lib/tremendous/models/create_invoice.rb deleted file mode 100644 index abfe982..0000000 --- a/lib/tremendous/models/create_invoice.rb +++ /dev/null @@ -1,244 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - class CreateInvoice - # Reference to the purchase order number within your organization - attr_accessor :po_number - - # Amount of the invoice in USD - attr_accessor :amount - - # A note to be included in the invoice. This is for your internal use and will not be visible to the recipient. - attr_accessor :memo - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'po_number' => :'po_number', - :'amount' => :'amount', - :'memo' => :'memo' - } - 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 - { - :'po_number' => :'String', - :'amount' => :'Float', - :'memo' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'po_number', - :'memo' - ]) - 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 `Tremendous::CreateInvoice` 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 `Tremendous::CreateInvoice`. 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?(:'po_number') - self.po_number = attributes[:'po_number'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - else - self.amount = nil - end - - if attributes.key?(:'memo') - self.memo = attributes[:'memo'] - 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 @amount.nil? - invalid_properties.push('invalid value for "amount", amount 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 @amount.nil? - true - 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 && - po_number == o.po_number && - amount == o.amount && - memo == o.memo - 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 - [po_number, amount, memo].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 = Tremendous.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/tremendous/models/create_order_request.rb b/lib/tremendous/models/create_order_request.rb index 2d7699a..159a220 100644 --- a/lib/tremendous/models/create_order_request.rb +++ b/lib/tremendous/models/create_order_request.rb @@ -19,7 +19,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'SingleRewardOrder1' + :'SingleRewardOrder' ] end diff --git a/lib/tremendous/models/create_public_key.rb b/lib/tremendous/models/create_public_key.rb deleted file mode 100644 index 14d71ac..0000000 --- a/lib/tremendous/models/create_public_key.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - class CreatePublicKey - # Base64 encoded (public) PEM file - attr_accessor :public_key - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'public_key' => :'public_key' - } - 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 - { - :'public_key' => :'String' - } - 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 `Tremendous::CreatePublicKey` 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 `Tremendous::CreatePublicKey`. 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?(:'public_key') - self.public_key = attributes[:'public_key'] - else - self.public_key = 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 @public_key.nil? - invalid_properties.push('invalid value for "public_key", public_key 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 @public_key.nil? - true - 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 && - public_key == o.public_key - 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 - [public_key].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 = Tremendous.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/tremendous/models/fraud_rules_list_item.rb b/lib/tremendous/models/fraud_rules_list_item.rb index 03b323c..be68916 100644 --- a/lib/tremendous/models/fraud_rules_list_item.rb +++ b/lib/tremendous/models/fraud_rules_list_item.rb @@ -61,7 +61,7 @@ def self.acceptable_attributes def self.openapi_types { :'rule_type' => :'String', - :'config' => :'Object' + :'config' => :'Hash' } end @@ -92,7 +92,9 @@ def initialize(attributes = {}) end if attributes.key?(:'config') - self.config = attributes[:'config'] + if (value = attributes[:'config']).is_a?(Hash) + self.config = value + end end end diff --git a/lib/tremendous/models/invoice.rb b/lib/tremendous/models/invoice.rb index 8530914..bbefc15 100644 --- a/lib/tremendous/models/invoice.rb +++ b/lib/tremendous/models/invoice.rb @@ -25,6 +25,8 @@ class Invoice # Amount of the invoice in USD attr_accessor :amount + attr_accessor :international + # Status of this invoice
Status Description
DELETED Invoice has been deleted by your organization
PAID Invoice has been paid by your organization
OPEN Invoice has been created by your organization but has not been paid, yet
attr_accessor :status @@ -68,6 +70,7 @@ def self.attribute_map :'id' => :'id', :'po_number' => :'po_number', :'amount' => :'amount', + :'international' => :'international', :'status' => :'status', :'orders' => :'orders', :'rewards' => :'rewards', @@ -87,6 +90,7 @@ def self.openapi_types :'id' => :'String', :'po_number' => :'String', :'amount' => :'Float', + :'international' => :'Boolean', :'status' => :'String', :'orders' => :'Array', :'rewards' => :'Array', @@ -134,6 +138,10 @@ def initialize(attributes = {}) self.amount = nil end + if attributes.key?(:'international') + self.international = attributes[:'international'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] else @@ -220,6 +228,7 @@ def ==(o) id == o.id && po_number == o.po_number && amount == o.amount && + international == o.international && status == o.status && orders == o.orders && rewards == o.rewards && @@ -236,7 +245,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, po_number, amount, status, orders, rewards, created_at, paid_at].hash + [id, po_number, amount, international, status, orders, rewards, created_at, paid_at].hash end # Builds the object from hash diff --git a/lib/tremendous/models/list_fraud_reviews200_response.rb b/lib/tremendous/models/list_fraud_reviews200_response.rb index 2ad229b..4390e75 100644 --- a/lib/tremendous/models/list_fraud_reviews200_response.rb +++ b/lib/tremendous/models/list_fraud_reviews200_response.rb @@ -17,10 +17,14 @@ module Tremendous class ListFraudReviews200Response attr_accessor :fraud_reviews + # The total number of fraud reviews + attr_accessor :total_count + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'fraud_reviews' => :'fraud_reviews' + :'fraud_reviews' => :'fraud_reviews', + :'total_count' => :'total_count' } end @@ -32,7 +36,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'fraud_reviews' => :'Array' + :'fraud_reviews' => :'Array', + :'total_count' => :'Integer' } end @@ -64,6 +69,12 @@ def initialize(attributes = {}) else self.fraud_reviews = nil end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + else + self.total_count = nil + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -75,6 +86,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "fraud_reviews", fraud_reviews cannot be nil.') end + if @total_count.nil? + invalid_properties.push('invalid value for "total_count", total_count cannot be nil.') + end + invalid_properties end @@ -83,6 +98,7 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @fraud_reviews.nil? + return false if @total_count.nil? true end @@ -91,7 +107,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - fraud_reviews == o.fraud_reviews + fraud_reviews == o.fraud_reviews && + total_count == o.total_count end # @see the `==` method @@ -103,7 +120,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [fraud_reviews].hash + [fraud_reviews, total_count].hash end # Builds the object from hash diff --git a/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb b/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb index 497e16f..fcef3f9 100644 --- a/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +++ b/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb @@ -61,7 +61,7 @@ def self.acceptable_attributes def self.openapi_types { :'rule_type' => :'String', - :'config' => :'Object' + :'config' => :'Hash' } end @@ -92,7 +92,9 @@ def initialize(attributes = {}) end if attributes.key?(:'config') - self.config = attributes[:'config'] + if (value = attributes[:'config']).is_a?(Hash) + self.config = value + end end end diff --git a/lib/tremendous/models/list_invoices200_response_invoices_inner.rb b/lib/tremendous/models/list_invoices200_response_invoices_inner.rb index fcda4c2..dd530e0 100644 --- a/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +++ b/lib/tremendous/models/list_invoices200_response_invoices_inner.rb @@ -25,6 +25,8 @@ class ListInvoices200ResponseInvoicesInner # Amount of the invoice in USD attr_accessor :amount + attr_accessor :international + # Status of this invoice
Status Description
DELETED Invoice has been deleted by your organization
PAID Invoice has been paid by your organization
OPEN Invoice has been created by your organization but has not been paid, yet
attr_accessor :status @@ -68,6 +70,7 @@ def self.attribute_map :'id' => :'id', :'po_number' => :'po_number', :'amount' => :'amount', + :'international' => :'international', :'status' => :'status', :'orders' => :'orders', :'rewards' => :'rewards', @@ -87,6 +90,7 @@ def self.openapi_types :'id' => :'String', :'po_number' => :'String', :'amount' => :'Float', + :'international' => :'Boolean', :'status' => :'String', :'orders' => :'Array', :'rewards' => :'Array', @@ -134,6 +138,10 @@ def initialize(attributes = {}) self.amount = nil end + if attributes.key?(:'international') + self.international = attributes[:'international'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] else @@ -220,6 +228,7 @@ def ==(o) id == o.id && po_number == o.po_number && amount == o.amount && + international == o.international && status == o.status && orders == o.orders && rewards == o.rewards && @@ -236,7 +245,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, po_number, amount, status, orders, rewards, created_at, paid_at].hash + [id, po_number, amount, international, status, orders, rewards, created_at, paid_at].hash end # Builds the object from hash diff --git a/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb b/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb index 8502803..6d1b1b1 100644 --- a/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +++ b/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb @@ -27,39 +27,13 @@ class ListOrders200ResponseOrdersInnerPayment attr_accessor :refund - # Name of the channel in which the order was created - attr_accessor :channel - - 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 { :'subtotal' => :'subtotal', :'total' => :'total', :'fees' => :'fees', - :'refund' => :'refund', - :'channel' => :'channel' + :'refund' => :'refund' } end @@ -74,8 +48,7 @@ def self.openapi_types :'subtotal' => :'Float', :'total' => :'Float', :'fees' => :'Float', - :'refund' => :'ListOrders200ResponseOrdersInnerPaymentRefund', - :'channel' => :'String' + :'refund' => :'ListOrders200ResponseOrdersInnerPaymentRefund' } end @@ -115,10 +88,6 @@ def initialize(attributes = {}) if attributes.key?(:'refund') self.refund = attributes[:'refund'] end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -148,8 +117,6 @@ def valid? return false if !@subtotal.nil? && @subtotal < 0 return false if !@total.nil? && @total < 0 return false if !@fees.nil? && @fees < 0 - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end @@ -195,16 +162,6 @@ def fees=(fees) @fees = fees end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -213,8 +170,7 @@ def ==(o) subtotal == o.subtotal && total == o.total && fees == o.fees && - refund == o.refund && - channel == o.channel + refund == o.refund end # @see the `==` method @@ -226,7 +182,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [subtotal, total, fees, refund, channel].hash + [subtotal, total, fees, refund].hash end # Builds the object from hash diff --git a/lib/tremendous/models/list_rewards401_response_errors.rb b/lib/tremendous/models/list_rewards401_response_errors.rb index b2c5bc2..379fba8 100644 --- a/lib/tremendous/models/list_rewards401_response_errors.rb +++ b/lib/tremendous/models/list_rewards401_response_errors.rb @@ -38,7 +38,7 @@ def self.acceptable_attributes def self.openapi_types { :'message' => :'String', - :'payload' => :'Object' + :'payload' => :'Hash' } end @@ -68,7 +68,9 @@ def initialize(attributes = {}) end if attributes.key?(:'payload') - self.payload = attributes[:'payload'] + if (value = attributes[:'payload']).is_a?(Hash) + self.payload = value + end end end diff --git a/lib/tremendous/models/order_base_payment.rb b/lib/tremendous/models/order_base_payment.rb index 3b5868c..6390a25 100644 --- a/lib/tremendous/models/order_base_payment.rb +++ b/lib/tremendous/models/order_base_payment.rb @@ -27,39 +27,13 @@ class OrderBasePayment attr_accessor :refund - # Name of the channel in which the order was created - attr_accessor :channel - - 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 { :'subtotal' => :'subtotal', :'total' => :'total', :'fees' => :'fees', - :'refund' => :'refund', - :'channel' => :'channel' + :'refund' => :'refund' } end @@ -74,8 +48,7 @@ def self.openapi_types :'subtotal' => :'Float', :'total' => :'Float', :'fees' => :'Float', - :'refund' => :'PaymentDetailsRefund', - :'channel' => :'String' + :'refund' => :'PaymentDetailsRefund' } end @@ -115,10 +88,6 @@ def initialize(attributes = {}) if attributes.key?(:'refund') self.refund = attributes[:'refund'] end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -148,8 +117,6 @@ def valid? return false if !@subtotal.nil? && @subtotal < 0 return false if !@total.nil? && @total < 0 return false if !@fees.nil? && @fees < 0 - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end @@ -195,16 +162,6 @@ def fees=(fees) @fees = fees end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -213,8 +170,7 @@ def ==(o) subtotal == o.subtotal && total == o.total && fees == o.fees && - refund == o.refund && - channel == o.channel + refund == o.refund end # @see the `==` method @@ -226,7 +182,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [subtotal, total, fees, refund, channel].hash + [subtotal, total, fees, refund].hash end # Builds the object from hash diff --git a/lib/tremendous/models/payment_details.rb b/lib/tremendous/models/payment_details.rb index 93febd4..0af65bc 100644 --- a/lib/tremendous/models/payment_details.rb +++ b/lib/tremendous/models/payment_details.rb @@ -26,39 +26,13 @@ class PaymentDetails attr_accessor :refund - # Name of the channel in which the order was created - attr_accessor :channel - - 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 { :'subtotal' => :'subtotal', :'total' => :'total', :'fees' => :'fees', - :'refund' => :'refund', - :'channel' => :'channel' + :'refund' => :'refund' } end @@ -73,8 +47,7 @@ def self.openapi_types :'subtotal' => :'Float', :'total' => :'Float', :'fees' => :'Float', - :'refund' => :'PaymentDetailsRefund', - :'channel' => :'String' + :'refund' => :'PaymentDetailsRefund' } end @@ -114,10 +87,6 @@ def initialize(attributes = {}) if attributes.key?(:'refund') self.refund = attributes[:'refund'] end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -147,8 +116,6 @@ def valid? return false if !@subtotal.nil? && @subtotal < 0 return false if !@total.nil? && @total < 0 return false if !@fees.nil? && @fees < 0 - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end @@ -194,16 +161,6 @@ def fees=(fees) @fees = fees end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -212,8 +169,7 @@ def ==(o) subtotal == o.subtotal && total == o.total && fees == o.fees && - refund == o.refund && - channel == o.channel + refund == o.refund end # @see the `==` method @@ -225,7 +181,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [subtotal, total, fees, refund, channel].hash + [subtotal, total, fees, refund].hash end # Builds the object from hash diff --git a/lib/tremendous/models/public_key.rb b/lib/tremendous/models/public_key.rb deleted file mode 100644 index efa64a1..0000000 --- a/lib/tremendous/models/public_key.rb +++ /dev/null @@ -1,257 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - # To authenticate your requests using asymmetric key pairs (e.g., for signing embed requests), you need to share your public key with us. The public key resource allows you to manage your active public keys and track their last usage. - class PublicKey - attr_accessor :id - - # Your public key, PEM encoded - attr_accessor :pem - - # The last time your public key was used to sign a request - attr_accessor :last_used_at - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'pem' => :'pem', - :'last_used_at' => :'last_used_at' - } - 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 - { - :'id' => :'String', - :'pem' => :'String', - :'last_used_at' => :'Time' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'last_used_at' - ]) - 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 `Tremendous::PublicKey` 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 `Tremendous::PublicKey`. 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?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'pem') - self.pem = attributes[:'pem'] - end - - if attributes.key?(:'last_used_at') - self.last_used_at = attributes[:'last_used_at'] - 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 - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@id.nil? && @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - 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 !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) - true - end - - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - 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 && - id == o.id && - pem == o.pem && - last_used_at == o.last_used_at - 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 - [id, pem, last_used_at].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 = Tremendous.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/tremendous/models/reward_for_order_create.rb b/lib/tremendous/models/reward_for_order_create.rb index 8cbfdf4..aad0e09 100644 --- a/lib/tremendous/models/reward_for_order_create.rb +++ b/lib/tremendous/models/reward_for_order_create.rb @@ -80,7 +80,7 @@ def self.openapi_types :'deliver_at' => :'Date', :'custom_fields' => :'Array', :'language' => :'String', - :'delivery' => :'SingleRewardOrder1RewardDelivery' + :'delivery' => :'SingleRewardOrderRewardDelivery' } end diff --git a/lib/tremendous/models/single_reward_order.rb b/lib/tremendous/models/single_reward_order.rb index 28691a4..98128a2 100644 --- a/lib/tremendous/models/single_reward_order.rb +++ b/lib/tremendous/models/single_reward_order.rb @@ -41,7 +41,7 @@ def self.acceptable_attributes def self.openapi_types { :'external_id' => :'String', - :'payment' => :'SingleRewardOrder1Payment', + :'payment' => :'SingleRewardOrderPayment', :'reward' => :'SingleRewardOrderReward' } end diff --git a/lib/tremendous/models/single_reward_order1.rb b/lib/tremendous/models/single_reward_order1.rb deleted file mode 100644 index ee95752..0000000 --- a/lib/tremendous/models/single_reward_order1.rb +++ /dev/null @@ -1,242 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - # An order that contains a single reward. The reward is sent to a single recipient. - class SingleRewardOrder1 - # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only. - attr_accessor :external_id - - attr_accessor :payment - - attr_accessor :reward - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'external_id' => :'external_id', - :'payment' => :'payment', - :'reward' => :'reward' - } - 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 - { - :'external_id' => :'String', - :'payment' => :'SingleRewardOrder1Payment', - :'reward' => :'SingleRewardOrder1Reward' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'external_id', - ]) - 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 `Tremendous::SingleRewardOrder1` 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 `Tremendous::SingleRewardOrder1`. 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?(:'external_id') - self.external_id = attributes[:'external_id'] - end - - if attributes.key?(:'payment') - self.payment = attributes[:'payment'] - end - - if attributes.key?(:'reward') - self.reward = attributes[:'reward'] - else - self.reward = 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 @reward.nil? - invalid_properties.push('invalid value for "reward", reward 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 @reward.nil? - true - 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 && - external_id == o.external_id && - payment == o.payment && - reward == o.reward - 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 - [external_id, payment, reward].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 = Tremendous.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/tremendous/models/single_reward_order1_reward.rb b/lib/tremendous/models/single_reward_order1_reward.rb deleted file mode 100644 index a515e79..0000000 --- a/lib/tremendous/models/single_reward_order1_reward.rb +++ /dev/null @@ -1,323 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. - class SingleRewardOrder1Reward - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. - attr_accessor :campaign_id - - # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel. - attr_accessor :products - - attr_accessor :value - - attr_accessor :recipient - - # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. - attr_accessor :deliver_at - - attr_accessor :custom_fields - - # Set this to translate the redemption experience for this reward. Pass a 2-letter [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the desired language. Defaults to `en`. - attr_accessor :language - - attr_accessor :delivery - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'campaign_id' => :'campaign_id', - :'products' => :'products', - :'value' => :'value', - :'recipient' => :'recipient', - :'deliver_at' => :'deliver_at', - :'custom_fields' => :'custom_fields', - :'language' => :'language', - :'delivery' => :'delivery' - } - 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 - { - :'campaign_id' => :'String', - :'products' => :'Array', - :'value' => :'ListRewards200ResponseRewardsInnerValue', - :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', - :'deliver_at' => :'Date', - :'custom_fields' => :'Array', - :'language' => :'String', - :'delivery' => :'SingleRewardOrder1RewardDelivery' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'campaign_id', - ]) - 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 `Tremendous::SingleRewardOrder1Reward` 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 `Tremendous::SingleRewardOrder1Reward`. 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?(:'campaign_id') - self.campaign_id = attributes[:'campaign_id'] - end - - if attributes.key?(:'products') - if (value = attributes[:'products']).is_a?(Array) - self.products = value - end - end - - if attributes.key?(:'value') - self.value = attributes[:'value'] - end - - if attributes.key?(:'recipient') - self.recipient = attributes[:'recipient'] - end - - if attributes.key?(:'deliver_at') - self.deliver_at = attributes[:'deliver_at'] - end - - if attributes.key?(:'custom_fields') - if (value = attributes[:'custom_fields']).is_a?(Array) - self.custom_fields = value - end - end - - if attributes.key?(:'language') - self.language = attributes[:'language'] - end - - if attributes.key?(:'delivery') - self.delivery = attributes[:'delivery'] - 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 - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@campaign_id.nil? && @campaign_id !~ pattern - invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") - end - - if !@products.nil? && @products.length < 1 - invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') - 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 !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) - return false if !@products.nil? && @products.length < 1 - true - end - - # Custom attribute writer method with validation - # @param [Object] campaign_id Value to be assigned - def campaign_id=(campaign_id) - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !campaign_id.nil? && campaign_id !~ pattern - fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." - end - - @campaign_id = campaign_id - end - - # Custom attribute writer method with validation - # @param [Object] products Value to be assigned - def products=(products) - if products.nil? - fail ArgumentError, 'products cannot be nil' - end - - if products.length < 1 - fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' - end - - @products = products - 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 && - campaign_id == o.campaign_id && - products == o.products && - value == o.value && - recipient == o.recipient && - deliver_at == o.deliver_at && - custom_fields == o.custom_fields && - language == o.language && - delivery == o.delivery - 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 - [campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].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 = Tremendous.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/tremendous/models/single_reward_order1_payment.rb b/lib/tremendous/models/single_reward_order_payment.rb similarity index 96% rename from lib/tremendous/models/single_reward_order1_payment.rb rename to lib/tremendous/models/single_reward_order_payment.rb index ed07423..a3c3187 100644 --- a/lib/tremendous/models/single_reward_order1_payment.rb +++ b/lib/tremendous/models/single_reward_order_payment.rb @@ -14,7 +14,7 @@ require 'time' module Tremendous - class SingleRewardOrder1Payment + class SingleRewardOrderPayment # Tremendous ID of the funding source that will be used to pay for the order. Use `balance` to use your Tremendous's balance. attr_accessor :funding_source_id @@ -47,13 +47,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 `Tremendous::SingleRewardOrder1Payment` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrderPayment` 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 `Tremendous::SingleRewardOrder1Payment`. 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 `Tremendous::SingleRewardOrderPayment`. 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/tremendous/models/single_reward_order_reward.rb b/lib/tremendous/models/single_reward_order_reward.rb index 0bbce7a..9595706 100644 --- a/lib/tremendous/models/single_reward_order_reward.rb +++ b/lib/tremendous/models/single_reward_order_reward.rb @@ -16,15 +16,6 @@ module Tremendous # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. class SingleRewardOrderReward - # Tremendous ID of the reward - attr_accessor :id - - # Tremendous ID of the order this reward is part of. - attr_accessor :order_id - - # Date the reward was created - attr_accessor :created_at - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id @@ -48,9 +39,6 @@ class SingleRewardOrderReward # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'id' => :'id', - :'order_id' => :'order_id', - :'created_at' => :'created_at', :'campaign_id' => :'campaign_id', :'products' => :'products', :'value' => :'value', @@ -70,17 +58,14 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'id' => :'String', - :'order_id' => :'String', - :'created_at' => :'Time', :'campaign_id' => :'String', :'products' => :'Array', :'value' => :'ListRewards200ResponseRewardsInnerValue', :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', :'deliver_at' => :'Date', - :'custom_fields' => :'Array', + :'custom_fields' => :'Array', :'language' => :'String', - :'delivery' => :'SingleRewardOrder1RewardDelivery' + :'delivery' => :'SingleRewardOrderRewardDelivery' } end @@ -106,18 +91,6 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'order_id') - self.order_id = attributes[:'order_id'] - end - - if attributes.key?(:'created_at') - self.created_at = attributes[:'created_at'] - end - if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] end @@ -160,16 +133,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@id.nil? && @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@order_id.nil? && @order_id !~ pattern - invalid_properties.push("invalid value for \"order_id\", must conform to the pattern #{pattern}.") - end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) if !@campaign_id.nil? && @campaign_id !~ pattern invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") @@ -186,43 +149,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) - return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if !@products.nil? && @products.length < 1 true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - - # Custom attribute writer method with validation - # @param [Object] order_id Value to be assigned - def order_id=(order_id) - if order_id.nil? - fail ArgumentError, 'order_id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if order_id !~ pattern - fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." - end - - @order_id = order_id - end - # Custom attribute writer method with validation # @param [Object] campaign_id Value to be assigned def campaign_id=(campaign_id) @@ -253,9 +184,6 @@ def products=(products) def ==(o) return true if self.equal?(o) self.class == o.class && - id == o.id && - order_id == o.order_id && - created_at == o.created_at && campaign_id == o.campaign_id && products == o.products && value == o.value && @@ -275,7 +203,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash + [campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash end # Builds the object from hash diff --git a/lib/tremendous/models/single_reward_order1_reward_custom_fields_inner.rb b/lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb similarity index 96% rename from lib/tremendous/models/single_reward_order1_reward_custom_fields_inner.rb rename to lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb index 04dd996..8ae2f29 100644 --- a/lib/tremendous/models/single_reward_order1_reward_custom_fields_inner.rb +++ b/lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb @@ -15,7 +15,7 @@ module Tremendous # Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/reference/using-custom-fields-to-add-custom-data-to-rewards).) - class SingleRewardOrder1RewardCustomFieldsInner + class SingleRewardOrderRewardCustomFieldsInner # Tremendous ID of the custom field attr_accessor :id @@ -54,13 +54,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 `Tremendous::SingleRewardOrder1RewardCustomFieldsInner` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrderRewardCustomFieldsInner` 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 `Tremendous::SingleRewardOrder1RewardCustomFieldsInner`. 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 `Tremendous::SingleRewardOrderRewardCustomFieldsInner`. 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/tremendous/models/single_reward_order1_reward_delivery.rb b/lib/tremendous/models/single_reward_order_reward_delivery.rb similarity index 96% rename from lib/tremendous/models/single_reward_order1_reward_delivery.rb rename to lib/tremendous/models/single_reward_order_reward_delivery.rb index 61c89ca..e070ac5 100644 --- a/lib/tremendous/models/single_reward_order1_reward_delivery.rb +++ b/lib/tremendous/models/single_reward_order_reward_delivery.rb @@ -15,7 +15,7 @@ module Tremendous # Details on how the reward is delivered to the recipient. - class SingleRewardOrder1RewardDelivery + class SingleRewardOrderRewardDelivery # How to deliver the reward to the recipient.
Delivery Method Description
EMAIL Deliver the reward to the recipient by email
LINK

Deliver the reward to the recipient via a link.

The link can be retrieved on a successfully ordered reward via the /rewards or /rewards/{id} endpoint. That link must then be delivered to the recipient out-of-band.

PHONE Deliver the reward to the recipient by SMS
attr_accessor :method @@ -70,13 +70,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 `Tremendous::SingleRewardOrder1RewardDelivery` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrderRewardDelivery` 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 `Tremendous::SingleRewardOrder1RewardDelivery`. 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 `Tremendous::SingleRewardOrderRewardDelivery`. 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/tremendous/models/test_public_key.rb b/lib/tremendous/models/test_public_key.rb deleted file mode 100644 index a5860b4..0000000 --- a/lib/tremendous/models/test_public_key.rb +++ /dev/null @@ -1,222 +0,0 @@ -=begin -#API Endpoints - -#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. - -The version of the OpenAPI document: 2 -Contact: developers@tremendous.com -Generated by: https://openapi-generator.tech -Generator version: 7.8.0 - -=end - -require 'date' -require 'time' - -module Tremendous - class TestPublicKey - # A JWT token encoded with RS256, signed using the RSA private key corresponding to your public key. - attr_accessor :jwt - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'jwt' => :'jwt' - } - 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 - { - :'jwt' => :'String' - } - 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 `Tremendous::TestPublicKey` 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 `Tremendous::TestPublicKey`. 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?(:'jwt') - self.jwt = attributes[:'jwt'] - else - self.jwt = 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 @jwt.nil? - invalid_properties.push('invalid value for "jwt", jwt 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 @jwt.nil? - true - 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 && - jwt == o.jwt - 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 - [jwt].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 = Tremendous.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