Class: ShopifyAPI::Comment

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

Returns a new instance of Comment.



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

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

  @article_id = T.let(nil, T.nilable(Integer))
  @author = T.let(nil, T.nilable(String))
  @blog_id = T.let(nil, T.nilable(Integer))
  @body = T.let(nil, T.nilable(String))
  @body_html = T.let(nil, T.nilable(String))
  @created_at = T.let(nil, T.nilable(String))
  @email = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @ip = T.let(nil, T.nilable(String))
  @published_at = T.let(nil, T.nilable(String))
  @status = T.let(nil, T.nilable(String))
  @updated_at = T.let(nil, T.nilable(String))
  @user_agent = T.let(nil, T.nilable(String))
end

Dynamic Method Handling

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

Instance Attribute Details

#article_idObject (readonly)

Returns the value of attribute article_id.



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

def article_id
  @article_id
end

#authorObject (readonly)

Returns the value of attribute author.



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

def author
  @author
end

#blog_idObject (readonly)

Returns the value of attribute blog_id.



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

def blog_id
  @blog_id
end

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#body_htmlObject (readonly)

Returns the value of attribute body_html.



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

def body_html
  @body_html
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#ipObject (readonly)

Returns the value of attribute ip.



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

def ip
  @ip
end

#published_atObject (readonly)

Returns the value of attribute published_at.



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

def published_at
  @published_at
end

#statusObject (readonly)

Returns the value of attribute status.



70
71
72
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 70

def status
  @status
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



72
73
74
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 72

def updated_at
  @updated_at
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



74
75
76
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 74

def user_agent
  @user_agent
end

Class Method Details

.all(limit: nil, since_id: nil, created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, published_at_min: nil, published_at_max: nil, fields: nil, published_status: nil, status: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 114

def all(
  limit: nil,
  since_id: nil,
  created_at_min: nil,
  created_at_max: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  published_at_min: nil,
  published_at_max: nil,
  fields: nil,
  published_status: nil,
  status: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  response = base_find(
    session: session,
    ids: {},
    params: {limit: limit, since_id: since_id, created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, published_at_min: published_at_min, published_at_max: published_at_max, fields: fields, published_status: published_status, status: status}.merge(kwargs).compact,
  )

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

.count(created_at_min: nil, created_at_max: nil, updated_at_min: nil, updated_at_max: nil, published_at_min: nil, published_at_max: nil, published_status: nil, status: nil, session: ShopifyAPI::Context.active_session, **kwargs) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 152

def count(
  created_at_min: nil,
  created_at_max: nil,
  updated_at_min: nil,
  updated_at_max: nil,
  published_at_min: nil,
  published_at_max: nil,
  published_status: nil,
  status: nil,
  session: ShopifyAPI::Context.active_session,
  **kwargs
)
  request(
    http_method: :get,
    operation: :count,
    session: session,
    ids: {},
    params: {created_at_min: created_at_min, created_at_max: created_at_max, updated_at_min: updated_at_min, updated_at_max: updated_at_max, published_at_min: published_at_min, published_at_max: published_at_max, published_status: published_status, status: status}.merge(kwargs).compact,
    body: {},
    entity: nil,
  )
end

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



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 84

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

Instance Method Details

#approve(body: nil, **kwargs) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 183

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

#not_spam(body: nil, **kwargs) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 204

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

#remove(body: nil, **kwargs) ⇒ Object



225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 225

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

#restore(body: nil, **kwargs) ⇒ Object



246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 246

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

#spam(body: nil, **kwargs) ⇒ Object



267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/shopify_api/rest/resources/2022_04/comment.rb', line 267

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