class Shopify::Order
- Shopify::Order
- Shopify::Resource
- Reference
- Object
Extended Modules
- Shopify::Resource::ClassMethods
Defined in:
shopify/resources/order.crConstructors
Class Method Summary
-
.all(domain : String, depth : Int32 = 20, headers : HTTP::Headers = headers) : Array(Shopify::Order)
Used to return an array of orders.
-
.all(domain : String, next_page_uri : String? = nil, depth : Int32 = 20, headers : HTTP::Headers = headers, &block : self -> )
Used to iterate over all orders.
-
.count(domain : String, headers : HTTP::Headers = headers) : Int64
Used to get a count of all orders.
-
.create(body : String, domain : String, headers : HTTP::Headers = headers) : Shopify::Order
Used to create one order.
-
.find(id : Int64, domain : String, headers : HTTP::Headers = headers) : Shopify::Order
Used to fetch one order.
- .uri(domain : String, path : String = "") : URI
- .with(store : Store)
Instance Method Summary
- #app_id : Int64
- #app_id=(app_id : Int64)
- #billing_address : JSON::Any?
- #billing_address=(billing_address : JSON::Any?)
- #browser_ip : String?
- #browser_ip=(browser_ip : String?)
- #buyer_accepts_marketing : Bool
- #buyer_accepts_marketing=(buyer_accepts_marketing : Bool)
-
#cancel : self
Under the covers, this just runs:
plaintext POST /admin/api/2022-01/orders/{id}/cancel.json
- #cancel_reason : String?
- #cancel_reason=(cancel_reason : String?)
- #cancelled_at : Time?
- #cancelled_at=(cancelled_at : Time?)
- #cart_token : String?
- #cart_token=(cart_token : String?)
- #checkout_token : String?
- #checkout_token=(checkout_token : String?)
- #client_details : JSON::Any?
- #client_details=(client_details : JSON::Any?)
-
#close : self
Under the covers, this just runs:
plaintext POST /admin/api/2022-01/orders/{id}/close.json
- #closed_at : Time?
- #closed_at=(closed_at : Time?)
- #created_at : Time
- #created_at=(created_at : Time)
- #currency : String
- #currency=(currency : String)
- #current_subtotal_price : String
- #current_subtotal_price=(current_subtotal_price : String)
- #current_subtotal_price_set : JSON::Any
- #current_subtotal_price_set=(current_subtotal_price_set : JSON::Any)
- #current_total_discounts : String
- #current_total_discounts=(current_total_discounts : String)
- #current_total_discounts_set : JSON::Any
- #current_total_discounts_set=(current_total_discounts_set : JSON::Any)
- #current_total_duties_set : JSON::Any
- #current_total_duties_set=(current_total_duties_set : JSON::Any)
- #current_total_price : String
- #current_total_price=(current_total_price : String)
- #current_total_price_set : JSON::Any
- #current_total_price_set=(current_total_price_set : JSON::Any)
- #current_total_tax : String
- #current_total_tax=(current_total_tax : String)
- #current_total_tax_set : JSON::Any
- #current_total_tax_set=(current_total_tax_set : JSON::Any)
- #customer : JSON::Any?
- #customer=(customer : JSON::Any?)
- #customer_locale : String?
- #customer_locale=(customer_locale : String?)
-
#delete
Used to delete one order.
- #discount_applications : JSON::Any
- #discount_applications=(discount_applications : JSON::Any)
- #discount_codes : Array(JSON::Any)
- #discount_codes=(discount_codes : Array(JSON::Any))
- #email : String
- #email=(email : String)
- #estimated_taxes : Bool
- #estimated_taxes=(estimated_taxes : Bool)
- #financial_status : String
- #financial_status=(financial_status : String)
- #fulfillment_status : String?
- #fulfillment_status=(fulfillment_status : String?)
- #fulfillments : Array(JSON::Any)
- #fulfillments=(fulfillments : Array(JSON::Any))
- #gateway : String
- #gateway=(gateway : String)
- #id : Int64
- #id=(id : Int64)
- #landing_site : String?
- #landing_site=(landing_site : String?)
- #line_items : Array(JSON::Any)
- #line_items=(line_items : Array(JSON::Any))
- #location_id : Int64?
- #location_id=(location_id : Int64?)
- #name : String
- #name=(name : String)
- #note : String?
- #note=(note : String?)
- #note_attributes : Array(Hash(String, String))
- #note_attributes=(note_attributes : Array(Hash(String, String)))
- #number : Int32
- #number=(number : Int32)
-
#open : self
Under the covers, this just runs:
plaintext POST /admin/api/2022-01/orders/{id}/open.json
- #order_number : Int32
- #order_number=(order_number : Int32)
- #order_status_url : Hash(String, String) | String
- #order_status_url=(order_status_url : Hash(String, String) | String)
- #original_total_duties_set : JSON::Any
- #original_total_duties_set=(original_total_duties_set : JSON::Any)
- #payment_details : Hash(String, String)?
- #payment_details=(payment_details : Hash(String, String)?)
- #payment_gateway_names : Array(String)
- #payment_gateway_names=(payment_gateway_names : Array(String))
- #payment_terms : JSON::Any
- #payment_terms=(payment_terms : JSON::Any)
- #phone : String?
- #phone=(phone : String?)
- #presentment_currency : String
- #presentment_currency=(presentment_currency : String)
- #processed_at : Time?
- #processed_at=(processed_at : Time?)
- #processing_method : String
- #processing_method=(processing_method : String)
- #referring_site : String?
- #referring_site=(referring_site : String?)
- #refunds : Array(JSON::Any)
- #refunds=(refunds : Array(JSON::Any))
- #shipping_address : JSON::Any?
- #shipping_address=(shipping_address : JSON::Any?)
- #shipping_lines : Array(JSON::Any)
- #shipping_lines=(shipping_lines : Array(JSON::Any))
- #source_name : String
- #source_name=(source_name : String)
- #subtotal_price : String | Int32
- #subtotal_price=(subtotal_price : String | Int32)
- #subtotal_price_set : JSON::Any
- #subtotal_price_set=(subtotal_price_set : JSON::Any)
- #tags : String
- #tags=(tags : String)
- #tax_lines : Array(JSON::Any)
- #tax_lines=(tax_lines : Array(JSON::Any))
- #taxes_included : Bool
- #taxes_included=(taxes_included : Bool)
- #test : Bool
- #test=(test : Bool)
- #token : String
- #token=(token : String)
- #total_discounts : String
- #total_discounts=(total_discounts : String)
- #total_discounts_set : JSON::Any
- #total_discounts_set=(total_discounts_set : JSON::Any)
- #total_line_items_price : String
- #total_line_items_price=(total_line_items_price : String)
- #total_line_items_price_set : JSON::Any
- #total_line_items_price_set=(total_line_items_price_set : JSON::Any)
- #total_outstanding : String
- #total_outstanding=(total_outstanding : String)
- #total_price : String
- #total_price=(total_price : String)
- #total_price_set : JSON::Any
- #total_price_set=(total_price_set : JSON::Any)
- #total_shipping_price_set : JSON::Any
- #total_shipping_price_set=(total_shipping_price_set : JSON::Any)
- #total_tax : String
- #total_tax=(total_tax : String)
- #total_tax_set : JSON::Any
- #total_tax_set=(total_tax_set : JSON::Any)
- #total_tip_received : String
- #total_tip_received=(total_tip_received : String)
- #total_weight : Int32
- #total_weight=(total_weight : Int32)
-
#update(body : String) : self
Under the covers, this just runs:
plaintext PUT /admin/api/2022-01/orders/{id}.json
- #updated_at : Time
- #updated_at=(updated_at : Time)
- #user_id : Int64?
- #user_id=(user_id : Int64?)
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
Class Method Detail
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
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.
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
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
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
Instance Method Detail
Under the covers, this just runs:
POST
/admin/api/2022-01/orders/{id}/cancel.json
Used to delete one order.
Under the covers, this just runs:
DELETE
/admin/api/2022-01/orders/{id}.json
Under the covers, this just runs:
PUT
/admin/api/2022-01/orders/{id}.json