Class: ShopifyAPI::FulfillmentRequest

Inherits:
Rest::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb,
lib/shopify_api/rest/resources/2022_07/fulfillment_request.rb,
lib/shopify_api/rest/resources/2022_10/fulfillment_request.rb,
lib/shopify_api/rest/resources/2023_01/fulfillment_request.rb,
lib/shopify_api/rest/resources/2023_04/fulfillment_request.rb,
lib/shopify_api/rest/resources/2023_07/fulfillment_request.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, primary_key, read_only_attributes, request, #respond_to_missing?, #save, #save!, #to_hash

Constructor Details

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

Returns a new instance of FulfillmentRequest.



16
17
18
19
20
# File 'lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb', line 16

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

  @fulfillment_order_id = T.let(nil, T.nilable(Integer))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShopifyAPI::Rest::Base

Instance Attribute Details

#fulfillment_order_idObject (readonly)

Returns the value of attribute fulfillment_order_id.



31
32
33
# File 'lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb', line 31

def fulfillment_order_id
  @fulfillment_order_id
end

Class Method Details

.json_response_body_namesObject



37
38
39
40
41
42
# File 'lib/shopify_api/rest/resources/2022_10/fulfillment_request.rb', line 37

def json_response_body_names()
  [
    "submitted_fulfillment_order",
    "fulfillment_order"
  ]
end

Instance Method Details

#accept(message: nil, body: nil, **kwargs) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb', line 43

def accept(
  message: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :accept,
    session: @session,
    ids: {fulfillment_order_id: @fulfillment_order_id},
    params: {message: message}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end

#reject(message: nil, reason: nil, line_items: nil, body: nil, **kwargs) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/shopify_api/rest/resources/2022_04/fulfillment_request.rb', line 68

def reject(
  message: nil,
  reason: nil,
  line_items: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :reject,
    session: @session,
    ids: {fulfillment_order_id: @fulfillment_order_id},
    params: {message: message, reason: reason, line_items: line_items}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end