g_ruby 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/g_ruby/analytics.rb +63 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a6254726c2bdae69feea7238c77c67a182773f1
4
- data.tar.gz: d7cdbb85e497e5b4d5420be031338703f2ff84eb
3
+ metadata.gz: 53e3e76e11e3c4e052383526390eb5b62ee40ea9
4
+ data.tar.gz: bcd26746404bfcea68009b701aa0463f951d4ec3
5
5
  SHA512:
6
- metadata.gz: c3527db5357e6c292ce956f90b5181982ab4b4cf78ecb9386e7609b5df948204af3d4647e49e8c46c1b0e77d6b163760da33abc0659c0474fef62656f0c08d91
7
- data.tar.gz: 69762cbe80898b5513cc0286cbb3fd8ed93b729272e6b529dc707a453eddc9f1a29d144f3ffacc3f9659e36f74c3367b05c577ce9c3fd151a6c7dd4d470c9b06
6
+ metadata.gz: 94b45960edb4bd905370de4717deb40e8e8e036715904aed2b29e73361c8a7521a10612892d283e0edc11db15953434b6fbd8eec405b70191ded14a5736f9d34
7
+ data.tar.gz: 012cf4a4f9bac5626eff28097375de0b404c8fbea38eddfb399893c4884424e97022cff424cd09110337553bbccf77bdbd90ad60c2a8be80b9d85b031c5db4ad
@@ -1,6 +1,69 @@
1
1
  class GRuby::Analytics
2
2
 
3
3
  require 'g_ruby/util'
4
+
5
+ #---------------------------------------------------------------------------------------------------
6
+
7
+ #GRuby::Analytics.accounts(access_token, pid)
8
+ def self.accounts(access_token, pid)
9
+ url = "https://www.googleapis.com/analytics/v3/management/accounts?access_token=#{access_token}"
10
+ a = GRuby::Util.get_json(Nestful.get(url))
11
+ response_obj = []
12
+ if !a.blank?
13
+ if !a["items"].blank?
14
+ if !a["items"].first.blank?
15
+ a["items"].each do |account|
16
+ if !account["id"].blank?
17
+ url_w = "https://www.googleapis.com/analytics/v3/management/accounts/#{account['id'].to_s}/webproperties?access_token=#{access_token}"
18
+ w = GRuby::Util.get_json(Nestful.get(url_w))
19
+ if !w.blank?
20
+ if !w["items"].blank?
21
+ if !w["items"].first.blank?
22
+ w["items"].each do |webprop|
23
+ if !webprop["id"].blank?
24
+ url_p = "https://www.googleapis.com/analytics/v3/management/accounts/#{account['id'].to_s}/webproperties/#{webprop['id'].to_s}/profiles?access_token=#{access_token}"
25
+ p = GRuby::Util.get_json(Nestful.get(url_p))
26
+ if !p.blank?
27
+ if !p["items"].blank?
28
+ if !p["items"].first.blank?
29
+ p["items"].each do |prof|
30
+ if !prof["id"].blank?
31
+ if pid == prof["id"]
32
+ response_obj << [account["id"], webprop["id"], prof["created"]]
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ return response_obj
50
+ end
51
+
52
+ #---------------------------------------------------------------------------------------------------
53
+
54
+ #def self.goals(access_token, aid, wid, pid)
55
+ #url = "https://www.googleapis.com/analytics/v3/management/accounts/#{aid}/webproperties/#{wid}/profiles/#{pid}/goals?access_token=#{access_token}"
56
+ #a = GRuby::Util.get_json(Nestful.get(url))
57
+ #response_obj = []
58
+ #if !a["items"].blank?
59
+ #if !a["items"].first.blank?
60
+ #a["items"].each do b
61
+ #response_obj << [start_date: , end_date: ]
62
+ #end
63
+ #end
64
+ #end
65
+ #return response_obj
66
+ #end
4
67
 
5
68
  #---------------------------------------------------------------------------------------------------
6
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pykih Software