Class: Perfecta::Client
- Inherits:
-
Object
- Object
- Perfecta::Client
- Defined in:
- lib/perfecta.rb
Constant Summary collapse
- BASE_API_PATH =
'https://api.perfectaudience.com'- ALLOWED_REPORT_PARAMS =
[ :interval, :start_date, :end_date, :site_id, :campaign_id ].freeze
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#password ⇒ Object
Returns the value of attribute password.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #ad(id) ⇒ Object
- #ad_reports(params = {}) ⇒ Object
- #ads(params = {}) ⇒ Object
- #campaign(id) ⇒ Object
- #campaign_reports(params = {}) ⇒ Object
- #campaigns(params = {}) ⇒ Object
- #conversion(id) ⇒ Object
- #conversion_reports(params = {}) ⇒ Object
- #conversions(params = {}) ⇒ Object
-
#initialize {|_self| ... } ⇒ Client
constructor
A new instance of Client.
- #segment(id) ⇒ Object
- #segments(params = {}) ⇒ Object
- #site(id) ⇒ Object
- #sites ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Client
Returns a new instance of Client.
30 31 32 33 |
# File 'lib/perfecta.rb', line 30 def initialize &block yield self if block_given? @token = exchange_credentials_for_token end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
28 29 30 |
# File 'lib/perfecta.rb', line 28 def email @email end |
#password ⇒ Object
Returns the value of attribute password.
28 29 30 |
# File 'lib/perfecta.rb', line 28 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
28 29 30 |
# File 'lib/perfecta.rb', line 28 def token @token end |
Instance Method Details
#ad(id) ⇒ Object
79 80 81 |
# File 'lib/perfecta.rb', line 79 def ad id get_one 'ad', id end |
#ad_reports(params = {}) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/perfecta.rb', line 43 def ad_reports params = {} url, params = build_report_url_and_params_for('ad', params) resp = make_request url, params build_collection_of 'AdReport', resp end |
#ads(params = {}) ⇒ Object
75 76 77 |
# File 'lib/perfecta.rb', line 75 def ads params = {} get_many 'ads', params end |
#campaign(id) ⇒ Object
71 72 73 |
# File 'lib/perfecta.rb', line 71 def campaign id get_one 'campaign', id end |
#campaign_reports(params = {}) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/perfecta.rb', line 35 def campaign_reports params = {} url, params = build_report_url_and_params_for('campaign', params) resp = make_request url, params build_collection_of 'CampaignReport', resp end |
#campaigns(params = {}) ⇒ Object
67 68 69 |
# File 'lib/perfecta.rb', line 67 def campaigns params = {} get_many 'campaigns', params end |
#conversion(id) ⇒ Object
87 88 89 |
# File 'lib/perfecta.rb', line 87 def conversion id get_one 'conversion', id end |
#conversion_reports(params = {}) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/perfecta.rb', line 51 def conversion_reports params = {} url, params = build_report_url_and_params_for('conversion', params) resp = make_request url, params build_collection_of 'ConversionReport', resp end |
#conversions(params = {}) ⇒ Object
83 84 85 |
# File 'lib/perfecta.rb', line 83 def conversions params = {} get_many 'conversions', params end |
#segment(id) ⇒ Object
95 96 97 |
# File 'lib/perfecta.rb', line 95 def segment id get_one 'segment', id end |
#segments(params = {}) ⇒ Object
91 92 93 |
# File 'lib/perfecta.rb', line 91 def segments params = {} get_many 'segments', params end |
#site(id) ⇒ Object
63 64 65 |
# File 'lib/perfecta.rb', line 63 def site id get_one 'site', id end |
#sites ⇒ Object
59 60 61 |
# File 'lib/perfecta.rb', line 59 def sites get_many 'sites' end |