Class: ShopifyAPI::Checkout

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/checkout.rb,
lib/shopify_api/rest/resources/2022_07/checkout.rb,
lib/shopify_api/rest/resources/2022_10/checkout.rb,
lib/shopify_api/rest/resources/2023_01/checkout.rb,
lib/shopify_api/rest/resources/2023_04/checkout.rb,
lib/shopify_api/rest/resources/2023_07/checkout.rb,
lib/shopify_api/rest/resources/2023_10/checkout.rb,
lib/shopify_api/rest/resources/2024_01/checkout.rb,
lib/shopify_api/rest/resources/2024_04/checkout.rb,
lib/shopify_api/rest/resources/2024_07/checkout.rb,
lib/shopify_api/rest/resources/2024_10/checkout.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

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, 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) ⇒ Checkout

Returns a new instance of Checkout.



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
53
54
55
56
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 19

def initialize(session: ShopifyAPI::Context.active_session, from_hash: nil)

  @billing_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
  @applied_discount = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @buyer_accepts_marketing = T.let(nil, T.nilable(T::Boolean))
  @created_at = T.let(nil, T.nilable(String))
  @currency = T.let(nil, T.nilable(String))
  @customer_id = T.let(nil, T.nilable(Integer))
  @discount_code = T.let(nil, T.nilable(DiscountCode))
  @email = T.let(nil, T.nilable(String))
  @gift_cards = T.let(nil, T.nilable(T::Array[T.untyped]))
  @order = T.let(nil, T.nilable(Order))
  @payment_due = T.let(nil, T.nilable(String))
  @payment_url = T.let(nil, T.nilable(String))
  @phone = T.let(nil, T.nilable(String))
  @presentment_currency = T.let(nil, T.nilable(String))
  @requires_shipping = T.let(nil, T.nilable(T::Boolean))
  @reservation_time = T.let(nil, T.nilable(String))
  @reservation_time_left = T.let(nil, T.nilable(Integer))
  @shipping_address = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @shipping_line = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @shipping_rate = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @source_identifier = T.let(nil, T.nilable(String))
  @source_name = T.let(nil, T.nilable(String))
  @source_url = T.let(nil, T.nilable(String))
  @subtotal_price = T.let(nil, T.nilable(String))
  @tax_lines = T.let(nil, T.nilable(T::Array[T.untyped]))
  @taxes_included = T.let(nil, T.nilable(T::Boolean))
  @token = T.let(nil, T.nilable(String))
  @total_price = T.let(nil, T.nilable(String))
  @total_tax = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))
  @user_id = T.let(nil, T.nilable(Integer))
  @web_url = 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

#applied_discountObject (readonly)

Returns the value of attribute applied_discount.



78
79
80
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 78

def applied_discount
  @applied_discount
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



74
75
76
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 74

def billing_address
  @billing_address
end

#buyer_accepts_marketingObject (readonly)

Returns the value of attribute buyer_accepts_marketing.



80
81
82
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 80

def buyer_accepts_marketing
  @buyer_accepts_marketing
end

#created_atObject (readonly)

Returns the value of attribute created_at.



82
83
84
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 82

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



84
85
86
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 84

def currency
  @currency
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



86
87
88
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 86

def customer_id
  @customer_id
end

#discount_codeObject (readonly)

Returns the value of attribute discount_code.



88
89
90
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 88

def discount_code
  @discount_code
end

#emailObject (readonly)

Returns the value of attribute email.



90
91
92
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 90

def email
  @email
end

#gift_cardsObject (readonly)

Returns the value of attribute gift_cards.



92
93
94
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 92

def gift_cards
  @gift_cards
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



76
77
78
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 76

def line_items
  @line_items
end

#orderObject (readonly)

Returns the value of attribute order.



94
95
96
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 94

def order
  @order
end

#payment_dueObject (readonly)

Returns the value of attribute payment_due.



96
97
98
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 96

def payment_due
  @payment_due
end

#payment_urlObject (readonly)

Returns the value of attribute payment_url.



98
99
100
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 98

def payment_url
  @payment_url
end

#phoneObject (readonly)

Returns the value of attribute phone.



100
101
102
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 100

def phone
  @phone
end

#presentment_currencyObject (readonly)

Returns the value of attribute presentment_currency.



102
103
104
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 102

def presentment_currency
  @presentment_currency
end

#requires_shippingObject (readonly)

Returns the value of attribute requires_shipping.



104
105
106
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 104

def requires_shipping
  @requires_shipping
end

#reservation_timeObject (readonly)

Returns the value of attribute reservation_time.



106
107
108
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 106

def reservation_time
  @reservation_time
end

#reservation_time_leftObject (readonly)

Returns the value of attribute reservation_time_left.



108
109
110
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 108

def reservation_time_left
  @reservation_time_left
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



110
111
112
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 110

def shipping_address
  @shipping_address
end

#shipping_lineObject (readonly)

Returns the value of attribute shipping_line.



112
113
114
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 112

def shipping_line
  @shipping_line
end

#shipping_rateObject (readonly)

Returns the value of attribute shipping_rate.



114
115
116
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 114

def shipping_rate
  @shipping_rate
end

#source_identifierObject (readonly)

Returns the value of attribute source_identifier.



116
117
118
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 116

def source_identifier
  @source_identifier
end

#source_nameObject (readonly)

Returns the value of attribute source_name.



118
119
120
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 118

def source_name
  @source_name
end

#source_urlObject (readonly)

Returns the value of attribute source_url.



120
121
122
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 120

def source_url
  @source_url
end

#subtotal_priceObject (readonly)

Returns the value of attribute subtotal_price.



122
123
124
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 122

def subtotal_price
  @subtotal_price
end

#tax_linesObject (readonly)

Returns the value of attribute tax_lines.



124
125
126
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 124

def tax_lines
  @tax_lines
end

#taxes_includedObject (readonly)

Returns the value of attribute taxes_included.



126
127
128
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 126

def taxes_included
  @taxes_included
end

#tokenObject (readonly)

Returns the value of attribute token.



128
129
130
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 128

def token
  @token
end

#total_priceObject (readonly)

Returns the value of attribute total_price.



130
131
132
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 130

def total_price
  @total_price
end

#total_taxObject (readonly)

Returns the value of attribute total_tax.



132
133
134
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 132

def total_tax
  @total_tax
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



134
135
136
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 134

def updated_at
  @updated_at
end

#user_idObject (readonly)

Returns the value of attribute user_id.



136
137
138
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 136

def user_id
  @user_id
end

#web_urlObject (readonly)

Returns the value of attribute web_url.



138
139
140
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 138

def web_url
  @web_url
end

Class Method Details

.find(token:, session: ShopifyAPI::Context.active_session) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 154

def find(
  token:,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {token: token},
    params: {},
  )
  T.cast(result[0], T.nilable(Checkout))
end

.primary_keyObject



144
145
146
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 144

def primary_key()
  "token"
end

.shipping_rates(token:, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 173

def shipping_rates(
  token:,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :shipping_rates,
    session: session,
    ids: {token: token},
    params: {}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

Instance Method Details

#complete(body: nil, **kwargs) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 197

def complete(
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :complete,
    session: @session,
    ids: {token: @token},
    params: {}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end