Class: ShopifyAPI::PriceRule

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2021_07/price_rule.rb,
lib/shopify_api/rest/resources/2021_10/price_rule.rb,
lib/shopify_api/rest/resources/2022_01/price_rule.rb,
lib/shopify_api/rest/resources/2022_04/price_rule.rb

Instance Attribute Summary collapse

Attributes inherited from Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

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, read_only_attributes, request, #respond_to_missing?, #save, #save!, #to_hash

Constructor Details

#initialize(session: ShopifyAPI::Context.active_session) ⇒ PriceRule

Returns a new instance of PriceRule.


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
42
43
44
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 12

def initialize(session: ShopifyAPI::Context.active_session)
  super(session: session)

  @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_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_saved_search_ids = T.let(nil, T.nilable(T::Array[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))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#allocation_limitObject (readonly)

Returns the value of attribute allocation_limit.


58
59
60
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 58

def allocation_limit
  @allocation_limit
end

#allocation_methodObject (readonly)

Returns the value of attribute allocation_method.


60
61
62
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 60

def allocation_method
  @allocation_method
end

#created_atObject (readonly)

Returns the value of attribute created_at.


62
63
64
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 62

def created_at
  @created_at
end

#customer_segment_prerequisite_idsObject (readonly)

Returns the value of attribute customer_segment_prerequisite_ids.


64
65
66
# File 'lib/shopify_api/rest/resources/2022_04/price_rule.rb', line 64

def customer_segment_prerequisite_ids
  @customer_segment_prerequisite_ids
end

#customer_selectionObject (readonly)

Returns the value of attribute customer_selection.


64
65
66
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 64

def customer_selection
  @customer_selection
end

#ends_atObject (readonly)

Returns the value of attribute ends_at.


66
67
68
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 66

def ends_at
  @ends_at
end

#entitled_collection_idsObject (readonly)

Returns the value of attribute entitled_collection_ids.


68
69
70
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 68

def entitled_collection_ids
  @entitled_collection_ids
end

#entitled_country_idsObject (readonly)

Returns the value of attribute entitled_country_ids.


70
71
72
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 70

def entitled_country_ids
  @entitled_country_ids
end

#entitled_product_idsObject (readonly)

Returns the value of attribute entitled_product_ids.


72
73
74
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 72

def entitled_product_ids
  @entitled_product_ids
end

#entitled_variant_idsObject (readonly)

Returns the value of attribute entitled_variant_ids.


74
75
76
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 74

def entitled_variant_ids
  @entitled_variant_ids
end

#idObject (readonly)

Returns the value of attribute id.


76
77
78
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 76

def id
  @id
end

#once_per_customerObject (readonly)

Returns the value of attribute once_per_customer.


78
79
80
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 78

def once_per_customer
  @once_per_customer
end

#prerequisite_collection_idsObject (readonly)

Returns the value of attribute prerequisite_collection_ids.


80
81
82
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 80

def prerequisite_collection_ids
  @prerequisite_collection_ids
end

#prerequisite_customer_idsObject (readonly)

Returns the value of attribute prerequisite_customer_ids.


82
83
84
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 82

def prerequisite_customer_ids
  @prerequisite_customer_ids
end

#prerequisite_product_idsObject (readonly)

Returns the value of attribute prerequisite_product_ids.


84
85
86
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 84

def prerequisite_product_ids
  @prerequisite_product_ids
end

#prerequisite_quantity_rangeObject (readonly)

Returns the value of attribute prerequisite_quantity_range.


86
87
88
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 86

def prerequisite_quantity_range
  @prerequisite_quantity_range
end

#prerequisite_saved_search_idsObject (readonly)

Returns the value of attribute prerequisite_saved_search_ids.


88
89
90
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 88

def prerequisite_saved_search_ids
  @prerequisite_saved_search_ids
end

#prerequisite_shipping_price_rangeObject (readonly)

Returns the value of attribute prerequisite_shipping_price_range.


90
91
92
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 90

def prerequisite_shipping_price_range
  @prerequisite_shipping_price_range
end

#prerequisite_subtotal_rangeObject (readonly)

Returns the value of attribute prerequisite_subtotal_range.


92
93
94
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 92

def prerequisite_subtotal_range
  @prerequisite_subtotal_range
end

#prerequisite_to_entitlement_purchaseObject (readonly)

Returns the value of attribute prerequisite_to_entitlement_purchase.


94
95
96
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 94

def prerequisite_to_entitlement_purchase
  @prerequisite_to_entitlement_purchase
end

#prerequisite_to_entitlement_quantity_ratioObject (readonly)

Returns the value of attribute prerequisite_to_entitlement_quantity_ratio.


96
97
98
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 96

def prerequisite_to_entitlement_quantity_ratio
  @prerequisite_to_entitlement_quantity_ratio
end

#prerequisite_variant_idsObject (readonly)

Returns the value of attribute prerequisite_variant_ids.


98
99
100
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 98

def prerequisite_variant_ids
  @prerequisite_variant_ids
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.


100
101
102
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 100

def starts_at
  @starts_at
end

#target_selectionObject (readonly)

Returns the value of attribute target_selection.


102
103
104
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 102

def target_selection
  @target_selection
end

#target_typeObject (readonly)

Returns the value of attribute target_type.


104
105
106
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 104

def target_type
  @target_type
end

#titleObject (readonly)

Returns the value of attribute title.


106
107
108
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 106

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.


108
109
110
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 108

def updated_at
  @updated_at
end

#usage_limitObject (readonly)

Returns the value of attribute usage_limit.


110
111
112
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 110

def usage_limit
  @usage_limit
end

#valueObject (readonly)

Returns the value of attribute value.


112
113
114
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 112

def value
  @value
end

#value_typeObject (readonly)

Returns the value of attribute value_type.


114
115
116
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 114

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


171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 171

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


201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 201

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


141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 141

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


123
124
125
126
127
128
129
130
131
132
133
# File 'lib/shopify_api/rest/resources/2021_07/price_rule.rb', line 123

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