gosquared 3.0.4 → 3.0.5

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: 190af14d102193d71cd19ee272100216f2192fae
4
- data.tar.gz: d736e2f7d7fc41c69e98628fe6886144f00e2744
3
+ metadata.gz: 1ff55e13c13a2257f392ad1db2061ab1df6e5622
4
+ data.tar.gz: 6eebd97fd56fd930e8a359d3fa891314dc85165d
5
5
  SHA512:
6
- metadata.gz: 6f050ba2156fb41fe186a622b04162446b0eb80de08b47617a89ed7babfad4b16ebf4d7e5572f4670dc7712387fad73c9bb04d526f3a0c7ea9c7d25bdf15fc87
7
- data.tar.gz: a8393ddb2aa97c3a116a6270423f6fba3c880f3646927ce545e9faf60c73b7f120fedc4e725fefa82f20b875798152b14ada071571740d2207d8f71aa5fccaf7
6
+ metadata.gz: 5e5ce765890f16d25ea8c7a626f29b4523724af4b50ac0411d5e62cff9efdc0cfefc312436b2a7850c4c0c47e8855706ce3eae9b7ee93d37d670b0a6c98eac19
7
+ data.tar.gz: 1a569d045d27f60a3a0f2dda475dda8177911455315a1603bab71f33c2e21477787f5b858f1abaa8a9a3f3471934bdd46e8731509573e6ef5d1cc7e0a2341b09
@@ -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 smartgroups).freeze
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
@@ -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
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-05-02 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec