Class: ShopifyAPI::Checkout

Inherits:
Base
  • Object
show all
Defined in:
lib/shopify_api/resources/checkout.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

activate_session, api_version, api_version=, #as_json, clear_session, early_july_pagination?, #encode, init_prefix, init_prefix_explicit, #persisted?, prefix, prefix=, prefix_source, resource_prefix, resource_prefix=, version_validation!

Methods included from Countable

#count

Class Method Details

.headersObject


7
8
9
# File 'lib/shopify_api/resources/checkout.rb', line 7

def self.headers
  super.merge('X-Shopify-Checkout-Version' => '2016-09-06')
end

Instance Method Details

#completeObject


11
12
13
# File 'lib/shopify_api/resources/checkout.rb', line 11

def complete
  post(:complete)
end

#paymentsObject


22
23
24
# File 'lib/shopify_api/resources/checkout.rb', line 22

def payments
  Payment.find(:all, params: { checkout_id: id })
end

#ready?Boolean

Returns:

  • (Boolean)

15
16
17
18
19
20
# File 'lib/shopify_api/resources/checkout.rb', line 15

def ready?
  return false unless persisted?

  reload
  [200, 201].include?(ShopifyAPI::Base.connection.response.code.to_i)
end

#shipping_ratesObject


26
27
28
# File 'lib/shopify_api/resources/checkout.rb', line 26

def shipping_rates
  ShippingRate.find(:all, params: { checkout_id: id })
end