gosquared 3.0.4 → 3.0.5
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 +4 -4
- data/lib/gosquared/people.rb +10 -1
- data/spec/people_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff55e13c13a2257f392ad1db2061ab1df6e5622
|
4
|
+
data.tar.gz: 6eebd97fd56fd930e8a359d3fa891314dc85165d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5ce765890f16d25ea8c7a626f29b4523724af4b50ac0411d5e62cff9efdc0cfefc312436b2a7850c4c0c47e8855706ce3eae9b7ee93d37d670b0a6c98eac19
|
7
|
+
data.tar.gz: 1a569d045d27f60a3a0f2dda475dda8177911455315a1603bab71f33c2e21477787f5b858f1abaa8a9a3f3471934bdd46e8731509573e6ef5d1cc7e0a2341b09
|
data/lib/gosquared/people.rb
CHANGED
@@ -5,7 +5,7 @@ module Gosquared
|
|
5
5
|
|
6
6
|
BASEURL = "https://api.gosquared.com/people/v1/".freeze
|
7
7
|
VERSION = %w(v1 v2 v3).freeze
|
8
|
-
DIMENSIONS = %w(devices eventTypes people propertyTypes feed
|
8
|
+
DIMENSIONS = %w(devices eventTypes people propertyTypes feed).freeze
|
9
9
|
@@filters = {query: @query, filters: @filters, sort: @sort,
|
10
10
|
format: @presenter, limit: @limit, type: @type, from: @from, to: @to}
|
11
11
|
|
@@ -38,6 +38,15 @@ module Gosquared
|
|
38
38
|
self
|
39
39
|
end
|
40
40
|
|
41
|
+
def smartgroups(group_id=nil, filter=nil)
|
42
|
+
if group_id
|
43
|
+
@dimension = "smartgroups/#{group_id}/people" if filter == "people"
|
44
|
+
@dimension = "smartgroups/#{group_id}/count/latest" if filter== "count"
|
45
|
+
else @dimension = "smartgroups"
|
46
|
+
end
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
41
50
|
def fetch
|
42
51
|
data = Client.new.get(url)
|
43
52
|
@@filters.each{|key, value| @@filters[key]=nil} if data
|
data/spec/people_spec.rb
CHANGED
@@ -80,4 +80,33 @@ describe Gosquared::People do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
|
83
|
+
it "fetches the people in a smartgroup from the GoSquared People API" do
|
84
|
+
data = '{"a": [{"test": "response"}]}'
|
85
|
+
stub_request(:get, "https://api.gosquared.com/people/v1/smartgroups/wat/people?api_key=demo&site_token=GSN-106863-S").
|
86
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
|
87
|
+
to_return(:status => 200, :body => data, :headers => {})
|
88
|
+
gs.people.smartgroups('wat','people')
|
89
|
+
expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
it "fetches the people in a smartgroup from the GoSquared People API" do
|
94
|
+
data = '{"a": [{"test": "response"}]}'
|
95
|
+
stub_request(:get, "https://api.gosquared.com/people/v1/smartgroups/wat/count/latest?api_key=demo&site_token=GSN-106863-S").
|
96
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
|
97
|
+
to_return(:status => 200, :body => data, :headers => {})
|
98
|
+
gs.people.smartgroups('wat','count')
|
99
|
+
expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
|
100
|
+
end
|
101
|
+
|
102
|
+
it "fetches smartgroups from the GoSquared People API" do
|
103
|
+
data = '{"a": [{"test": "response"}]}'
|
104
|
+
stub_request(:get, "https://api.gosquared.com/people/v1/smartgroups?api_key=demo&site_token=GSN-106863-S").
|
105
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
|
106
|
+
to_return(:status => 200, :body => data, :headers => {})
|
107
|
+
gs.people.smartgroups
|
108
|
+
expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
|
109
|
+
end
|
110
|
+
|
111
|
+
|
83
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosquared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Vaughan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|