class Shopify::Order

Extended Modules

Defined in:

shopify/resources/order.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Shopify::Resource

store : Store store, store=(store : Store) store=

Constructor methods inherited from class Shopify::Resource

new(pull : JSON::PullParser) new

Class methods inherited from class Shopify::Resource

headers headers

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]

Class Method Detail

def self.all(domain : String, depth : Int32 = 20, headers : HTTP::Headers = headers) : Array(Shopify::Order) #

Used to return an array of orders. Uses fibers to fetch pages concurrently.

NOTE It is recommended to use .all(domain, next_page_uri, headers, &block) directly instead of this method as it is more performant.

Generally, this is used with .with(store):

Shopify::Order.with(store).all #=> Array(Shopify::Order)

But it can be used stand-alone, too:

Shopify::Order.all(domain, headers: headers) #=> Array(Shopify::Order)

This just runs the &block version of .all(domain, next_page_uri, headers, &block) to create an array


[View source]
def self.all(domain : String, next_page_uri : String? = nil, depth : Int32 = 20, headers : HTTP::Headers = headers, &block : self -> ) #

Used to iterate over all orders. Uses fibers to fetch pages concurrently.

Generally, this is used with .with(store):

Shopify::Order.with(store).all do |order|
  # do something with order
end

But it can be used stand-alone, too:

Shopify::Order.all(domain, headers: headers) do |order|
  # do something with order
end

Under the covers, this just runs:

GET
/admin/api/2022-01/orders.json

and follows every next Response Headers "Link" until there are no more.

Uses NextPreviousParser to parse the response headers.


[View source]
def self.count(domain : String, headers : HTTP::Headers = headers) : Int64 #

Used to get a count of all orders.

Generally, this is used with .with(store):

Shopify::Order.with(store).count #=> Int64

But it can be used stand-alone, too:

Shopify::Order.count(domain, headers: headers) #=> Int64

Under the covers, this just runs:

GET
/admin/api/2022-01/orders/count.json

[View source]
def self.create(body : String, domain : String, headers : HTTP::Headers = headers) : Shopify::Order #

Used to create one order.

Generally, this is used with .with(store):

Shopify::Order.with(store).create(body) #=> Shopify::Order

But it can be used stand-alone, too:

Shopify::Order.create(body, domain, headers: headers) #=> Shopify::Order

Under the covers, this just runs:

POST
/admin/api/2022-01/orders.json

[View source]
def self.find(id : Int64, domain : String, headers : HTTP::Headers = headers) : Shopify::Order #

Used to fetch one order.

Generally, this is used with .with(store):

Shopify::Order.with(store).find(id) #=> Shopify::Order

But it can be used stand-alone, too:

Shopify::Order.find(id, domain, headers: headers) #=> Shopify::Order

Under the covers, this just runs:

GET
/admin/api/2022-01/orders/{id}.json

[View source]
def self.uri(domain : String, path : String = "") : URI #

[View source]
def self.with(store : Store) #

[View source]

Instance Method Detail

def app_id : Int64 #

[View source]
def app_id=(app_id : Int64) #

[View source]
def billing_address : JSON::Any? #

[View source]
def billing_address=(billing_address : JSON::Any?) #

[View source]
def browser_ip : String? #

[View source]
def browser_ip=(browser_ip : String?) #

[View source]
def buyer_accepts_marketing : Bool #

[View source]
def buyer_accepts_marketing=(buyer_accepts_marketing : Bool) #

[View source]
def cancel : self #

Under the covers, this just runs:

POST
/admin/api/2022-01/orders/{id}/cancel.json

[View source]
def cancel_reason : String? #

[View source]
def cancel_reason=(cancel_reason : String?) #

[View source]
def cancelled_at : Time? #

[View source]
def cancelled_at=(cancelled_at : Time?) #

[View source]
def cart_token : String? #

[View source]
def cart_token=(cart_token : String?) #

[View source]
def checkout_token : String? #

