Class: SoapyCake::Admin

Inherits:
Client
  • Object
show all
Includes:
Helper
Defined in:
lib/soapy_cake/admin.rb

Overview

rubocop:disable Metrics/ClassLength

Constant Summary

Constants inherited from Client

Client::HEADERS

Instance Method Summary collapse

Methods included from Helper

#const_lookup, #future_expiration_date, #require_params, #translate_booleans, #translate_values, #validate_id, #walk_tree

Methods inherited from Client

#initialize, #read_only?, #run, #xml_response?

Constructor Details

This class inherits a constructor from SoapyCake::Client

Instance Method Details

#add_blacklist(opts) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/soapy_cake/admin.rb', line 111

def add_blacklist(opts)
  require_params(opts, %i[blacklist_date])

  blacklist_date = opts[:blacklist_date].to_date
  # CAKE applies the blacklisting at 00:00 of the specified day, so add one more day.
  # Unless it is the current day, then blacklisting should take effect immediately.
  blacklist_date += 1.day if blacklist_date > Date.current

  run Request.new(
    :admin,
    :addedit,
    :blacklist,
    opts.merge(blacklist_date: blacklist_date)
  )
end

#advertiser_bills(opts = {}) ⇒ Object



12
13
14
# File 'lib/soapy_cake/admin.rb', line 12

def advertiser_bills(opts = {})
  run Request.new(:admin, :accounting, :export_advertiser_bills, opts)
end

#advertiser_summary(opts = {}) ⇒ Object



58
59
60
# File 'lib/soapy_cake/admin.rb', line 58

def advertiser_summary(opts = {})
  run Request.new(:admin, :reports, :advertiser_summary, opts)
end

#advertisers(opts = {}) ⇒ Object



24
25
26
# File 'lib/soapy_cake/admin.rb', line 24

def advertisers(opts = {})
  run Request.new(:admin, :export, :advertisers, opts)
end

#affiliate_bills(opts = {}) ⇒ Object



8
9
10
# File 'lib/soapy_cake/admin.rb', line 8

def affiliate_bills(opts = {})
  run Request.new(:admin, :accounting, :export_affiliate_bills, opts)
end

#affiliate_signup(opts = {}) ⇒ Object



136
137
138
# File 'lib/soapy_cake/admin.rb', line 136

def (opts = {})
  run Request.new(:admin, :signup, :affiliate, opts)
end

#affiliate_summary(opts = {}) ⇒ Object



54
55
56
# File 'lib/soapy_cake/admin.rb', line 54

def affiliate_summary(opts = {})
  run Request.new(:admin, :reports, :affiliate_summary, opts)
end

#affiliates(opts = {}) ⇒ Object



28
29
30
# File 'lib/soapy_cake/admin.rb', line 28

def affiliates(opts = {})
  run Request.new(:admin, :export, :affiliates, opts)
end

#blacklist_reasonsObject



157
158
159
# File 'lib/soapy_cake/admin.rb', line 157

def blacklist_reasons
  run Request.new(:admin, :get, :blacklist_reasons, {})
end

#blacklists(opts = {}) ⇒ Object



127
128
129
# File 'lib/soapy_cake/admin.rb', line 127

def blacklists(opts = {})
  run Request.new(:admin, :export, :blacklists, opts)
end

#campaign_summary(opts = {}) ⇒ Object



46
47
48
# File 'lib/soapy_cake/admin.rb', line 46

def campaign_summary(opts = {})
  run Request.new(:admin, :reports, :campaign_summary, opts)
end

#campaigns(opts = {}) ⇒ Object



32
33
34
# File 'lib/soapy_cake/admin.rb', line 32

def campaigns(opts = {})
  run Request.new(:admin, :export, :campaigns, opts)
end

#caps(opts) ⇒ Object



82
83
84
85
86
87
# File 'lib/soapy_cake/admin.rb', line 82

def caps(opts)
  require_params(opts, %i[start_date end_date])
  opts = translate_values(opts)

  run Request.new(:admin, :reports, :caps, opts)
end

#clicks(opts = {}) ⇒ Object



62
63
64
# File 'lib/soapy_cake/admin.rb', line 62

def clicks(opts = {})
  run Request.new(:admin, :reports, :clicks, opts)
end

#conversion_changes(opts = {}) ⇒ Object



