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

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, json_response_body_names, #method_missing, next_page?, next_page_info, prev_page?, prev_page_info, read_only_attributes, request, #respond_to_missing?, #save, #save!, #to_hash

Constructor Details

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

Returns a new instance of Checkout.



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
45
46
47
48
49
50
51
52
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 16

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

  @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))
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.



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

def applied_discount
  @applied_discount
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



70
71
72
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 70

def billing_address
  @billing_address
end

#buyer_accepts_marketingObject (readonly)

Returns the value of attribute buyer_accepts_marketing.



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

def buyer_accepts_marketing
  @buyer_accepts_marketing
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



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

def customer_id
  @customer_id
end

#discount_codeObject (readonly)

Returns the value of attribute discount_code.



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

def discount_code
  @discount_code
end

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#gift_cardsObject (readonly)

Returns the value of attribute gift_cards.



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

def gift_cards
  @gift_cards
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.



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

def line_items
  @line_items
end

#orderObject (readonly)

Returns the value of attribute order.



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

def order
  @order
end

#payment_dueObject (readonly)

Returns the value of attribute payment_due.



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

def payment_due
  @payment_due
end

#payment_urlObject (readonly)

Returns the value of attribute payment_url.



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

def payment_url
  @payment_url
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

#presentment_currencyObject (readonly)

Returns the value of attribute presentment_currency.



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

def presentment_currency
  @presentment_currency
end

#requires_shippingObject (readonly)

Returns the value of attribute requires_shipping.



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

def requires_shipping
  @requires_shipping
end

#reservation_timeObject (readonly)

Returns the value of attribute reservation_time.



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

def reservation_time
  @reservation_time
end

#reservation_time_leftObject (readonly)

Returns the value of attribute reservation_time_left.



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

def reservation_time_left
  @reservation_time_left
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



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

def shipping_address
  @shipping_address
end

#shipping_lineObject (readonly)

Returns the value of attribute shipping_line.



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

def shipping_line
  @shipping_line
end

#shipping_rateObject (readonly)

Returns the value of attribute shipping_rate.



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

def shipping_rate
  @shipping_rate
end

#source_identifierObject (readonly)

Returns the value of attribute source_identifier.



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

def source_identifier
  @source_identifier
end

#source_nameObject (readonly)

Returns the value of attribute source_name.



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

def source_name
  @source_name
end

#source_urlObject (readonly)

Returns the value of attribute source_url.



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

def source_url
  @source_url
end

#subtotal_priceObject (readonly)

Returns the value of attribute subtotal_price.



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

def subtotal_price
  @subtotal_price
end

#tax_linesObject (readonly)

Returns the value of attribute tax_lines.



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

def tax_lines
  @tax_lines
end

#taxes_includedObject (readonly)

Returns the value of attribute taxes_included.



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

def taxes_included
  @taxes_included
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#total_priceObject (readonly)

Returns the value of attribute total_price.



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

def total_price
  @total_price
end

#total_taxObject (readonly)

Returns the value of attribute total_tax.



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

def total_tax
  @total_tax
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#user_idObject (readonly)

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

#web_urlObject (readonly)

Returns the value of attribute web_url.



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

def web_url
  @web_url
end

Class Method Details

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



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 150

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



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

def primary_key()
  "token"
end

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



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 169

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



193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/shopify_api/rest/resources/2022_04/checkout.rb', line 193

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