Class: ShopifyAPI::Variant
- Inherits:
-
Rest::Base
- Object
- Rest::Base
- ShopifyAPI::Variant
- Extended by:
- T::Sig
- Defined in:
- lib/shopify_api/rest/resources/2022_04/variant.rb,
lib/shopify_api/rest/resources/2022_07/variant.rb,
lib/shopify_api/rest/resources/2022_10/variant.rb,
lib/shopify_api/rest/resources/2023_01/variant.rb,
lib/shopify_api/rest/resources/2023_04/variant.rb,
lib/shopify_api/rest/resources/2023_07/variant.rb,
lib/shopify_api/rest/resources/2023_10/variant.rb,
lib/shopify_api/rest/resources/2024_01/variant.rb,
lib/shopify_api/rest/resources/2024_04/variant.rb,
lib/shopify_api/rest/resources/2024_07/variant.rb,
lib/shopify_api/rest/resources/2024_10/variant.rb
Instance Attribute Summary collapse
-
#barcode ⇒ Object
readonly
Returns the value of attribute barcode.
-
#compare_at_price ⇒ Object
readonly
Returns the value of attribute compare_at_price.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#fulfillment_service ⇒ Object
readonly
Returns the value of attribute fulfillment_service.
-
#grams ⇒ Object
readonly
Returns the value of attribute grams.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_id ⇒ Object
readonly
Returns the value of attribute image_id.
-
#inventory_item_id ⇒ Object
readonly
Returns the value of attribute inventory_item_id.
-
#inventory_management ⇒ Object
readonly
Returns the value of attribute inventory_management.
-
#inventory_policy ⇒ Object
readonly
Returns the value of attribute inventory_policy.
-
#inventory_quantity ⇒ Object
readonly
Returns the value of attribute inventory_quantity.
-
#inventory_quantity_adjustment ⇒ Object
readonly
Returns the value of attribute inventory_quantity_adjustment.
-
#old_inventory_quantity ⇒ Object
readonly
Returns the value of attribute old_inventory_quantity.
-
#option ⇒ Object
readonly
Returns the value of attribute option.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#presentment_prices ⇒ Object
readonly
Returns the value of attribute presentment_prices.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#requires_shipping ⇒ Object
readonly
Returns the value of attribute requires_shipping.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
-
#tax_code ⇒ Object
readonly
Returns the value of attribute tax_code.
-
#taxable ⇒ Object
readonly
Returns the value of attribute taxable.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
-
#weight_unit ⇒ Object
readonly
Returns the value of attribute weight_unit.
Attributes inherited from Rest::Base
Class Method Summary collapse
- .all(product_id: nil, limit: nil, presentment_currencies: nil, since_id: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .count(product_id: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .delete(id:, product_id: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
- .find(id:, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
Instance Method Summary collapse
-
#initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) ⇒ Variant
constructor
A new instance of Variant.
Methods inherited from Rest::Base
api_call_limit, base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, get_path_ids, has_many?, has_one?, inherited, json_body_name, json_response_body_names, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, primary_key, read_only_attributes, request, #respond_to_missing?, retry_request_after, #save, #save!, #to_hash
Constructor Details
#initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) ⇒ Variant
Returns a new instance of Variant.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 19 def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) @barcode = T.let(nil, T.nilable(String)) @compare_at_price = T.let(nil, T.nilable(String)) @created_at = T.let(nil, T.nilable(String)) @fulfillment_service = T.let(nil, T.nilable(String)) @grams = T.let(nil, T.nilable(Integer)) @id = T.let(nil, T.nilable(Integer)) @image_id = T.let(nil, T.nilable(Integer)) @inventory_item_id = T.let(nil, T.nilable(Integer)) @inventory_management = T.let(nil, T.nilable(String)) @inventory_policy = T.let(nil, T.nilable(String)) @inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String))) @inventory_quantity_adjustment = T.let(nil, T.nilable(T.any(Integer, String))) @old_inventory_quantity = T.let(nil, T.nilable(T.any(Integer, String))) @option = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @position = T.let(nil, T.nilable(Integer)) @presentment_prices = T.let(nil, T.nilable(T::Array[T.untyped])) @price = T.let(nil, T.nilable(String)) @product_id = T.let(nil, T.nilable(Integer)) @requires_shipping = T.let(nil, T.nilable(T::Boolean)) @sku = T.let(nil, T.nilable(String)) @tax_code = T.let(nil, T.nilable(String)) @taxable = T.let(nil, T.nilable(T::Boolean)) @title = T.let(nil, T.nilable(String)) @updated_at = T.let(nil, T.nilable(String)) @weight = T.let(nil, T.nilable(Float)) @weight_unit = T.let(nil, T.nilable(String)) super(session: session, from_hash: from_hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base
Instance Attribute Details
#barcode ⇒ Object (readonly)
Returns the value of attribute barcode.
67 68 69 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 67 def @barcode end |
#compare_at_price ⇒ Object (readonly)
Returns the value of attribute compare_at_price.
69 70 71 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 69 def compare_at_price @compare_at_price end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
71 72 73 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 71 def created_at @created_at end |
#fulfillment_service ⇒ Object (readonly)
Returns the value of attribute fulfillment_service.
73 74 75 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 73 def fulfillment_service @fulfillment_service end |
#grams ⇒ Object (readonly)
Returns the value of attribute grams.
75 76 77 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 75 def grams @grams end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
77 78 79 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 77 def id @id end |
#image_id ⇒ Object (readonly)
Returns the value of attribute image_id.
79 80 81 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 79 def image_id @image_id end |
#inventory_item_id ⇒ Object (readonly)
Returns the value of attribute inventory_item_id.
81 82 83 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 81 def inventory_item_id @inventory_item_id end |
#inventory_management ⇒ Object (readonly)
Returns the value of attribute inventory_management.
83 84 85 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 83 def inventory_management @inventory_management end |
#inventory_policy ⇒ Object (readonly)
Returns the value of attribute inventory_policy.
85 86 87 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 85 def inventory_policy @inventory_policy end |
#inventory_quantity ⇒ Object (readonly)
Returns the value of attribute inventory_quantity.
87 88 89 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 87 def inventory_quantity @inventory_quantity end |
#inventory_quantity_adjustment ⇒ Object (readonly)
Returns the value of attribute inventory_quantity_adjustment.
89 90 91 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 89 def inventory_quantity_adjustment @inventory_quantity_adjustment end |
#old_inventory_quantity ⇒ Object (readonly)
Returns the value of attribute old_inventory_quantity.
91 92 93 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 91 def old_inventory_quantity @old_inventory_quantity end |
#option ⇒ Object (readonly)
Returns the value of attribute option.
93 94 95 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 93 def option @option end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
95 96 97 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 95 def position @position end |
#presentment_prices ⇒ Object (readonly)
Returns the value of attribute presentment_prices.
97 98 99 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 97 def presentment_prices @presentment_prices end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
99 100 101 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 99 def price @price end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
101 102 103 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 101 def product_id @product_id end |
#requires_shipping ⇒ Object (readonly)
Returns the value of attribute requires_shipping.
103 104 105 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 103 def requires_shipping @requires_shipping end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
105 106 107 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 105 def sku @sku end |
#tax_code ⇒ Object (readonly)
Returns the value of attribute tax_code.
107 108 109 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 107 def tax_code @tax_code end |
#taxable ⇒ Object (readonly)
Returns the value of attribute taxable.
109 110 111 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 109 def taxable @taxable end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
111 112 113 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 111 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
113 114 115 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 113 def updated_at @updated_at end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
115 116 117 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 115 def weight @weight end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
117 118 119 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 117 def weight_unit @weight_unit end |
Class Method Details
.all(product_id: nil, limit: nil, presentment_currencies: nil, since_id: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 172 def all( product_id: nil, limit: nil, presentment_currencies: nil, since_id: nil, fields: nil, session: ShopifyAPI::Context.active_session, **kwargs ) response = base_find( session: session, ids: {product_id: product_id}, params: {limit: limit, presentment_currencies: presentment_currencies, since_id: since_id, fields: fields}.merge(kwargs).compact, ) T.cast(response, T::Array[Variant]) end |
.count(product_id: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 197 def count( product_id: nil, session: ShopifyAPI::Context.active_session, **kwargs ) request( http_method: :get, operation: :count, session: session, ids: {product_id: product_id}, params: {}.merge(kwargs).compact, body: {}, entity: nil, ) end |
.delete(id:, product_id: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 147 def delete( id:, product_id: nil, session: ShopifyAPI::Context.active_session ) request( http_method: :delete, operation: :delete, session: session, ids: {id: id, product_id: product_id}, params: {}, ) end |
.find(id:, fields: nil, session: ShopifyAPI::Context.active_session) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/shopify_api/rest/resources/2022_04/variant.rb', line 127 def find( id:, fields: nil, session: ShopifyAPI::Context.active_session ) result = base_find( session: session, ids: {id: id}, params: {fields: fields}, ) T.cast(result[0], T.nilable(Variant)) end |