Class: ShopifyAPI::MarketingEvent

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


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

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.


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

def budget
  @budget
end

#budget_typeObject (readonly)

Returns the value of attribute budget_type.


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

def budget_type
  @budget_type
end

#currencyObject (readonly)

Returns the value of attribute currency.


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

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.


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

def description
  @description
end

#ended_atObject (readonly)

Returns the value of attribute ended_at.


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

def ended_at
  @ended_at
end

#event_typeObject (readonly)

Returns the value of attribute event_type.


47
48
49
# File 'lib/shopify_api/rest/resources/2021_07/marketing_event.rb', line 47

def event_type
  @event_type
end

#idObject (readonly)

Returns the value of attribute id.


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

def id
  @id
end

#manage_urlObject (readonly)

Returns the value of attribute manage_url.


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

def manage_url
  @manage_url
end

#marketed_resourcesObject (readonly)

Returns the value of attribute marketed_resources.


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

def marketed_resources
  @marketed_resources
end

#marketing_channelObject (readonly)

Returns the value of attribute marketing_channel.


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

def marketing_channel
  @marketing_channel
end

Returns the value of attribute paid.


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

def paid
  @paid
end

#preview_urlObject (readonly)

Returns the value of attribute preview_url.


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

def preview_url
  @preview_url
end

#referring_domainObject (readonly)

Returns the value of attribute referring_domain.


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

def referring_domain
  @referring_domain
end

#remote_idObject (readonly)

Returns the value of attribute remote_id.


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

def remote_id
  @remote_id
end

#scheduled_to_end_atObject (readonly)

Returns the value of attribute scheduled_to_end_at.


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

def scheduled_to_end_at
  @scheduled_to_end_at
end

#started_atObject (readonly)

Returns the value of attribute started_at.


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

def started_at
  @started_at
end

#UTM_parametersObject (readonly)

Returns the value of attribute UTM_parameters.


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

def UTM_parameters
  @UTM_parameters
end

Class Method Details

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


127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/shopify_api/rest/resources/2021_07/marketing_event.rb', line 127

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


148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/shopify_api/rest/resources/2021_07/marketing_event.rb', line 148

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


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

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


88
89
90
91
92
93
94
95
96
97
98
# File 'lib/shopify_api/rest/resources/2021_07/marketing_event.rb', line 88

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


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/shopify_api/rest/resources/2021_07/marketing_event.rb', line 180

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