Class: ShopifyAPI::Variant
- Inherits:
-
Rest::Base
- Object
- Rest::Base
- ShopifyAPI::Variant
- Extended by:
- T::Sig
- Defined in:
- lib/shopify_api/rest/resources/2021_07/variant.rb,
lib/shopify_api/rest/resources/2021_10/variant.rb,
lib/shopify_api/rest/resources/2022_01/variant.rb,
lib/shopify_api/rest/resources/2022_04/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) ⇒ Variant
constructor
A new instance of Variant.
Methods inherited from Rest::Base
base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, has_many?, has_one?, json_body_name, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, primary_key, request, #respond_to_missing?, #save, #save!, #to_hash
Constructor Details
#initialize(session: ShopifyAPI::Context.active_session) ⇒ Variant
Returns a new instance of Variant.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 12 def initialize(session: ShopifyAPI::Context.active_session) super(session: session) @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(Integer)) @inventory_quantity_adjustment = T.let(nil, T.nilable(Integer)) @old_inventory_quantity = T.let(nil, T.nilable(Integer)) @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(Integer)) @weight_unit = T.let(nil, T.nilable(String)) 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.
55 56 57 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 55 def @barcode end |
#compare_at_price ⇒ Object (readonly)
Returns the value of attribute compare_at_price.
57 58 59 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 57 def compare_at_price @compare_at_price end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
59 60 61 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 59 def created_at @created_at end |
#fulfillment_service ⇒ Object (readonly)
Returns the value of attribute fulfillment_service.
61 62 63 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 61 def fulfillment_service @fulfillment_service end |
#grams ⇒ Object (readonly)
Returns the value of attribute grams.
63 64 65 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 63 def grams @grams end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
65 66 67 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 65 def id @id end |
#image_id ⇒ Object (readonly)
Returns the value of attribute image_id.
67 68 69 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 67 def image_id @image_id end |
#inventory_item_id ⇒ Object (readonly)
Returns the value of attribute inventory_item_id.
69 70 71 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 69 def inventory_item_id @inventory_item_id end |
#inventory_management ⇒ Object (readonly)
Returns the value of attribute inventory_management.
71 72 73 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 71 def inventory_management @inventory_management end |
#inventory_policy ⇒ Object (readonly)
Returns the value of attribute inventory_policy.
73 74 75 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 73 def inventory_policy @inventory_policy end |
#inventory_quantity ⇒ Object (readonly)
Returns the value of attribute inventory_quantity.
75 76 77 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 75 def inventory_quantity @inventory_quantity end |
#inventory_quantity_adjustment ⇒ Object (readonly)
Returns the value of attribute inventory_quantity_adjustment.
77 78 79 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 77 def inventory_quantity_adjustment @inventory_quantity_adjustment end |
#old_inventory_quantity ⇒ Object (readonly)
Returns the value of attribute old_inventory_quantity.
79 80 81 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 79 def old_inventory_quantity @old_inventory_quantity end |
#option ⇒ Object (readonly)
Returns the value of attribute option.
81 82 83 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 81 def option @option end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
83 84 85 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 83 def position @position end |
#presentment_prices ⇒ Object (readonly)
Returns the value of attribute presentment_prices.
85 86 87 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 85 def presentment_prices @presentment_prices end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
87 88 89 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 87 def price @price end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
89 90 91 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 89 def product_id @product_id end |
#requires_shipping ⇒ Object (readonly)
Returns the value of attribute requires_shipping.
91 92 93 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 91 def requires_shipping @requires_shipping end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
93 94 95 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 93 def sku @sku end |
#tax_code ⇒ Object (readonly)
Returns the value of attribute tax_code.
95 96 97 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 95 def tax_code @tax_code end |
#taxable ⇒ Object (readonly)
Returns the value of attribute taxable.
97 98 99 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 97 def taxable @taxable end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
99 100 101 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 99 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
101 102 103 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 101 def updated_at @updated_at end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
103 104 105 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 103 def weight @weight end |
#weight_unit ⇒ Object (readonly)
Returns the value of attribute weight_unit.
105 106 107 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 105 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
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 160 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
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 185 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
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 135 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
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/shopify_api/rest/resources/2021_07/variant.rb', line 115 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 |