66
67
68
# File 'lib/soapy_cake/admin.rb', line 66

def conversion_changes(opts = {})
  run Request.new(:admin, :reports, :conversion_changes, opts)
end

#conversions(opts = {}) ⇒ Object



70
71
72
# File 'lib/soapy_cake/admin.rb', line 70

def conversions(opts = {})
  run event_conversions_request('macro_event_conversions', opts)
end

#countries(opts = {}) ⇒ Object



149
150
151
# File 'lib/soapy_cake/admin.rb', line 149

def countries(opts = {})
  run Request.new(:admin, :get, :countries, opts)
end

#creatives(opts = {}) ⇒ Object



40
41
42
43
44
# File 'lib/soapy_cake/admin.rb', line 40

def creatives(opts = {})
  opts = translate_values(opts)

  run Request.new(:admin, :export, :creatives, opts)
end

#currenciesObject



95
96
97
# File 'lib/soapy_cake/admin.rb', line 95

def currencies
  run Request.new(:admin, :get, :currencies, {})
end

#events(opts = {}) ⇒ Object



74
75
76
# File 'lib/soapy_cake/admin.rb', line 74

def events(opts = {})
  run event_conversions_request('micro_events', opts)
end

#exchange_rates(opts) ⇒ Object



89
90
91
92
93
# File 'lib/soapy_cake/admin.rb', line 89

def exchange_rates(opts)
  require_params(opts, %i[start_date end_date])

  run Request.new(:admin, :get, :exchange_rates, opts)
end

#mark_affiliate_bill_as_paid(opts = {}) ⇒ Object



20
21
22
# File 'lib/soapy_cake/admin.rb', line 20

def mark_affiliate_bill_as_paid(opts = {})
  run Request.new(:admin, :accounting, :mark_affiliate_bill_as_paid, opts)
end

#mark_affiliate_bill_as_received(opts = {}) ⇒ Object



16
17
18
# File 'lib/soapy_cake/admin.rb', line 16

def mark_affiliate_bill_as_received(opts = {})
  run Request.new(:admin, :accounting, :mark_affiliate_bill_as_received, opts)
end

#media_types(opts = {}) ⇒ Object



140
141
142
143
# File 'lib/soapy_cake/admin.rb', line 140

def media_types(opts = {})
  result = run(Request.new(:admin, :signup, :get_media_types, opts))
  xml_response? ? result : result.try(:[], :MediaType)
end

#offer_summary(opts = {}) ⇒ Object



50
51
52
# File 'lib/soapy_cake/admin.rb', line 50

def offer_summary(opts = {})
  run Request.new(:admin, :reports, :offer_summary, opts)
end

#offers(opts = {}) ⇒ Object



36
37
38
# File 'lib/soapy_cake/admin.rb', line 36

def offers(opts = {})
  run Request.new(:admin, :export, :offers, opts)
end

#payment_typesObject



153
154
155
# File 'lib/soapy_cake/admin.rb', line 153

def payment_types
  run Request.new(:admin, :get, :payment_types, {})
end

#remove_blacklist(opts = {}) ⇒ Object



131
132
133
134
# File 'lib/soapy_cake/admin.rb', line 131

def remove_blacklist(opts = {})
  require_params(opts, %i[blacklist_id])
  run Request.new(:admin, :addedit, :remove_blacklist, opts)
end

#tiersObject



99
100
101
# File 'lib/soapy_cake/admin.rb', line 99

def tiers
  run Request.new(:admin, :get, :affiliate_tiers, {})
end

#traffic(opts = {}) ⇒ Object



78
79
80
# File 'lib/soapy_cake/admin.rb', line 78

def traffic(opts = {})
  run Request.new(:admin, :reports, :traffic_export, opts)
end

#update_campaign(opts = {}) ⇒ Object



107
108
109
# File 'lib/soapy_cake/admin.rb', line 107

def update_campaign(opts = {})
  run Request.new(:admin, :addedit, :campaign, opts)
end

#update_creative(opts = {}) ⇒ Object



103
104
105
# File 'lib/soapy_cake/admin.rb', line 103

def update_creative(opts = {})
  run Request.new(:admin, :addedit, :creative, opts)
end

#verticalsObject



145
146
147
# File 'lib/soapy_cake/admin.rb', line 145

def verticals
  run Request.new(:admin, :get, :verticals, {})
end