Class: ShopifyAPI::Checkout

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


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
45
46
47
48
# File 'lib/shopify_api/rest/resources/2021_07/checkout.rb', line 12

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.


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

def applied_discount
  @applied_discount
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.


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

def billing_address
  @billing_address
end

#buyer_accepts_marketingObject (readonly)

Returns the value of attribute buyer_accepts_marketing.


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

def buyer_accepts_marketing
  @buyer_accepts_marketing
end

#created_atObject (readonly)

Returns the value of attribute created_at.


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

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.


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

def currency
  @currency
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.


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

def customer_id
  @customer_id
end

#discount_codeObject (readonly)

Returns the value of attribute discount_code.


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

def discount_code
  @discount_code
end

#emailObject (readonly)

Returns the value of attribute email.


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

def email
  @email
end

#gift_cardsObject (readonly)

Returns the value of attribute gift_cards.


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

def gift_cards
  @gift_cards
end

#line_itemsObject (readonly)

Returns the value of attribute line_items.


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

def line_items
  @line_items
end

#orderObject (readonly)

Returns the value of attribute order.


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

def order
  @order
end

#payment_dueObject (readonly)

Returns the value of attribute payment_due.


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

def payment_due
  @payment_due
end

#payment_urlObject (readonly)

Returns the value of attribute payment_url.


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

def payment_url
  @payment_url
end

#phoneObject (readonly)

Returns the value of attribute phone.


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

def phone
  @phone
end

#presentment_currencyObject (readonly)

Returns the value of attribute presentment_currency.


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

def presentment_currency
  @presentment_currency
end

#requires_shippingObject (readonly)

Returns the value of attribute requires_shipping.


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

def requires_shipping
  @requires_shipping
end

#reservation_timeObject (readonly)

Returns the value of attribute reservation_time.


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

def reservation_time
  @reservation_time
end

#reservation_time_leftObject (readonly)

Returns the value of attribute reservation_time_left.


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

def reservation_time_left
  @reservation_time_left
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.


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

def shipping_address
  @shipping_address
end

#shipping_lineObject (readonly)

Returns the value of attribute shipping_line.


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

def shipping_line
  @shipping_line
end

#shipping_rateObject (readonly)

Returns the value of attribute shipping_rate.


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

def shipping_rate
  @shipping_rate
end

#source_identifierObject (readonly)

Returns the value of attribute source_identifier.


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

def source_identifier
  @source_identifier
end

#source_nameObject (readonly)

Returns the value of attribute source_name.


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

def source_name
  @source_name
end

#source_urlObject (readonly)

Returns the value of attribute source_url.


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

def source_url
  @source_url
end

#subtotal_priceObject (readonly)

Returns the value of attribute subtotal_price.


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

def subtotal_price
  @subtotal_price
end

#tax_linesObject (readonly)

Returns the value of attribute tax_lines.


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

def tax_lines
  @tax_lines
end

#taxes_includedObject (readonly)

Returns the value of attribute taxes_included.


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

def taxes_included
  @taxes_included
end

#tokenObject (readonly)

Returns the value of attribute token.


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

def token
  @token
end

#total_priceObject (readonly)

Returns the value of attribute total_price.


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

def total_price
  @total_price
end

#total_taxObject (readonly)

Returns the value of attribute total_tax.


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

def total_tax
  @total_tax
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.


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

def updated_at
  @updated_at
end

#user_idObject (readonly)

Returns the value of attribute user_id.


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

def user_id
  @user_id
end

#web_urlObject (readonly)

Returns the value of attribute web_url.


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

def web_url
  @web_url
end

Class Method Details

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


146
147
148
149
150
151
152
153
154
155
156
# File 'lib/shopify_api/rest/resources/2021_07/checkout.rb', line 146

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


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

def primary_key()
  "token"
end

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


165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/shopify_api/rest/resources/2021_07/checkout.rb', line 165

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


189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/shopify_api/rest/resources/2021_07/checkout.rb', line 189

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