legato 0.5.0 → 0.5.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: c6894ffe83c0b0804d91e08de3ff8b6afddf03fc
4
- data.tar.gz: 75f96f307e200111ab1cb3ef0925aa3c1fe5d189
3
+ metadata.gz: d8b3ba1c16166742956642f4a56d653a1ef29979
4
+ data.tar.gz: d78953dc68eb6334f49d88cb283ce786702ee942
5
5
  SHA512:
6
- metadata.gz: 3d9acc61f35b61b73969fbe12dace66ac5b82552e9089186825acf3596ba5e6c1f2578883acb56ab5d33b3ebb54d06157dcf2e40a2a4651b9281babbcd7628fe
7
- data.tar.gz: 822a73cbf77fa7c33a12f21a7c71309b946cd18c9ca4f06b145e132aefcb1712488db0937d5d92343b13f6cf3b2e1e55026e6e4224cc6eb444b927894ea8584a
6
+ metadata.gz: 4932242d29976df1b52c3289377f2f686d3e9fe2d6f54f290217a8f55db956d2737b35b81457fb20a60a74554f3b00e59aad90728cafb3868e16b1b8128243da
7
+ data.tar.gz: 5db330c1e6397053c566adffb26c58cc145d0a536965c78a1e0b28484addbeb24c2d3396bdb4c2ad07502b5a9dab67e2cb51ca9c955b71051f9c92f871c4df1c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## Legato 0.5.1 ##
2
+
3
+ * `Legato::User#segments`
4
+ * `Legato::User#goals`
5
+ * README fixes to `filter` block syntax
6
+
7
+ *Yuji Yamamoto*
8
+
1
9
  ## Legato 0.5.0 ##
2
10
 
3
11
  * Use Query#tracking_scope when converting `metrics`, `dimensions`, and `sort` list of parameters with `to_params`
data/README.md CHANGED
@@ -26,46 +26,46 @@ If you're not able to upgrade quite yet, Garb has been maintained https://github
26
26
 
27
27
  1. Get an OAuth2 Access Token from Google, Read about [OAuth2](https://github.com/tpitale/legato/wiki/OAuth2-and-Google)
28
28
 
29
- ```ruby
30
- access_token = OAuth2 Access Token # from Google
31
- ```
29
+ ```ruby
30
+ access_token = OAuth2 Access Token # from Google
31
+ ```
32
32
 
33
33
  2. Create a New User with the Access Token
34
34
 
35
- ```ruby
36
- user = Legato::User.new(access_token)
37
- ```
35
+ ```ruby
36
+ user = Legato::User.new(access_token)
37
+ ```
38
38
 
39
39
  3. List the Accounts and Profiles of the first Account
40
40
 
41
- ```ruby
42
- user.accounts
43
- user.accounts.first.profiles
44
- ```
41
+ ```ruby
42
+ user.accounts
43
+ user.accounts.first.profiles
44
+ ```
45
45
 
46
46
  4. List all the Profiles the User has Access to
47
47
 
48
- ```ruby
49
- user.profiles
50
- ```
48
+ ```ruby
49
+ user.profiles
50
+ ```
51
51
 
52
52
  5. Get a Profile
53
53
 
54
- ```ruby
55
- profile = user.profiles.first
56
- ```
54
+ ```ruby
55
+ profile = user.profiles.first
56
+ ```
57
57
 
58
58
  6. The Profile Carries the User
59
59
 
60
- ```ruby
61
- profile.user == user #=> true
62
- ```
60
+ ```ruby
61
+ profile.user == user #=> true
62
+ ```
63
63
 
64
64
  7. The profile can also lookup its "parent" Web Property
65
65
 
66
- ```ruby
67
- profile.web_property
68
- ```
66
+ ```ruby
67
+ profile.web_property
68
+ ```
69
69
 
70
70
  ## Google Analytics Model ##
71
71
 
@@ -103,25 +103,29 @@ Inside of any `Legato::Model` class, the method `filter` is available (like `met
103
103
  Return entries with exits counts greater than or equal to 2000
104
104
 
105
105
  ```ruby
106
+ filter(:high_exits) {gte(:exits, 2000)}
107
+
108
+ # or ...
109
+
106
110
  filter :high_exits, &lambda {gte(:exits, 2000)}
107
111
  ```
108
112
 
109
113
  Return entries with pageview metric less than or equal to 200
110
114
 
111
115
  ```ruby
112
- filter :low_pageviews, &lambda {lte(:pageviews, 200)}
116
+ filter(:low_pageviews) {lte(:pageviews, 200)}
113
117
  ```
114
118
 
115
119
  Filters with dimensions
116
120
 
117
121
  ```ruby
118
- filter :for_browser, &lambda {|browser| matches(:browser, browser)}
122
+ filter(:for_browser) {|browser| matches(:browser, browser)}
119
123
  ```
120
124
 
121
125
  Filters with OR
122
126
 
123
127
  ```ruby
124
- filter :browsers, &lambda {|*browsers| browsers.map {|browser| matches(:browser, browser)}}
128
+ filter(:browsers) {|*browsers| browsers.map {|browser| matches(:browser, browser)}}
125
129
  ```
126
130
 
127
131
 
@@ -162,7 +166,7 @@ Be sure to pass the appropriate number of arguments matching the lambda for your
162
166
  For a filter defined like this:
163
167
 
164
168
  ```ruby
165
- filter :browsers, &lambda {|*browsers| browsers.map {|browser| matches(:browser, browser)}}
169
+ filter(:browsers) {|*browsers| browsers.map {|browser| matches(:browser, browser)}}
166
170
  ```
167
171
 
168
172
  We can use it like this, passing any number of arguments:
data/lib/legato/user.rb CHANGED
@@ -47,6 +47,16 @@ module Legato
47
47
  Management::Profile.all(self)
48
48
  end
49
49
 
50
+ # All the `Segment` records available to this user
51
+ def segments
52
+ Management::Segment.all(self)
53
+ end
54
+
55
+ # All the `Goal` records available to this user
56
+ def goals
57
+ Management::Goal.all(self)
58
+ end
59
+
50
60
  def url_for(query)
51
61
  raise "invalid tracking_scope" unless tracking_scope_valid?(query.tracking_scope)
52
62
 
@@ -1,3 +1,3 @@
1
1
  module Legato
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -60,5 +60,17 @@ describe Legato::User do
60
60
  @user.profiles
61
61
  Legato::Management::Profile.should have_received(:all).with(@user)
62
62
  end
63
+
64
+ it 'has segments' do
65
+ Legato::Management::Segment.stubs(:all)
66
+ @user.segments
67
+ Legato::Management::Segment.should have_received(:all).with(@user)
68
+ end
69
+
70
+ it 'has goals' do
71
+ Legato::Management::Goal.stubs(:all)
72
+ @user.goals
73
+ Legato::Management::Goal.should have_received(:all).with(@user)
74
+ end
63
75
  end
64
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake