Class: ShopifyAPI::Refund

Inherits:
ShopifyAPI::Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2022_04/refund.rb,
lib/shopify_api/rest/resources/2022_07/refund.rb,
lib/shopify_api/rest/resources/2022_10/refund.rb,
lib/shopify_api/rest/resources/2023_01/refund.rb,
lib/shopify_api/rest/resources/2023_04/refund.rb,
lib/shopify_api/rest/resources/2023_07/refund.rb

Instance Attribute Summary collapse

Attributes inherited from ShopifyAPI::Rest::Base

#errors, #original_state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ShopifyAPI::Rest::Base

base_find, class_name, create_instance, create_instances_from_response, #delete, get_path, has_many?, has_one?, json_body_name, json_response_body_names, #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) ⇒ Refund

Returns a new instance of Refund.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 16

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

  @created_at = T.let(nil, T.nilable(String))
  @duties = T.let(nil, T.nilable(T::Array[T.untyped]))
  @id = T.let(nil, T.nilable(Integer))
  @note = T.let(nil, T.nilable(String))
  @order_adjustments = T.let(nil, T.nilable(T::Array[T.untyped]))
  @order_id = T.let(nil, T.nilable(Integer))
  @processed_at = T.let(nil, T.nilable(String))
  @refund_duties = T.let(nil, T.nilable(T::Array[T.untyped]))
  @refund_line_items = T.let(nil, T.nilable(T::Array[T.untyped]))
  @restock = T.let(nil, T.nilable(T::Boolean))
  @transactions = T.let(nil, T.nilable(T::Array[T.untyped]))
  @user_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

#created_atObject (readonly)

Returns the value of attribute created_at.



45
46
47
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 45

def created_at
  @created_at
end

#dutiesObject (readonly)

Returns the value of attribute duties.



47
48
49
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 47

def duties
  @duties
end

#idObject (readonly)

Returns the value of attribute id.



49
50
51
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 49

def id
  @id
end

#noteObject (readonly)

Returns the value of attribute note.



51
52
53
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 51

def note
  @note
end

#order_adjustmentsObject (readonly)

Returns the value of attribute order_adjustments.



53
54
55
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 53

def order_adjustments
  @order_adjustments
end

#order_idObject (readonly)

Returns the value of attribute order_id.



55
56
57
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 55

def order_id
  @order_id
end

#processed_atObject (readonly)

Returns the value of attribute processed_at.



57
58
59
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 57

def processed_at
  @processed_at
end

#refund_dutiesObject (readonly)

Returns the value of attribute refund_duties.



59
60
61
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 59

def refund_duties
  @refund_duties
end

#refund_line_itemsObject (readonly)

Returns the value of attribute refund_line_items.



61
62
63
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 61

def refund_line_items
  @refund_line_items
end

#restockObject (readonly)

Returns the value of attribute restock.



63
64
65
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 63

def restock
  @restock
end

#transactionsObject (readonly)

Returns the value of attribute transactions.



65
66
67
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 65

def transactions
  @transactions
end

#user_idObject (readonly)

Returns the value of attribute user_id.



67
68
69
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 67

def user_id
  @user_id
end

Class Method Details

.all(order_id: nil, limit: nil, fields: nil, in_shop_currency: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 104

def all(
  order_id: nil,
  limit: nil,
  fields: nil,
  in_shop_currency: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {order_id: order_id},
    params: {limit: limit, fields: fields, in_shop_currency: in_shop_currency}.merge(kwargs).compact,
  )

  T.cast(response, T::Array[Refund])
end

.find(id:, order_id: nil, fields: nil, in_shop_currency: nil, session: ShopifyAPI::Context.active_session) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 79

def find(
  id:,
  order_id: nil,
  fields: nil,
  in_shop_currency: nil,
  session: ShopifyAPI::Context.active_session
)
  result = base_find(
    session: session,
    ids: {id: id, order_id: order_id},
    params: {fields: fields, in_shop_currency: in_shop_currency},
  )
  T.cast(result[0], T.nilable(Refund))
end

Instance Method Details

#calculate(shipping: nil, refund_line_items: nil, currency: nil, body: nil, **kwargs) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/shopify_api/rest/resources/2022_04/refund.rb', line 132

def calculate(
  shipping: nil,
  refund_line_items: nil,
  currency: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :calculate,
    session: @session,
    ids: {order_id: @order_id},
    params: {shipping: shipping, refund_line_items: refund_line_items, currency: currency}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end