Class: ShopifyAPI::Transaction

Inherits:
Rest::Base show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/rest/resources/2021_07/transaction.rb,
lib/shopify_api/rest/resources/2021_10/transaction.rb,
lib/shopify_api/rest/resources/2022_01/transaction.rb,
lib/shopify_api/rest/resources/2022_04/transaction.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) ⇒ Transaction

Returns a new instance of Transaction.


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 12

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

  @kind = T.let(nil, T.nilable(String))
  @amount = T.let(nil, T.nilable(String))
  @authorization = T.let(nil, T.nilable(String))
  @authorization_expires_at = T.let(nil, T.nilable(String))
  @created_at = T.let(nil, T.nilable(String))
  @currency = T.let(nil, T.nilable(String))
  @currency_exchange_adjustment = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @device_id = T.let(nil, T.nilable(Integer))
  @error_code = T.let(nil, T.nilable(String))
  @extended_authorization_attributes = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @gateway = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @location_id = T.let(nil, T.nilable(Integer))
  @message = T.let(nil, T.nilable(String))
  @order_id = T.let(nil, T.nilable(Integer))
  @parent_id = T.let(nil, T.nilable(Integer))
  @payment_details = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @processed_at = T.let(nil, T.nilable(String))
  @receipt = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @source_name = T.let(nil, T.nilable(String))
  @status = T.let(nil, T.nilable(String))
  @test = T.let(nil, T.nilable(T::Boolean))
  @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

#amountObject (readonly)

Returns the value of attribute amount.


52
53
54
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 52

def amount
  @amount
end

#authorizationObject (readonly)

Returns the value of attribute authorization.


54
55
56
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 54

def authorization
  @authorization
end

#authorization_expires_atObject (readonly)

Returns the value of attribute authorization_expires_at.


56
57
58
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 56

def authorization_expires_at
  @authorization_expires_at
end

#created_atObject (readonly)

Returns the value of attribute created_at.


58
59
60
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 58

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.


60
61
62
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 60

def currency
  @currency
end

#currency_exchange_adjustmentObject (readonly)

Returns the value of attribute currency_exchange_adjustment.


62
63
64
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 62

def currency_exchange_adjustment
  @currency_exchange_adjustment
end

#device_idObject (readonly)

Returns the value of attribute device_id.


64
65
66
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 64

def device_id
  @device_id
end

#error_codeObject (readonly)

Returns the value of attribute error_code.


66
67
68
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 66

def error_code
  @error_code
end

#extended_authorization_attributesObject (readonly)

Returns the value of attribute extended_authorization_attributes.


68
69
70
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 68

def extended_authorization_attributes
  @extended_authorization_attributes
end

#gatewayObject (readonly)

Returns the value of attribute gateway.


70
71
72
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 70

def gateway
  @gateway
end

#idObject (readonly)

Returns the value of attribute id.


72
73
74
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 72

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.


50
51
52
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 50

def kind
  @kind
end

#location_idObject (readonly)

Returns the value of attribute location_id.


74
75
76
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 74

def location_id
  @location_id
end

#messageObject (readonly)

Returns the value of attribute message.


76
77
78
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 76

def message
  @message
end

#order_idObject (readonly)

Returns the value of attribute order_id.


78
79
80
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 78

def order_id
  @order_id
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.


80
81
82
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 80

def parent_id
  @parent_id
end

#payment_detailsObject (readonly)

Returns the value of attribute payment_details.


82
83
84
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 82

def payment_details
  @payment_details
end

#payments_refund_attributesObject (readonly)

Returns the value of attribute payments_refund_attributes.


85
86
87
# File 'lib/shopify_api/rest/resources/2021_10/transaction.rb', line 85

def payments_refund_attributes
  @payments_refund_attributes
end

#processed_atObject (readonly)

Returns the value of attribute processed_at.


84
85
86
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 84

def processed_at
  @processed_at
end

#receiptObject (readonly)

Returns the value of attribute receipt.


86
87
88
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 86

def receipt
  @receipt
end

#source_nameObject (readonly)

Returns the value of attribute source_name.


88
89
90
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 88

def source_name
  @source_name
end

#statusObject (readonly)

Returns the value of attribute status.


90
91
92
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 90

def status
  @status
end

#testObject (readonly)

Returns the value of attribute test.


92
93
94
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 92

def test
  @test
end

#user_idObject (readonly)

Returns the value of attribute user_id.


94
95
96
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 94

def user_id
  @user_id
end

Class Method Details

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


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 131

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

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

.count(order_id: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 155

def count(
  order_id: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {order_id: order_id},
    params: {}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

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


106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/shopify_api/rest/resources/2021_07/transaction.rb', line 106

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(Transaction))
end