Class: ShopifyAPI::MarketingEvent

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

Returns a new instance of MarketingEvent.



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

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

  @event_type = T.let(nil, T.nilable(String))
  @marketing_channel = T.let(nil, T.nilable(String))
  @paid = T.let(nil, T.nilable(T::Boolean))
  @started_at = T.let(nil, T.nilable(String))
  @UTM_parameters = T.let(nil, T.nilable(T::Hash[T.untyped, T.untyped]))
  @budget = T.let(nil, T.nilable(String))
  @budget_type = T.let(nil, T.nilable(String))
  @currency = T.let(nil, T.nilable(String))
  @description = T.let(nil, T.nilable(String))
  @ended_at = T.let(nil, T.nilable(String))
  @id = T.let(nil, T.nilable(Integer))
  @manage_url = T.let(nil, T.nilable(String))
  @marketed_resources = T.let(nil, T.nilable(T::Array[T.untyped]))
  @preview_url = T.let(nil, T.nilable(String))
  @referring_domain = T.let(nil, T.nilable(String))
  @remote_id = T.let(nil, T.nilable(String))
  @scheduled_to_end_at = 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

#budgetObject (readonly)

Returns the value of attribute budget.



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

def budget
  @budget
end

#budget_typeObject (readonly)

Returns the value of attribute budget_type.



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

def budget_type
  @budget_type
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#ended_atObject (readonly)

Returns the value of attribute ended_at.



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

def ended_at
  @ended_at
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



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

def event_type
  @event_type
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#manage_urlObject (readonly)

Returns the value of attribute manage_url.



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

def manage_url
  @manage_url
end

#marketed_resourcesObject (readonly)

Returns the value of attribute marketed_resources.



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

def marketed_resources
  @marketed_resources
end

#marketing_channelObject (readonly)

Returns the value of attribute marketing_channel.



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

def marketing_channel
  @marketing_channel
end

Returns the value of attribute paid.



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

def paid
  @paid
end

#preview_urlObject (readonly)

Returns the value of attribute preview_url.



77
78
79
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 77

def preview_url
  @preview_url
end

#referring_domainObject (readonly)

Returns the value of attribute referring_domain.



79
80
81
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 79

def referring_domain
  @referring_domain
end

#remote_idObject (readonly)

Returns the value of attribute remote_id.



81
82
83
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 81

def remote_id
  @remote_id
end

#scheduled_to_end_atObject (readonly)

Returns the value of attribute scheduled_to_end_at.



83
84
85
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 83

def scheduled_to_end_at
  @scheduled_to_end_at
end

#started_atObject (readonly)

Returns the value of attribute started_at.



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

def started_at
  @started_at
end

#UTM_parametersObject (readonly)

Returns the value of attribute UTM_parameters.



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

def UTM_parameters
  @UTM_parameters
end

Class Method Details

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



131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 131

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

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

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



152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 152

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

.delete(id:, session: ShopifyAPI::Context.active_session) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 110

def delete(
  id:,
  session: ShopifyAPI::Context.active_session
)
  request(
    http_method: :delete,
    operation: :delete,
    session: session,
    ids: {id: id},
    params: {},
  )
end

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



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 92

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

Instance Method Details

#engagements(occurred_on: nil, impressions_count: nil, views_count: nil, clicks_count: nil, shares_count: nil, favorites_count: nil, comments_count: nil, ad_spend: nil, is_cumulative: nil, body: nil, **kwargs) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/shopify_api/rest/resources/2022_04/marketing_event.rb', line 184

def engagements(
  occurred_on: nil,
  impressions_count: nil,
  views_count: nil,
  clicks_count: nil,
  shares_count: nil,
  favorites_count: nil,
  comments_count: nil,
  ad_spend: nil,
  is_cumulative: nil,
  body: nil,
  **kwargs
)
  self.class.request(
    http_method: :post,
    operation: :engagements,
    session: @session,
    ids: {id: @id},
    params: {occurred_on: occurred_on, impressions_count: impressions_count, views_count: views_count, clicks_count: clicks_count, shares_count: shares_count, favorites_count: favorites_count, comments_count: comments_count, ad_spend: ad_spend, is_cumulative: is_cumulative}.merge(kwargs).compact,
    body: body,
    entity: self,
  )
end