[View source]
def checkout_token=(checkout_token : String?) #

[View source]
def client_details : JSON::Any? #

[View source]
def client_details=(client_details : JSON::Any?) #

[View source]
def close : self #

Under the covers, this just runs:

POST
/admin/api/2022-01/orders/{id}/close.json

[View source]
def closed_at : Time? #

[View source]
def closed_at=(closed_at : Time?) #

[View source]
def created_at : Time #

[View source]
def created_at=(created_at : Time) #

[View source]
def currency : String #

[View source]
def currency=(currency : String) #

[View source]
def current_subtotal_price : String #

[View source]
def current_subtotal_price=(current_subtotal_price : String) #

[View source]
def current_subtotal_price_set : JSON::Any #

[View source]
def current_subtotal_price_set=(current_subtotal_price_set : JSON::Any) #

[View source]
def current_total_discounts : String #

[View source]
def current_total_discounts=(current_total_discounts : String) #

[View source]
def current_total_discounts_set : JSON::Any #

[View source]
def current_total_discounts_set=(current_total_discounts_set : JSON::Any) #

[View source]
def current_total_duties_set : JSON::Any #

[View source]
def current_total_duties_set=(current_total_duties_set : JSON::Any) #

[View source]
def current_total_price : String #

[View source]
def current_total_price=(current_total_price : String) #

[View source]
def current_total_price_set : JSON::Any #

[View source]
def current_total_price_set=(current_total_price_set : JSON::Any) #

[View source]
def current_total_tax : String #

[View source]
def current_total_tax=(current_total_tax : String) #

[View source]
def current_total_tax_set : JSON::Any #

[View source]
def current_total_tax_set=(current_total_tax_set : JSON::Any) #

[View source]
def customer : JSON::Any? #

[View source]
def customer=(customer : JSON::Any?) #

[View source]
def customer_locale : String? #

[View source]
def customer_locale=(customer_locale : String?) #

[View source]
def delete #

Used to delete one order.

Under the covers, this just runs:

DELETE
/admin/api/2022-01/orders/{id}.json

[View source]
def discount_applications : JSON::Any #

[View source]
def discount_applications=(discount_applications : JSON::Any) #

[View source]
def discount_codes : Array(JSON::Any) #

[View source]
def discount_codes=(discount_codes : Array(JSON::Any)) #

[View source]
def email : String #

[View source]
def email=(email : String) #

[View source]
def estimated_taxes : Bool #

[View source]
def estimated_taxes=(estimated_taxes : Bool) #

[View source]
def financial_status : String #

[View source]
def financial_status=(financial_status : String) #

[View source]
def fulfillment_status : String? #

[View source]
def fulfillment_status=(fulfillment_status : String?) #

[View source]
def fulfillments : Array(JSON::Any) #

[View source]
def fulfillments=(fulfillments : Array(JSON::Any)) #

[View source]
def gateway : String #

[View source]
def gateway=(gateway : String) #

[View source]
def id : Int64 #

[View source]
def id=(id : Int64) #

[View source]
def landing_site : String? #

[View source]
def landing_site=(landing_site : String?) #

[View source]
def line_items : Array(JSON::Any) #

[View source]
def line_items=(line_items : Array(JSON::Any)) #

[View source]
def location_id : Int64? #

[View source]
def location_id=(location_id : Int64?) #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def note : String? #

[View source]
def note=(note : String?) #

[View source]
def note_attributes : Array(Hash(String, String)) #

[View source]
def note_attributes=(note_attributes : Array(Hash(String, String))) #

[View source]
def number : Int32 #

[View source]
def number=(number : Int32) #

[View source]
def open : self #

Under the covers, this just runs:

POST
/admin/api/2022-01/orders/{id}/open.json

[View source]
def order_number : Int32 #

[View source]
def order_number=(order_number : Int32) #

[View source]
def order_status_url : Hash(String, String) | String #

[View source]
def order_status_url=(order_status_url : Hash(String, String) | String) #

