ga-shikomi 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aefa66eed695aeebed4c52f2aa4fcfb2ea7ba535
4
- data.tar.gz: f67aabae92c5059be40011dc4b7c778ce89134ec
3
+ metadata.gz: 2845b8a68e5ec317c6ad20262a2c489d94e797ac
4
+ data.tar.gz: 07e6b5fdc51f53256df6ec59246e0f706022ff57
5
5
  SHA512:
6
- metadata.gz: f442d95ccac518787f6b235fc30c8ca596be7368c0a743af5f863615b14da616682d3afe97b33be9d21cbcbfcee4152a785cda5c8a5aa19cf13fcde832111ba0
7
- data.tar.gz: f27d1ecde593533849ed0ff3db2128f2c3608fc9d54056bae7f07010e5d78df68a3b6630154be307577bed4a212ae5c74add467f33da536ad72a5943283e7124
6
+ metadata.gz: 164b7532867104eef11618afb57f41640bf028f6bb4d7e783f7ef3ca522784cd23a71feee24a69e6999af6d49abf5033c0465b7b7ac4d748140cb18c84f92385
7
+ data.tar.gz: 548891e6337d0d5114e920b28116ebcbec4c050f53de274fc947e4986ed27b6f2a5ba504d75a50ac71a0f5acb4e257cdae81497e635b92ae1c5ffaa51ea9b67a
data/ga_shikomi.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "google-api-client", ">= 0.8.6", "< 0.9"
21
+ spec.add_runtime_dependency "google-api-client", "0.8.6"
22
22
  spec.add_runtime_dependency "thor"
23
23
  spec.add_runtime_dependency "hirb"
24
24
 
@@ -8,6 +8,25 @@ module GAShikomi
8
8
  # --end-date
9
9
  # --metrics
10
10
  def get(config)
11
+ result = _raw_get(config)
12
+
13
+ case result['rows'].size
14
+ when 1
15
+ [result['totalsForAllResults']]
16
+ else
17
+ fields = %w(columnHeaders totalsForAllResults rows)
18
+ fields.map {|e| {e => result[e]}}.reduce(:merge)
19
+ end
20
+
21
+ end
22
+
23
+ #
24
+ # allow recursive call
25
+ #
26
+ # [param] Hash
27
+ # [return] Hash
28
+ #
29
+ def _raw_get(config)
11
30
  opts = {
12
31
  'ids' => options['profile_id'],
13
32
  'start-date' => options['start_date'],
@@ -30,13 +49,20 @@ module GAShikomi
30
49
 
31
50
  result = api.execute(api.analytics.data.ga.get, opts)
32
51
 
33
- case result['rows'].size
34
- when 1
35
- [result['totalsForAllResults']]
36
- else
37
- fields = %w(columnHeaders totalsForAllResults rows)
38
- fields.map {|e| {e => result[e]}}.reduce(:merge)
52
+ if result['nextLink']
53
+ query = result['query']
54
+ start = query['start-index']
55
+ limit = query['max-results']
56
+
57
+ rows = result['rows']
58
+
59
+ config['start-index'] = start + limit
60
+
61
+ result = _raw_get(config)
62
+ result['rows'] += rows
39
63
  end
64
+
65
+ result
40
66
  end
41
67
  end
42
68
  end
@@ -1,3 +1,3 @@
1
1
  module GAShikomi
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ga-shikomi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wtnabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.8.6
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '0.9'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
24
+ - - '='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.6
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '0.9'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: thor
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
176
  version: '0'
183
177
  requirements: []
184
178
  rubyforge_project:
185
- rubygems_version: 2.2.2
179
+ rubygems_version: 2.2.3
186
180
  signing_key:
187
181
  specification_version: 4
188
182
  summary: Google Analytics API wrapper for CLI written in Ruby.