nucleo-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.sample +2 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +37 -0
- data/lib/nucleo/client.rb +172 -0
- data/lib/nucleo/client/version.rb +5 -0
- data/lib/nucleo/configuration.rb +83 -0
- data/lib/nucleo/configurations.rb +6 -0
- data/lib/nucleo/configurations/default.rb +100 -0
- data/lib/nucleo/connection.rb +44 -0
- data/lib/nucleo/errors.rb +7 -0
- data/lib/nucleo/errors/invalid_uri_error.rb +6 -0
- data/lib/nucleo/errors/record_not_found.rb +6 -0
- data/lib/nucleo/logger.rb +36 -0
- data/lib/nucleo/models.rb +50 -0
- data/lib/nucleo/models/change_types.rb +10 -0
- data/lib/nucleo/models/change_types/base.rb +81 -0
- data/lib/nucleo/models/change_types/seo.rb +13 -0
- data/lib/nucleo/models/change_types/seo/base.rb +50 -0
- data/lib/nucleo/models/change_types/seo/meta_description.rb +10 -0
- data/lib/nucleo/models/change_types/seo/page_title.rb +10 -0
- data/lib/nucleo/models/changes.rb +50 -0
- data/lib/nucleo/models/check_js.rb +41 -0
- data/lib/nucleo/models/check_types.rb +11 -0
- data/lib/nucleo/models/check_types/base.rb +25 -0
- data/lib/nucleo/models/check_types/count.rb +26 -0
- data/lib/nucleo/models/check_types/length.rb +26 -0
- data/lib/nucleo/models/check_types/not_exists.rb +8 -0
- data/lib/nucleo/models/checks.rb +56 -0
- data/lib/nucleo/models/concerns.rb +7 -0
- data/lib/nucleo/models/concerns/count.rb +57 -0
- data/lib/nucleo/models/concerns/length.rb +57 -0
- data/lib/nucleo/models/date_range.rb +66 -0
- data/lib/nucleo/models/element.rb +40 -0
- data/lib/nucleo/models/elements.rb +47 -0
- data/lib/nucleo/models/feed.rb +141 -0
- data/lib/nucleo/models/feed_types.rb +11 -0
- data/lib/nucleo/models/feed_types/analytics.rb +18 -0
- data/lib/nucleo/models/feed_types/analytics/base.rb +12 -0
- data/lib/nucleo/models/feed_types/analytics/page/channels.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/page/pages.rb +58 -0
- data/lib/nucleo/models/feed_types/analytics/page/referrers.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/page/social.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/site/channels.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/site/pages.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/site/referrers.rb +61 -0
- data/lib/nucleo/models/feed_types/analytics/site/social.rb +61 -0
- data/lib/nucleo/models/feed_types/base.rb +182 -0
- data/lib/nucleo/models/feed_types/seo.rb +22 -0
- data/lib/nucleo/models/feed_types/seo/page/base.rb +47 -0
- data/lib/nucleo/models/feed_types/seo/page/img_alt.rb +90 -0
- data/lib/nucleo/models/feed_types/seo/page/meta_description.rb +49 -0
- data/lib/nucleo/models/feed_types/seo/page/meta_robots.rb +48 -0
- data/lib/nucleo/models/feed_types/seo/page/page_title.rb +48 -0
- data/lib/nucleo/models/feed_types/seo/page/seo_summary.rb +53 -0
- data/lib/nucleo/models/feed_types/seo/page/summary.rb +52 -0
- data/lib/nucleo/models/feed_types/seo/site/base.rb +22 -0
- data/lib/nucleo/models/feed_types/seo/site/img_alt.rb +14 -0
- data/lib/nucleo/models/feed_types/seo/site/meta_description.rb +14 -0
- data/lib/nucleo/models/feed_types/seo/site/meta_robots.rb +14 -0
- data/lib/nucleo/models/feed_types/seo/site/page_title.rb +14 -0
- data/lib/nucleo/models/feeds.rb +126 -0
- data/lib/nucleo/models/metric.rb +54 -0
- data/lib/nucleo/models/metric_period.rb +97 -0
- data/lib/nucleo/models/metric_period_row.rb +125 -0
- data/lib/nucleo/models/metric_period_rows.rb +34 -0
- data/lib/nucleo/models/metric_period_totals.rb +121 -0
- data/lib/nucleo/models/metric_periods.rb +78 -0
- data/lib/nucleo/models/metric_periods_comparison.rb +80 -0
- data/lib/nucleo/models/metric_periods_comparisons.rb +73 -0
- data/lib/nucleo/models/metric_periods_totals.rb +58 -0
- data/lib/nucleo/models/page.rb +147 -0
- data/lib/nucleo/models/page_alerts.rb +27 -0
- data/lib/nucleo/models/page_metric.rb +58 -0
- data/lib/nucleo/models/page_rank.rb +28 -0
- data/lib/nucleo/models/pages.rb +40 -0
- data/lib/nucleo/models/seo_score.rb +28 -0
- data/lib/nucleo/models/site_feed.rb +82 -0
- data/lib/nucleo/models/tag.rb +48 -0
- data/lib/nucleo/models/tags.rb +35 -0
- data/lib/nucleo/requests.rb +14 -0
- data/lib/nucleo/requests/analyzer.rb +35 -0
- data/lib/nucleo/requests/check_js.rb +56 -0
- data/lib/nucleo/requests/feed.rb +58 -0
- data/lib/nucleo/requests/page.rb +113 -0
- data/lib/nucleo/requests/page_alerts.rb +36 -0
- data/lib/nucleo/requests/page_changes.rb +44 -0
- data/lib/nucleo/requests/site.rb +26 -0
- data/lib/nucleo/requests/site_changes.rb +56 -0
- data/lib/nucleo/requests/site_feed.rb +41 -0
- data/lib/nucleo/response.rb +52 -0
- data/lib/nucleo/utilities.rb +7 -0
- data/lib/nucleo/utilities/status_code_mapper.rb +53 -0
- data/lib/nucleo/webhook.rb +26 -0
- data/nucleo-client.gemspec +35 -0
- data/spec/data/models/feed_types/seo/heading_tag_length.json +55 -0
- data/spec/data/models/feed_types/seo/internal_link_count.json +149 -0
- data/spec/data/models/feed_types/seo/no_follow_link_count.json +142 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/unit/nucleo/models/concerns/count_spec.rb +103 -0
- data/spec/unit/nucleo/models/concerns/length_spec.rb +79 -0
- data/spec/unit/nucleo/models/feed_types/analytics/site/pages_no_data_spec.rb +39 -0
- data/spec/unit/nucleo/models/metric_periods_comparison_spec.rb +50 -0
- data/spec/unit/nucleo/models/metric_periods_comparisons_spec.rb +58 -0
- metadata +341 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.expand_path('../analytics/base', __FILE__)
|
|
2
|
+
require File.expand_path('../analytics/page/social', __FILE__)
|
|
3
|
+
require File.expand_path('../analytics/page/pages', __FILE__)
|
|
4
|
+
require File.expand_path('../analytics/page/channels', __FILE__)
|
|
5
|
+
require File.expand_path('../analytics/page/referrers', __FILE__)
|
|
6
|
+
require File.expand_path('../analytics/site/social', __FILE__)
|
|
7
|
+
require File.expand_path('../analytics/site/pages', __FILE__)
|
|
8
|
+
require File.expand_path('../analytics/site/channels', __FILE__)
|
|
9
|
+
require File.expand_path('../analytics/site/referrers', __FILE__)
|
|
10
|
+
|
|
11
|
+
module Nucleo
|
|
12
|
+
module Models
|
|
13
|
+
module FeedTypes
|
|
14
|
+
module Analytics
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Page
|
|
6
|
+
|
|
7
|
+
class Channels < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:channelGrouping'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Delegates to the Metric Period
|
|
42
|
+
#
|
|
43
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
44
|
+
def prior_period
|
|
45
|
+
self.metric.metric_periods.prior_period
|
|
46
|
+
end
|
|
47
|
+
alias :previous_period :prior_period
|
|
48
|
+
|
|
49
|
+
# Delegates to the Metric Period
|
|
50
|
+
#
|
|
51
|
+
# @return [Nucleo::Models::MetricPeriodsComparisons]
|
|
52
|
+
def periods_comparisons
|
|
53
|
+
self.metric.metric_periods.periods_comparisons
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Page
|
|
6
|
+
|
|
7
|
+
class Pages < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:pageviews'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def any?
|
|
42
|
+
self.current_period.rows?
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Delegates to the Metric Period
|
|
46
|
+
#
|
|
47
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
48
|
+
def prior_period
|
|
49
|
+
self.metric.metric_periods.prior_period
|
|
50
|
+
end
|
|
51
|
+
alias :previous_period :prior_period
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Page
|
|
6
|
+
|
|
7
|
+
class Referrers < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:source'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Delegates to the Metric Period
|
|
42
|
+
#
|
|
43
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
44
|
+
def prior_period
|
|
45
|
+
self.metric.metric_periods.prior_period
|
|
46
|
+
end
|
|
47
|
+
alias :previous_period :prior_period
|
|
48
|
+
|
|
49
|
+
# Delegates to the Metric Period
|
|
50
|
+
#
|
|
51
|
+
# @return [Nucleo::Models::MetricPeriodsComparisons]
|
|
52
|
+
def periods_comparisons
|
|
53
|
+
self.metric.metric_periods.periods_comparisons
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Page
|
|
6
|
+
|
|
7
|
+
class Social < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:socialNetwork'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Delegates to the Metric Period
|
|
42
|
+
#
|
|
43
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
44
|
+
def prior_period
|
|
45
|
+
self.metric.metric_periods.prior_period
|
|
46
|
+
end
|
|
47
|
+
alias :previous_period :prior_period
|
|
48
|
+
|
|
49
|
+
# Delegates to the Metric Period
|
|
50
|
+
#
|
|
51
|
+
# @return [Nucleo::Models::MetricPeriodsComparisons]
|
|
52
|
+
def periods_comparisons
|
|
53
|
+
self.metric.metric_periods.periods_comparisons
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Site
|
|
6
|
+
|
|
7
|
+
class Channels < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:channelGrouping'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Delegates to the Metric Period
|
|
42
|
+
#
|
|
43
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
44
|
+
def prior_period
|
|
45
|
+
self.metric.metric_periods.prior_period
|
|
46
|
+
end
|
|
47
|
+
alias :previous_period :prior_period
|
|
48
|
+
|
|
49
|
+
# Delegates to the Metric Period
|
|
50
|
+
#
|
|
51
|
+
# @return [Nucleo::Models::MetricPeriodsComparisons]
|
|
52
|
+
def periods_comparisons
|
|
53
|
+
self.metric.metric_periods.periods_comparisons
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require File.expand_path('../../../../metric', __FILE__)
|
|
2
|
+
require File.expand_path('../../base', __FILE__)
|
|
3
|
+
|
|
4
|
+
module Nucleo
|
|
5
|
+
module Models
|
|
6
|
+
module FeedTypes
|
|
7
|
+
module Analytics
|
|
8
|
+
module Site
|
|
9
|
+
|
|
10
|
+
class Pages < Nucleo::Models::FeedTypes::Analytics::Base
|
|
11
|
+
DIMENSION_NAME = 'ga:pageviews'.freeze
|
|
12
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
13
|
+
|
|
14
|
+
# Returns the specific Metric for this page
|
|
15
|
+
#
|
|
16
|
+
# @return [Nucleo::Models::Metric]
|
|
17
|
+
def metric
|
|
18
|
+
params = {
|
|
19
|
+
'metric' => METRIC_NAME,
|
|
20
|
+
'dimension' => DIMENSION_NAME,
|
|
21
|
+
'classification' => @attributes['classification'],
|
|
22
|
+
'totals' => data.fetch('totals', {}),
|
|
23
|
+
'current_period' => data.fetch('current_period', {}),
|
|
24
|
+
'prior_period' => data.fetch('prior_period', {})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Nucleo::Models::Metric.new(params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Delegates to the Totals
|
|
31
|
+
#
|
|
32
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
33
|
+
def totals
|
|
34
|
+
self.metric.metric_periods.totals
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Delegates to the Metric Period
|
|
38
|
+
#
|
|
39
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
40
|
+
def current_period
|
|
41
|
+
self.metric.metric_periods.current_period
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def any?
|
|
45
|
+
self.current_period.rows?
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Delegates to the Metric Period
|
|
49
|
+
#
|
|
50
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
51
|
+
def prior_period
|
|
52
|
+
self.metric.metric_periods.prior_period
|
|
53
|
+
end
|
|
54
|
+
alias :previous_period :prior_period
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Nucleo
|
|
2
|
+
module Models
|
|
3
|
+
module FeedTypes
|
|
4
|
+
module Analytics
|
|
5
|
+
module Site
|
|
6
|
+
|
|
7
|
+
class Referrers < Nucleo::Models::FeedTypes::Analytics::Base
|
|
8
|
+
DIMENSION_NAME = 'ga:source'.freeze
|
|
9
|
+
METRIC_NAME = 'ga:pageviews'.freeze
|
|
10
|
+
|
|
11
|
+
# Returns the specific Metric for this page
|
|
12
|
+
#
|
|
13
|
+
# @return [Nucleo::Models::Metric]
|
|
14
|
+
def metric
|
|
15
|
+
params = {
|
|
16
|
+
'metric' => METRIC_NAME,
|
|
17
|
+
'dimension' => DIMENSION_NAME,
|
|
18
|
+
'classification' => @attributes['classification'],
|
|
19
|
+
'totals' => data['totals'],
|
|
20
|
+
'current_period' => data['current_period'],
|
|
21
|
+
'prior_period' => data['prior_period']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Nucleo::Models::Metric.new(params)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delegates to the Totals
|
|
28
|
+
#
|
|
29
|
+
# @return [Nucleo::Models::MetricPeriodsTotals]
|
|
30
|
+
def totals
|
|
31
|
+
self.metric.metric_periods.totals
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Delegates to the Metric Period
|
|
35
|
+
#
|
|
36
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
37
|
+
def current_period
|
|
38
|
+
self.metric.metric_periods.current_period
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Delegates to the Metric Period
|
|
42
|
+
#
|
|
43
|
+
# @return [Nucleo::Models::MetricPeriod]
|
|
44
|
+
def prior_period
|
|
45
|
+
self.metric.metric_periods.prior_period
|
|
46
|
+
end
|
|
47
|
+
alias :previous_period :prior_period
|
|
48
|
+
|
|
49
|
+
# Delegates to the Metric Period
|
|
50
|
+
#
|
|
51
|
+
# @return [Nucleo::Models::MetricPeriodsComparisons]
|
|
52
|
+
def periods_comparisons
|
|
53
|
+
self.metric.metric_periods.periods_comparisons
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|