Class: Inttegro::Product::Updated

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/product/updated.rb

Overview

Typed representation of the updated object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#about ⇒ String? (readonly)

Value of the about field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: about.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#category ⇒ String? (readonly)

Value of the category field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: category.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#created_at ⇒ Time (readonly)

Value of the created_at field in the Inttegro API payload.

Required in the API payload. Wire name: created_at.

Returns:

  • (Time)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#custom_data ⇒ Inttegro::CustomData? (readonly)

Merchant-defined string values attached to a resource. SDKs expose this as a semantic collection rather than a raw map.

Optional in the API payload; omitted values default to nil. Wire name: custom_data.

Returns:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#description ⇒ String? (readonly)

Value of the description field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: description.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#dimensions ⇒ Inttegro::Product::Dimensions? (readonly)

At most one of physical, digital, or custom.

Optional in the API payload; omitted values default to nil. Wire name: dimensions.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#id ⇒ String (readonly)

Product identifier returned by the update operation.

Required in the API payload. Wire name: id.

Returns:

  • (String)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#name ⇒ String (readonly)

Value of the name field in the Inttegro API payload.

Required in the API payload. Wire name: name.

Returns:

  • (String)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#prices ⇒ Array<Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary>? (readonly)

Value of the prices field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: prices.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#reference ⇒ String? (readonly)

Value of the reference field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: reference.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#tax_code ⇒ String? (readonly)

Value of the tax_code field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: tax_code.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#type ⇒ Inttegro::Product::Type (readonly)

Value of the type field in the Inttegro API payload.

Required in the API payload. Wire name: type.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#unit_dim ⇒ String? (readonly)

Value of the unit_dim field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: unit_dim.

Returns:

  • (String, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

#updated_at ⇒ Time? (readonly)

Value of the updated_at field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: updated_at.

Returns:

  • (Time, nil)


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/inttegro/product/updated.rb', line 107

class Updated < T::Struct
  const :id, String
  const :name, String
  const :description, T.nilable(String), default: nil
  const :about, T.nilable(String), default: nil
  const :type, Inttegro::Product::Type
  const :reference, T.nilable(String), default: nil
  const :tax_code, T.nilable(String), default: nil
  const :category, T.nilable(String), default: nil
  const :custom_data, T.nilable(Inttegro::CustomData), default: nil
  const :dimensions, T.nilable(Inttegro::Product::Dimensions), default: nil
  const :prices, T.nilable(T::Array[T.any(Inttegro::Product::FixedPriceSummary, Inttegro::Customer::SelectedProductPriceSummary)]), default: nil
  const :unit_dim, T.nilable(String), default: nil
  const :created_at, Time
  const :updated_at, T.nilable(Time), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (prices_value = data["prices"]).is_a?(Array)
      data["prices"] = prices_value.map do |item|
        next item unless item.is_a?(Hash)
        case item["type"]
        when "fixed_amount"
          Inttegro::Product::FixedPriceSummary.from_hash(item)
        when "customer_selected_amount"
          Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
        else
          item
        end
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/inttegro/product/updated.rb', line 126

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (prices_value = data["prices"]).is_a?(Array)
    data["prices"] = prices_value.map do |item|
      next item unless item.is_a?(Hash)
      case item["type"]
      when "fixed_amount"
        Inttegro::Product::FixedPriceSummary.from_hash(item)
      when "customer_selected_amount"
        Inttegro::Customer::SelectedProductPriceSummary.from_hash(item)
      else
        item
      end
    end
  end
  super(data, strict)
end