balihoo_lpc_client 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/balihoo_lpc_client.rb +4 -1
- data/lib/balihoo_lpc_client/request/campaigns.rb +7 -1
- data/lib/balihoo_lpc_client/request/campaigns_with_tactics.rb +5 -5
- data/lib/balihoo_lpc_client/request/metrics.rb +14 -1
- data/lib/balihoo_lpc_client/response/display_metric.rb +11 -0
- data/lib/balihoo_lpc_client/response/email_metric.rb +13 -0
- data/lib/balihoo_lpc_client/response/metric_base.rb +10 -0
- data/lib/balihoo_lpc_client/response/{metric.rb → paid_search_metric.rb} +1 -5
- data/lib/balihoo_lpc_client/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7735f2922666882e13d21b9f0be18cc812e9052a
|
4
|
+
data.tar.gz: 7ad9cab953a15e2226d290677146e2cc9c2af713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb3bc582a128a0f971c37a566e361c2a4d3fd15bc5a741db6b314dbf3d9aa264f1e61ef59a3d94d9916727a8ab7b7c7665132f7b738064a949e8b79cdec89c6
|
7
|
+
data.tar.gz: f95e9996b24db9148131d3ff0464656584c0937037bbd209070c161c116eb8e6a420edd79b1441d347c09333020420b4d979008f2f4993b13f1ede4b4d97ba85
|
data/lib/balihoo_lpc_client.rb
CHANGED
@@ -15,7 +15,10 @@ require 'balihoo_lpc_client/request/website_metrics'
|
|
15
15
|
require 'balihoo_lpc_client/response/authentication'
|
16
16
|
require 'balihoo_lpc_client/response/tactic'
|
17
17
|
require 'balihoo_lpc_client/response/campaign'
|
18
|
-
require 'balihoo_lpc_client/response/
|
18
|
+
require 'balihoo_lpc_client/response/metric_base'
|
19
|
+
require 'balihoo_lpc_client/response/paid_search_metric'
|
20
|
+
require 'balihoo_lpc_client/response/email_metric'
|
21
|
+
require 'balihoo_lpc_client/response/display_metric'
|
19
22
|
require 'balihoo_lpc_client/response/website_metric_visits'
|
20
23
|
require 'balihoo_lpc_client/response/website_metric_leads'
|
21
24
|
require 'balihoo_lpc_client/response/website_metric'
|
@@ -2,10 +2,16 @@ module BalihooLpcClient
|
|
2
2
|
module Request
|
3
3
|
class Campaigns < ApiBase
|
4
4
|
def fetch
|
5
|
-
response =
|
5
|
+
response = get_response
|
6
6
|
handle_errors_with(klass: ApiResponseError, response: response)
|
7
7
|
handle_response(response: response, klass: Response::Campaign)
|
8
8
|
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def get_response
|
13
|
+
self.class.get('/campaigns', opts).parsed_response
|
14
|
+
end
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module BalihooLpcClient
|
2
2
|
module Request
|
3
|
-
class CampaignsWithTactics <
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
class CampaignsWithTactics < Campaigns
|
4
|
+
private
|
5
|
+
|
6
|
+
def get_response
|
7
|
+
self.class.get('/campaignswithtactics', opts).parsed_response
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -11,7 +11,20 @@ module BalihooLpcClient
|
|
11
11
|
def fetch
|
12
12
|
response = self.class.get("/tactic/#{tactic_id}/metrics", opts).parsed_response
|
13
13
|
handle_errors_with(klass: ApiResponseError, response: response)
|
14
|
-
handle_response(response: response, klass:
|
14
|
+
handle_response(response: response, klass: klass_for(response: response), mappable: false)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def klass_for(response:)
|
20
|
+
case (multiple_locations? ? response.values.first['channel'] : response['channel'])
|
21
|
+
when /Email/
|
22
|
+
Response::EmailMetric
|
23
|
+
when /Paid Search/
|
24
|
+
Response::PaidSearchMetric
|
25
|
+
when /Display/
|
26
|
+
Response::DisplayMetric
|
27
|
+
end
|
15
28
|
end
|
16
29
|
end
|
17
30
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module BalihooLpcClient
|
2
|
+
module Response
|
3
|
+
class DisplayMetric < MetricBase
|
4
|
+
property :impressions, from: 'impressions'
|
5
|
+
property :spend, from: 'spend'
|
6
|
+
property :ctr, from: 'ctr'
|
7
|
+
property :avg_cpc, from: 'avgCpc'
|
8
|
+
property :avg_cpm, from: 'avgCpm'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module BalihooLpcClient
|
2
|
+
module Response
|
3
|
+
class EmailMetric < MetricBase
|
4
|
+
property :sends, from: 'sends'
|
5
|
+
property :opens, from: 'opens'
|
6
|
+
property :clicks, from: 'clicks'
|
7
|
+
property :delivered, from: 'delivered'
|
8
|
+
property :bounced, from: 'bounced'
|
9
|
+
property :unsubscribed, from: 'unsubscribed'
|
10
|
+
property :marked_spam, from: 'markedSpam'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
module BalihooLpcClient
|
2
2
|
module Response
|
3
|
-
class
|
4
|
-
include Hashie::Extensions::Dash::PropertyTranslation
|
5
|
-
|
6
|
-
property :tactic_ids, from: 'tacticIds'
|
7
|
-
property :channel, from: 'channel'
|
3
|
+
class PaidSearchMetric < MetricBase
|
8
4
|
property :clicks, from: 'clicks'
|
9
5
|
property :spend, from: 'spend'
|
10
6
|
property :impressions, from: 'impressions'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balihoo_lpc_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JD Guzman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -171,7 +171,10 @@ files:
|
|
171
171
|
- lib/balihoo_lpc_client/request/website_metrics.rb
|
172
172
|
- lib/balihoo_lpc_client/response/authentication.rb
|
173
173
|
- lib/balihoo_lpc_client/response/campaign.rb
|
174
|
-
- lib/balihoo_lpc_client/response/
|
174
|
+
- lib/balihoo_lpc_client/response/display_metric.rb
|
175
|
+
- lib/balihoo_lpc_client/response/email_metric.rb
|
176
|
+
- lib/balihoo_lpc_client/response/metric_base.rb
|
177
|
+
- lib/balihoo_lpc_client/response/paid_search_metric.rb
|
175
178
|
- lib/balihoo_lpc_client/response/tactic.rb
|
176
179
|
- lib/balihoo_lpc_client/response/website_metric.rb
|
177
180
|
- lib/balihoo_lpc_client/response/website_metric_leads.rb
|