[View source]
def original_total_duties_set : JSON::Any #

[View source]
def original_total_duties_set=(original_total_duties_set : JSON::Any) #

[View source]
def payment_details : Hash(String, String)? #

[View source]
def payment_details=(payment_details : Hash(String, String)?) #

[View source]
def payment_gateway_names : Array(String) #

[View source]
def payment_gateway_names=(payment_gateway_names : Array(String)) #

[View source]
def payment_terms : JSON::Any #

[View source]
def payment_terms=(payment_terms : JSON::Any) #

[View source]
def phone : String? #

[View source]
def phone=(phone : String?) #

[View source]
def presentment_currency : String #

[View source]
def presentment_currency=(presentment_currency : String) #

[View source]
def processed_at : Time? #

[View source]
def processed_at=(processed_at : Time?) #

[View source]
def processing_method : String #

[View source]
def processing_method=(processing_method : String) #

[View source]
def referring_site : String? #

[View source]
def referring_site=(referring_site : String?) #

[View source]
def refunds : Array(JSON::Any) #

[View source]
def refunds=(refunds : Array(JSON::Any)) #

[View source]
def shipping_address : JSON::Any? #

[View source]
def shipping_address=(shipping_address : JSON::Any?) #

[View source]
def shipping_lines : Array(JSON::Any) #

[View source]
def shipping_lines=(shipping_lines : Array(JSON::Any)) #

[View source]
def source_name : String #

[View source]
def source_name=(source_name : String) #

[View source]
def subtotal_price : String | Int32 #

[View source]
def subtotal_price=(subtotal_price : String | Int32) #

[View source]
def subtotal_price_set : JSON::Any #

[View source]
def subtotal_price_set=(subtotal_price_set : JSON::Any) #

[View source]
def tags : String #

[View source]
def tags=(tags : String) #

[View source]
def tax_lines : Array(JSON::Any) #

[View source]
def tax_lines=(tax_lines : Array(JSON::Any)) #

[View source]
def taxes_included : Bool #

[View source]
def taxes_included=(taxes_included : Bool) #

[View source]
def test : Bool #

[View source]
def test=(test : Bool) #

[View source]
def token : String #

[View source]
def token=(token : String) #

[View source]
def total_discounts : String #

[View source]
def total_discounts=(total_discounts : String) #

[View source]
def total_discounts_set : JSON::Any #

[View source]
def total_discounts_set=(total_discounts_set : JSON::Any) #

[View source]
def total_line_items_price : String #

[View source]
def total_line_items_price=(total_line_items_price : String) #

[View source]
def total_line_items_price_set : JSON::Any #

[View source]
def total_line_items_price_set=(total_line_items_price_set : JSON::Any) #

[View source]
def total_outstanding : String #

[View source]
def total_outstanding=(total_outstanding : String) #

[View source]
def total_price : String #

[View source]
def total_price=(total_price : String) #

[View source]
def total_price_set : JSON::Any #

[View source]
def total_price_set=(total_price_set : JSON::Any) #

[View source]
def total_shipping_price_set : JSON::Any #

[View source]
def total_shipping_price_set=(total_shipping_price_set : JSON::Any) #

[View source]
def total_tax : String #

[View source]
def total_tax=(total_tax : String) #

[View source]
def total_tax_set : JSON::Any #

[View source]
def total_tax_set=(total_tax_set : JSON::Any) #

[View source]
def total_tip_received : String #

[View source]
def total_tip_received=(total_tip_received : String) #

[View source]
def total_weight : Int32 #

[View source]
def total_weight=(total_weight : Int32) #

[View source]
def update(body : String) : self #

Under the covers, this just runs:

PUT
/admin/api/2022-01/orders/{id}.json

[View source]
def updated_at : Time #

[View source]
def updated_at=(updated_at : Time) #

[View source]
def user_id : Int64? #

[View source]
def user_id=(user_id : Int64?) #

[View source]