Class: ShopifyAPI::PriceRule
- Inherits:
-
Rest::Base
- Object
- Rest::Base
- ShopifyAPI::PriceRule
- Extended by:
- T::Sig
- Defined in:
- lib/shopify_api/rest/resources/2022_04/price_rule.rb,
lib/shopify_api/rest/resources/2022_07/price_rule.rb,
lib/shopify_api/rest/resources/2022_10/price_rule.rb,
lib/shopify_api/rest/resources/2023_01/price_rule.rb,
lib/shopify_api/rest/resources/2023_04/price_rule.rb,
lib/shopify_api/rest/resources/2023_07/price_rule.rb,
lib/shopify_api/rest/resources/2023_10/price_rule.rb,
lib/shopify_api/rest/resources/2024_01/price_rule.rb,
lib/shopify_api/rest/resources/2024_04/price_rule.rb,
lib/shopify_api/rest/resources/2024_07/price_rule.rb,
lib/shopify_api/rest/resources/2024_10/price_rule.rb
Instance Attribute Summary collapse
-
#allocation_limit ⇒ Object
readonly
Returns the value of attribute allocation_limit.
-
#allocation_method ⇒ Object
readonly
Returns the value of attribute allocation_method.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#customer_segment_prerequisite_ids ⇒ Object
readonly
Returns the value of attribute customer_segment_prerequisite_ids.
-
#customer_selection ⇒ Object
readonly
Returns the value of attribute customer_selection.
-
#ends_at ⇒ Object
readonly
Returns the value of attribute ends_at.
-
#entitled_collection_ids ⇒ Object
readonly
Returns the value of attribute entitled_collection_ids.
-
#entitled_country_ids ⇒ Object
readonly
Returns the value of attribute entitled_country_ids.
-
#entitled_product_ids ⇒ Object
readonly
Returns the value of attribute entitled_product_ids.
-
#entitled_variant_ids ⇒ Object
readonly
Returns the value of attribute entitled_variant_ids.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#once_per_customer ⇒ Object
readonly
Returns the value of attribute once_per_customer.
-
#prerequisite_collection_ids ⇒ Object
readonly
Returns the value of attribute prerequisite_collection_ids.
-
#prerequisite_customer_ids ⇒ Object
readonly
Returns the value of attribute prerequisite_customer_ids.
-
#prerequisite_product_ids ⇒ Object
readonly
Returns the value of attribute prerequisite_product_ids.
-
#prerequisite_quantity_range ⇒ Object
readonly
Returns the value of attribute prerequisite_quantity_range.
-
#prerequisite_shipping_price_range ⇒ Object
readonly
Returns the value of attribute prerequisite_shipping_price_range.
-
#prerequisite_subtotal_range ⇒ Object
readonly
Returns the value of attribute prerequisite_subtotal_range.
-
#prerequisite_to_entitlement_purchase ⇒ Object
readonly
Returns the value of attribute prerequisite_to_entitlement_purchase.
-
#prerequisite_to_entitlement_quantity_ratio ⇒ Object
readonly
Returns the value of attribute prerequisite_to_entitlement_quantity_ratio.
-
#prerequisite_variant_ids ⇒ Object
readonly
Returns the value of attribute prerequisite_variant_ids.
-
#starts_at ⇒ Object
readonly
Returns the value of attribute starts_at.
-
#target_selection ⇒ Object
readonly
Returns the value of attribute target_selection.
-
#target_type ⇒ Object
readonly
Returns the value of attribute target_type.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#usage_limit ⇒ Object
readonly
Returns the value of attribute usage_limit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#value_type ⇒ Object
readonly
Returns the value of attribute value_type.
Attributes inherited from Rest::Base
Class Method Summary collapse
- .all(limit: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, starts_at_min: nil, starts_at_max: nil, ends_at_min: nil, ends_at_max: nil, times_used: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .count(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
- .delete(id:, session: ShopifyAPI::Context.active_session) ⇒ Object
- .find(id:, session: ShopifyAPI::Context.active_session) ⇒ Object
Instance Method Summary collapse
-
#initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) ⇒ PriceRule
constructor
A new instance of PriceRule.
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) ⇒ PriceRule
Returns a new instance of PriceRule.
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 50 51 52 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 19 def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil) @allocation_limit = T.let(nil, T.nilable(Integer)) @allocation_method = T.let(nil, T.nilable(String)) @created_at = T.let(nil, T.nilable(String)) @customer_segment_prerequisite_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @customer_selection = T.let(nil, T.nilable(String)) @ends_at = T.let(nil, T.nilable(String)) @entitled_collection_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @entitled_country_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @entitled_product_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @entitled_variant_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @id = T.let(nil, T.nilable(Integer)) @once_per_customer = T.let(nil, T.nilable(T::Boolean)) @prerequisite_collection_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @prerequisite_customer_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @prerequisite_product_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @prerequisite_quantity_range = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @prerequisite_shipping_price_range = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @prerequisite_subtotal_range = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @prerequisite_to_entitlement_purchase = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @prerequisite_to_entitlement_quantity_ratio = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped])) @prerequisite_variant_ids = T.let(nil, T.nilable(T::Array[T.untyped])) @starts_at = T.let(nil, T.nilable(String)) @target_selection = T.let(nil, T.nilable(String)) @target_type = T.let(nil, T.nilable(String)) @title = T.let(nil, T.nilable(String)) @updated_at = T.let(nil, T.nilable(String)) @usage_limit = T.let(nil, T.nilable(Integer)) @value = T.let(nil, T.nilable(String)) @value_type = 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
#allocation_limit ⇒ Object (readonly)
Returns the value of attribute allocation_limit.
66 67 68 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 66 def allocation_limit @allocation_limit end |
#allocation_method ⇒ Object (readonly)
Returns the value of attribute allocation_method.
68 69 70 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 68 def allocation_method @allocation_method end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
70 71 72 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 70 def created_at @created_at end |
#customer_segment_prerequisite_ids ⇒ Object (readonly)
Returns the value of attribute customer_segment_prerequisite_ids.
72 73 74 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 72 def customer_segment_prerequisite_ids @customer_segment_prerequisite_ids end |
#customer_selection ⇒ Object (readonly)
Returns the value of attribute customer_selection.
74 75 76 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 74 def customer_selection @customer_selection end |
#ends_at ⇒ Object (readonly)
Returns the value of attribute ends_at.
76 77 78 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 76 def ends_at @ends_at end |
#entitled_collection_ids ⇒ Object (readonly)
Returns the value of attribute entitled_collection_ids.
78 79 80 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 78 def entitled_collection_ids @entitled_collection_ids end |
#entitled_country_ids ⇒ Object (readonly)
Returns the value of attribute entitled_country_ids.
80 81 82 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 80 def entitled_country_ids @entitled_country_ids end |
#entitled_product_ids ⇒ Object (readonly)
Returns the value of attribute entitled_product_ids.
82 83 84 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 82 def entitled_product_ids @entitled_product_ids end |
#entitled_variant_ids ⇒ Object (readonly)
Returns the value of attribute entitled_variant_ids.
84 85 86 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 84 def entitled_variant_ids @entitled_variant_ids end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
86 87 88 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 86 def id @id end |
#once_per_customer ⇒ Object (readonly)
Returns the value of attribute once_per_customer.
88 89 90 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 88 def once_per_customer @once_per_customer end |
#prerequisite_collection_ids ⇒ Object (readonly)
Returns the value of attribute prerequisite_collection_ids.
90 91 92 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 90 def prerequisite_collection_ids @prerequisite_collection_ids end |
#prerequisite_customer_ids ⇒ Object (readonly)
Returns the value of attribute prerequisite_customer_ids.
92 93 94 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 92 def prerequisite_customer_ids @prerequisite_customer_ids end |
#prerequisite_product_ids ⇒ Object (readonly)
Returns the value of attribute prerequisite_product_ids.
94 95 96 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 94 def prerequisite_product_ids @prerequisite_product_ids end |
#prerequisite_quantity_range ⇒ Object (readonly)
Returns the value of attribute prerequisite_quantity_range.
96 97 98 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 96 def prerequisite_quantity_range @prerequisite_quantity_range end |
#prerequisite_shipping_price_range ⇒ Object (readonly)
Returns the value of attribute prerequisite_shipping_price_range.
98 99 100 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 98 def prerequisite_shipping_price_range @prerequisite_shipping_price_range end |
#prerequisite_subtotal_range ⇒ Object (readonly)
Returns the value of attribute prerequisite_subtotal_range.
100 101 102 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 100 def prerequisite_subtotal_range @prerequisite_subtotal_range end |
#prerequisite_to_entitlement_purchase ⇒ Object (readonly)
Returns the value of attribute prerequisite_to_entitlement_purchase.
102 103 104 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 102 def prerequisite_to_entitlement_purchase @prerequisite_to_entitlement_purchase end |
#prerequisite_to_entitlement_quantity_ratio ⇒ Object (readonly)
Returns the value of attribute prerequisite_to_entitlement_quantity_ratio.
104 105 106 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 104 def prerequisite_to_entitlement_quantity_ratio @prerequisite_to_entitlement_quantity_ratio end |
#prerequisite_variant_ids ⇒ Object (readonly)
Returns the value of attribute prerequisite_variant_ids.
106 107 108 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 106 def prerequisite_variant_ids @prerequisite_variant_ids end |
#starts_at ⇒ Object (readonly)
Returns the value of attribute starts_at.
108 109 110 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 108 def starts_at @starts_at end |
#target_selection ⇒ Object (readonly)
Returns the value of attribute target_selection.
110 111 112 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 110 def target_selection @target_selection end |
#target_type ⇒ Object (readonly)
Returns the value of attribute target_type.
112 113 114 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 112 def target_type @target_type end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
114 115 116 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 114 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
116 117 118 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 116 def updated_at @updated_at end |
#usage_limit ⇒ Object (readonly)
Returns the value of attribute usage_limit.
118 119 120 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 118 def usage_limit @usage_limit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
120 121 122 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 120 def value @value end |
#value_type ⇒ Object (readonly)
Returns the value of attribute value_type.
122 123 124 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 122 def value_type @value_type end |
Class Method Details
.all(limit: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, starts_at_min: nil, starts_at_max: nil, ends_at_min: nil, ends_at_max: nil, times_used: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 179 def all( limit: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, starts_at_min: nil, starts_at_max: nil, ends_at_min: nil, ends_at_max: nil, times_used: nil, session: ShopifyAPI::Context.active_session, **kwargs ) response = base_find( session: session, ids: {}, params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, starts_at_min: starts_at_min, starts_at_max: starts_at_max, ends_at_min: ends_at_min, ends_at_max: ends_at_max, times_used: times_used}.merge(kwargs).compact, ) T.cast(response, T::Array[PriceRule]) end |
.count(session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 209 def count( session: ShopifyAPI::Context.active_session, **kwargs ) request( http_method: :get, operation: :count, session: session, ids: {}, params: {}.merge(kwargs).compact, body: {}, entity: nil, ) end |
.delete(id:, session: ShopifyAPI::Context.active_session) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 149 def delete( id:, session: ShopifyAPI::Context.active_session ) request( http_method: :delete, operation: :delete, session: session, ids: {id: id}, params: {}, ) end |
.find(id:, session: ShopifyAPI::Context.active_session) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 131 def find( id:, session: ShopifyAPI::Context.active_session ) result = base_find( session: session, ids: {id: id}, params: {}, ) T.cast(result[0], T.nilable(PriceRule)) end |