gosquared 3.0.7 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/gosquared.rb +36 -39
- data/lib/gosquared/account.rb +2 -2
- data/lib/gosquared/client.rb +55 -57
- data/lib/gosquared/now.rb +45 -48
- data/lib/gosquared/people.rb +58 -57
- data/lib/gosquared/tracking.rb +37 -39
- data/lib/gosquared/trends.rb +49 -50
- data/spec/account_spec.rb +54 -58
- data/spec/client_spec.rb +54 -55
- data/spec/now_spec.rb +25 -26
- data/spec/people_spec.rb +103 -97
- data/spec/spec_helper.rb +51 -53
- data/spec/tracking_spec.rb +47 -50
- data/spec/trends_spec.rb +30 -31
- metadata +2 -2
data/spec/people_spec.rb
CHANGED
@@ -1,112 +1,118 @@
|
|
1
1
|
describe Gosquared::People do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
Gosquared::People::DIMENSIONS.each do |dimension|
|
15
|
-
it "fetches a request from the GoSquared People API with #{dimension} dimension" do
|
16
|
-
next if dimension == "people"
|
17
|
-
gs.send "#{dimension}"
|
18
|
-
expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
before do
|
23
|
-
data = '{"a": [{"test": "response"}, {"with": "params"}]}'
|
24
|
-
stub_request(:get, "https://api.gosquared.com/people/v1/people/example.email@example.com/devices?api_key=demo&site_token=GSN-106863-S").
|
25
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
|
26
|
-
to_return(:status => 200, :body => data, :headers => {})
|
27
|
-
end
|
2
|
+
subject(:gs) { described_class.new('demo', 'GSN-106863-S') }
|
3
|
+
|
4
|
+
Gosquared::People::DIMENSIONS.each do |dimension|
|
5
|
+
before do
|
6
|
+
data = '{"a": [{"test": "response"}]}'
|
7
|
+
stub_request(:get, "https://api.gosquared.com/people/v1/#{dimension}?api_key=demo&site_token=GSN-106863-S")
|
8
|
+
.with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' })
|
9
|
+
.to_return(status: 200, body: data, headers: {})
|
10
|
+
end
|
11
|
+
end
|
28
12
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
13
|
+
Gosquared::People::DIMENSIONS.each do |dimension|
|
14
|
+
it "fetches a request from the GoSquared People API with #{dimension} dimension" do
|
15
|
+
next if dimension == 'people'
|
33
16
|
|
17
|
+
gs.send dimension.to_s
|
18
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
|
19
|
+
end
|
20
|
+
end
|
34
21
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
22
|
+
before do
|
23
|
+
data = '{"a": [{"test": "response"}, {"with": "params"}]}'
|
24
|
+
stub_request(:get, 'https://api.gosquared.com/people/v1/people/example.email@example.com/devices?api_key=demo&site_token=GSN-106863-S')
|
25
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
26
|
+
.to_return(status: 200, body: data, headers: {})
|
27
|
+
end
|
43
28
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
29
|
+
it 'fetches a request from the GoSquared People API with a person_id and paramaters' do
|
30
|
+
gs.people.person_id('example.email@example.com', 'devices')
|
31
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }, { 'with' => 'params' }])
|
32
|
+
end
|
50
33
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
34
|
+
Gosquared::People::DIMENSIONS.each do |dimension|
|
35
|
+
before do
|
36
|
+
data = '{"a": [{"test": "response"}, {"with": "params"}]}'
|
37
|
+
stub_request(:get, "https://api.gosquared.com/people/v1/#{dimension}?api_key=demo&site_token=GSN-106863-S&limit=5")
|
38
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
39
|
+
.to_return(status: 200, body: data, headers: {})
|
40
|
+
end
|
56
41
|
end
|
57
42
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
value: "london"
|
65
|
-
},
|
66
|
-
{
|
67
|
-
key: "and",
|
68
|
-
filters: [
|
69
|
-
{
|
70
|
-
"key": "property",
|
71
|
-
"path": "totals.visits",
|
72
|
-
"operator": ">",
|
73
|
-
"value": "1000"
|
74
|
-
}
|
75
|
-
]
|
76
|
-
}
|
77
|
-
]
|
78
|
-
gs.people.people.filters(array)
|
79
|
-
expect(gs.fetch).to eq("a" => [{"test"=>"response"}, {"with"=>"filters"}])
|
80
|
-
end
|
43
|
+
Gosquared::People::DIMENSIONS.each do |dimension|
|
44
|
+
it 'fetches a request from the GoSquared People API with dimension and paramaters' do
|
45
|
+
gs.send(dimension.to_s).limit(5)
|
46
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }, { 'with' => 'params' }])
|
47
|
+
end
|
48
|
+
end
|
81
49
|
|
50
|
+
before do
|
51
|
+
data = '{"a": [{"test": "response"}, {"with": "filters"}]}'
|
52
|
+
stub_request(:get, 'https://api.gosquared.com/people/v1/people?api_key=demo&filters=%5B%7B%22key%22:%22property%22,%22path%22:%22last.location.city%22,%22operator%22:%22contains%22,%22value%22:%22london%22%7D,%7B%22key%22:%22and%22,%22filters%22:%5B%7B%22key%22:%22property%22,%22path%22:%22totals.visits%22,%22operator%22:%22%3E%22,%22value%22:%221000%22%7D%5D%7D%5D&site_token=GSN-106863-S')
|
53
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
54
|
+
.to_return(status: 200, body: data, headers: {})
|
55
|
+
end
|
82
56
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
57
|
+
it 'fetches a request from the GoSquared People API with filtering on properties' do
|
58
|
+
array = [
|
59
|
+
{
|
60
|
+
key: 'property',
|
61
|
+
path: 'last.location.city',
|
62
|
+
operator: 'contains',
|
63
|
+
value: 'london'
|
64
|
+
},
|
65
|
+
{
|
66
|
+
key: 'and',
|
67
|
+
filters: [
|
68
|
+
{
|
69
|
+
"key": 'property',
|
70
|
+
"path": 'totals.visits',
|
71
|
+
"operator": '>',
|
72
|
+
"value": '1000'
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
]
|
77
|
+
gs.people.people.filters(array)
|
78
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }, { 'with' => 'filters' }])
|
79
|
+
end
|
91
80
|
|
81
|
+
it 'fetches the people in a smartgroup from the GoSquared People API' do
|
82
|
+
data = '{"a": [{"test": "response"}]}'
|
83
|
+
stub_request(:get, 'https://api.gosquared.com/people/v1/smartgroups/wat/people?api_key=demo&site_token=GSN-106863-S')
|
84
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
85
|
+
.to_return(status: 200, body: data, headers: {})
|
86
|
+
gs.people.smartgroups('wat', 'people')
|
87
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
|
88
|
+
end
|
92
89
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
90
|
+
it 'fetches the people in a smartgroup from the GoSquared People API' do
|
91
|
+
data = '{"a": [{"test": "response"}]}'
|
92
|
+
stub_request(:get, 'https://api.gosquared.com/people/v1/smartgroups/wat/count/latest?api_key=demo&site_token=GSN-106863-S')
|
93
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
94
|
+
.to_return(status: 200, body: data, headers: {})
|
95
|
+
gs.people.smartgroups('wat', 'count')
|
96
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
|
97
|
+
end
|
101
98
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
99
|
+
it 'fetches smartgroups from the GoSquared People API' do
|
100
|
+
data = '{"a": [{"test": "response"}]}'
|
101
|
+
stub_request(:get, 'https://api.gosquared.com/people/v1/smartgroups?api_key=demo&site_token=GSN-106863-S')
|
102
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
103
|
+
.to_return(status: 200, body: data, headers: {})
|
104
|
+
gs.people.smartgroups
|
105
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
|
106
|
+
end
|
110
107
|
|
108
|
+
it 'deletes a person from a project' do
|
109
|
+
stub_request(:delete, "https://api.gosquared.com/people/v1/people/1?api_key=demo&site_token=GSN-106863-S").
|
110
|
+
with(:body => "[{}]",
|
111
|
+
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
|
112
|
+
to_return(:status => 200, :body => "", :headers => {})
|
113
|
+
gs.people.people.person_id('1')
|
114
|
+
response = gs.people.delete
|
115
|
+
expect(response.code).to eq("200")
|
116
|
+
end
|
111
117
|
|
112
|
-
|
118
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -49,57 +49,55 @@ RSpec.configure do |config|
|
|
49
49
|
mocks.verify_partial_doubles = true
|
50
50
|
end
|
51
51
|
|
52
|
-
# The settings below are suggested to provide a good initial experience
|
53
|
-
# with RSpec, but feel free to customize to your heart's content.
|
54
|
-
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
config.
|
60
|
-
|
61
|
-
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# - http://
|
70
|
-
# - http://
|
71
|
-
#
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
#
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
|
92
|
-
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
Kernel.srand config.seed
|
104
|
-
=end
|
52
|
+
# The settings below are suggested to provide a good initial experience
|
53
|
+
# with RSpec, but feel free to customize to your heart's content.
|
54
|
+
# # These two settings work together to allow you to limit a spec run
|
55
|
+
# # to individual examples or groups you care about by tagging them with
|
56
|
+
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
57
|
+
# # get run.
|
58
|
+
# config.filter_run :focus
|
59
|
+
# config.run_all_when_everything_filtered = true
|
60
|
+
#
|
61
|
+
# # Allows RSpec to persist some state between runs in order to support
|
62
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
63
|
+
# # you configure your source control system to ignore this file.
|
64
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
65
|
+
#
|
66
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
67
|
+
# # recommended. For more details, see:
|
68
|
+
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
69
|
+
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
71
|
+
# config.disable_monkey_patching!
|
72
|
+
#
|
73
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
74
|
+
# # be too noisy due to issues in dependencies.
|
75
|
+
# config.warnings = true
|
76
|
+
#
|
77
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
78
|
+
# # file, and it's useful to allow more verbose output when running an
|
79
|
+
# # individual spec file.
|
80
|
+
# if config.files_to_run.one?
|
81
|
+
# # Use the documentation formatter for detailed output,
|
82
|
+
# # unless a formatter has already been configured
|
83
|
+
# # (e.g. via a command-line flag).
|
84
|
+
# config.default_formatter = 'doc'
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# # Print the 10 slowest examples and example groups at the
|
88
|
+
# # end of the spec run, to help surface which specs are running
|
89
|
+
# # particularly slow.
|
90
|
+
# config.profile_examples = 10
|
91
|
+
#
|
92
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
93
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
94
|
+
# # the seed, which is printed after each run.
|
95
|
+
# # --seed 1234
|
96
|
+
# config.order = :random
|
97
|
+
#
|
98
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
99
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
100
|
+
# # test failures related to randomization by passing the same `--seed` value
|
101
|
+
# # as the one that triggered the failure.
|
102
|
+
# Kernel.srand config.seed
|
105
103
|
end
|
data/spec/tracking_spec.rb
CHANGED
@@ -1,52 +1,49 @@
|
|
1
1
|
describe Gosquared::Tracking do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
2
|
+
subject(:gs) { described_class.new('demo', 'GSN-2194840-F') }
|
3
|
+
|
4
|
+
VERSION = '3.0.7'.freeze
|
5
|
+
|
6
|
+
Gosquared::Tracking::DIMENSIONS.each do |dimension|
|
7
|
+
before do
|
8
|
+
stub_request(:post, "https://api.gosquared.com/tracking/v1/#{dimension}?api_key=demo&site_token=GSN-2194840-F")
|
9
|
+
.with(body: '[{"person_id":"email:test@example.com","properties":{"email":"test@example.com"}}]',
|
10
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/json', 'User-Agent' => 'ruby-client/' + VERSION })
|
11
|
+
.to_return(status: 200, body: '', headers: { response: 'success' })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Gosquared::Tracking::DIMENSIONS.each do |dimension|
|
16
|
+
it "posts a request to the GoSquared Track API with #{dimension} dimension" do
|
17
|
+
gs.send dimension.to_s, person_id: 'email:test@example.com', properties: { email: 'test@example.com' }
|
18
|
+
expect(gs.post.code).to eq('200')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#event' do
|
23
|
+
before do
|
24
|
+
stub_request(:post, 'https://api.gosquared.com/tracking/v1/event?api_key=demo&site_token=GSN-2194840-F')
|
25
|
+
.with(body: '[{"event":{"name":"event"}}]',
|
26
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/json', 'User-Agent' => 'ruby-client/' + VERSION })
|
27
|
+
.to_return(status: 200, body: '', headers: {})
|
28
|
+
@data = { person_id: nil, event: { name: 'event' } }
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'Tracks an anonymous event when a person_id is nil' do
|
32
|
+
gs.event(@data)
|
33
|
+
expect(gs.post.code).to eq('200')
|
34
|
+
end
|
35
|
+
|
36
|
+
before do
|
37
|
+
stub_request(:post, 'https://api.gosquared.com/tracking/v1/event?api_key=demo&site_token=GSN-2194840-F')
|
38
|
+
.with(body: '[{"person_id":"12345","event":{"name":"event"}}]',
|
39
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/json', 'User-Agent' => 'ruby-client/' + VERSION })
|
40
|
+
.to_return(status: 200, body: '', headers: {})
|
41
|
+
@data = { person_id: '12345', event: { name: 'event' } }
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'Tracks an anonymous event when a person_id is not nil' do
|
45
|
+
gs.event(@data)
|
46
|
+
expect(gs.post.code).to eq('200')
|
47
|
+
end
|
48
|
+
end
|
52
49
|
end
|
data/spec/trends_spec.rb
CHANGED
@@ -1,37 +1,36 @@
|
|
1
1
|
describe Gosquared::Trends do
|
2
|
-
|
2
|
+
subject(:gs) { described_class.new('demo', 'GSN-106863-S') }
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
Gosquared::Trends::DIMENSIONS.each do |dimension|
|
5
|
+
before do
|
6
|
+
data = '{"a": [{"test": "response"}]}'
|
7
|
+
stub_request(:get, "https://api.gosquared.com/trends/v2/#{dimension}?api_key=demo&site_token=GSN-106863-S")
|
8
|
+
.with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' })
|
9
|
+
.to_return(status: 200, body: data, headers: {})
|
10
|
+
end
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
Gosquared::Trends::DIMENSIONS.each do |dimension|
|
14
|
+
it "fetches a request from the GoSquared Trends API with #{dimension} dimension" do
|
15
|
+
gs.send dimension.to_s
|
16
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
|
17
|
+
end
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Gosquared::Trends::DIMENSIONS.each do |dimension|
|
30
|
-
it "fetches a request from the GoSquared Trends API with #{dimension} dimension and paramaters" do
|
31
|
-
gs.send("#{dimension}").from('2016-06-20').to('2016-06-30')
|
32
|
-
.date_format('yyyy-mm-dd').sort('visits').group(true).format('json').limit(5)
|
33
|
-
expect(gs.fetch).to eq("a" => [{"test"=>"response"}, {"with"=>"params"}])
|
34
|
-
end
|
35
|
-
end
|
20
|
+
Gosquared::Trends::DIMENSIONS.each do |dimension|
|
21
|
+
before do
|
22
|
+
data = '{"a": [{"test": "response"}, {"with": "params"}]}'
|
23
|
+
stub_request(:get, "https://api.gosquared.com/trends/v2/#{dimension}?api_key=demo&site_token=GSN-106863-S&dateFormat=yyyy-mm-dd&format=json&from=2016-06-20&group=true&limit=5&site_token=GSN-106863-S&sort=visits&to=2016-06-30")
|
24
|
+
.with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
|
25
|
+
.to_return(status: 200, body: data, headers: {})
|
26
|
+
end
|
27
|
+
end
|
36
28
|
|
29
|
+
Gosquared::Trends::DIMENSIONS.each do |dimension|
|
30
|
+
it "fetches a request from the GoSquared Trends API with #{dimension} dimension and paramaters" do
|
31
|
+
gs.send(dimension.to_s).from('2016-06-20').to('2016-06-30')
|
32
|
+
.date_format('yyyy-mm-dd').sort('visits').group(true).format('json').limit(5)
|
33
|
+
expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }, { 'with' => 'params' }])
|
34
|
+
end
|
35
|
+
end
|
37
36
|
end
|