gosquared 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +1,42 @@
1
- require_relative "client"
1
+ require_relative 'client'
2
2
 
3
3
  module Gosquared
4
4
  class Tracking
5
-
6
- BASEURL = "https://api.gosquared.com/tracking/v1/".freeze
7
- DIMENSIONS = %w(event identify pageview ping properties timeout transaction).freeze
8
-
9
- def initialize(api_key, site_token, client = Gosquared::Client.new)
10
- @site_token = site_token
11
- @api_key = api_key
12
- @client = client
13
- end
14
-
15
- DIMENSIONS.each do |dimension|
16
- define_method dimension do |options|
17
- @dimension = dimension
18
- @data = options
19
- self
20
- end
21
- end
22
-
23
- def post
24
- check_for_nil_user
25
- response = @client.post(url, @data)
26
- @data = nil if response.code === '200'
27
- response
28
- end
29
-
30
- def url
31
- url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
32
- end
33
-
34
- private
35
-
36
- def check_for_nil_user
37
- if @data.key?(:person_id) && @data[:person_id] == nil
38
- @data.tap { |data| @data.delete(:person_id) }
39
- warn 'person_id is nil, event will not be track against a user'
40
- end
41
- end
42
-
5
+ BASEURL = 'https://api.gosquared.com/tracking/v1/'.freeze
6
+ DIMENSIONS = %w[event identify pageview ping properties timeout transaction].freeze
7
+
8
+ def initialize(api_key, site_token, client = Gosquared::Client.new)
9
+ @site_token = site_token
10
+ @api_key = api_key
11
+ @client = client
12
+ end
13
+
14
+ DIMENSIONS.each do |dimension|
15
+ define_method dimension do |options|
16
+ @dimension = dimension
17
+ @data = options
18
+ self
19
+ end
20
+ end
21
+
22
+ def post
23
+ check_for_nil_user
24
+ response = @client.post(url, @data)
25
+ @data = nil if response.code === '200'
26
+ response
27
+ end
28
+
29
+ def url
30
+ url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
31
+ end
32
+
33
+ private
34
+
35
+ def check_for_nil_user
36
+ if @data.key?(:person_id) && @data[:person_id].nil?
37
+ @data.tap { |_data| @data.delete(:person_id) }
38
+ warn 'person_id is nil, event will not be track against a user'
39
+ end
40
+ end
43
41
  end
44
42
  end
@@ -1,52 +1,51 @@
1
- require_relative "client"
1
+ require_relative 'client'
2
2
 
3
3
  module Gosquared
4
- class Trends
5
-
6
- BASEURL = "https://api.gosquared.com/trends/v2/".freeze
7
- DIMENSIONS = %w(aggregate browser category country event language organisation os page path1 product screenDimensions sources transactions).freeze
8
- @@filters = {date_format: @date_format, from: @from, to: @to,
9
- format: @format, limit: @limit, sort: @sort, group: @group,
10
- source_type: @source_type}
11
-
12
- def initialize(api_key, site_token, client = Gosquared::Client.new)
13
- @site_token = site_token
14
- @api_key = api_key
15
- @client = client
16
- end
17
-
18
- DIMENSIONS.each do |dimension|
19
- define_method dimension do
20
- @dimension = dimension
21
- self
22
- end
23
- end
24
-
25
- @@filters.each do |key, value|
26
- define_method key do |argument|
27
- @@filters[key] = argument
28
- self
29
- end
30
- end
31
-
32
- def fetch
33
- data = @client.get(url)
34
- @@filters.each{|key, value| @@filters[key]=nil} if data
35
- data
36
- end
37
-
38
- private
39
-
40
- def url
41
- array = [""]
42
- url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
43
- @@filters.each {|key, value| array << "#{camelize(key.to_s)}=#{value}" if value }
44
- parameters=array.join('&')
45
- url.concat(parameters)
46
- end
47
-
48
- def camelize(key)
49
- key.split('_').each_with_index.map{|fragment, index| index == 0 ? fragment : fragment.capitalize }.join('')
50
- end
51
- end
52
- end
4
+ class Trends
5
+ BASEURL = 'https://api.gosquared.com/trends/v2/'.freeze
6
+ DIMENSIONS = %w[aggregate browser category country event language organisation os page path1 product screenDimensions sources transactions].freeze
7
+ @@filters = { date_format: @date_format, from: @from, to: @to,
8
+ format: @format, limit: @limit, sort: @sort, group: @group,
9
+ source_type: @source_type }
10
+
11
+ def initialize(api_key, site_token, client = Gosquared::Client.new)
12
+ @site_token = site_token
13
+ @api_key = api_key
14
+ @client = client
15
+ end
16
+
17
+ DIMENSIONS.each do |dimension|
18
+ define_method dimension do
19
+ @dimension = dimension
20
+ self
21
+ end
22
+ end
23
+
24
+ @@filters.each do |key, _value|
25
+ define_method key do |argument|
26
+ @@filters[key] = argument
27
+ self
28
+ end
29
+ end
30
+
31
+ def fetch
32
+ data = @client.get(url)
33
+ @@filters.each { |key, _value| @@filters[key] = nil } if data
34
+ data
35
+ end
36
+
37
+ private
38
+
39
+ def url
40
+ array = ['']
41
+ url = BASEURL + @dimension + "?api_key=#{@api_key}" + "&site_token=#{@site_token}"
42
+ @@filters.each { |key, value| array << "#{camelize(key.to_s)}=#{value}" if value }
43
+ parameters = array.join('&')
44
+ url.concat(parameters)
45
+ end
46
+
47
+ def camelize(key)
48
+ key.split('_').each_with_index.map { |fragment, index| index == 0 ? fragment : fragment.capitalize }.join('')
49
+ end
50
+ end
51
+ end
@@ -1,69 +1,65 @@
1
1
  describe Gosquared::Account do
2
- subject(:gs) { described_class.new("demo", "GSN-2194840-F") }
3
- VERSION = "3.0.5"
2
+ subject(:gs) { described_class.new('demo', 'GSN-2194840-F') }
3
+ VERSION = '3.0.7'.freeze
4
4
 
5
+ Gosquared::Account::DIMENSIONS.each do |dimension|
6
+ before do
7
+ data = '{"a": [{"test": "response"}]}'
8
+ stub_request(:get, "https://api.gosquared.com/account/v1/#{dimension}?api_key=demo&site_token=GSN-2194840-F")
9
+ .with(headers: { 'Accept' => '*/*' })
10
+ .to_return(status: 200, body: data, headers: {})
11
+ end
12
+ end
5
13
 
6
- Gosquared::Account::DIMENSIONS.each do |dimension|
7
- before do
8
- data = '{"a": [{"test": "response"}]}'
9
- stub_request(:get, "https://api.gosquared.com/account/v1/#{dimension}?api_key=demo&site_token=GSN-2194840-F" ).
10
- with(headers: {'Accept'=>'*/*'}).
11
- to_return(status: 200, body: data, headers: {})
12
- end
13
- end
14
+ Gosquared::Account::DIMENSIONS.each do |dimension|
15
+ it "fetches a request from the GoSquared Account API with #{dimension} dimension" do
16
+ gs.send(dimension.to_s)
17
+ expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
18
+ end
19
+ end
14
20
 
15
- Gosquared::Account::DIMENSIONS.each do |dimension|
16
- it "fetches a request from the GoSquared Account API with #{dimension} dimension" do
17
- gs.send("#{dimension}")
18
- expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
19
- end
20
- end
21
+ before do
22
+ data = '{"a": [{"test": "response"}]}'
23
+ stub_request(:get, 'https://api.gosquared.com/account/v1/sites/GSN-086224-W?api_key=demo&site_token=GSN-2194840-F')
24
+ .with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com' })
25
+ .to_return(status: 200, body: data, headers: {})
26
+ end
21
27
 
22
- before do
23
- data = '{"a": [{"test": "response"}]}'
24
- stub_request(:get, "https://api.gosquared.com/account/v1/sites/GSN-086224-W?api_key=demo&site_token=GSN-2194840-F").
25
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com'}).
26
- to_return(:status => 200, :body => data, :headers => {})
27
- end
28
+ it 'retrieves a site by its site token' do
29
+ gs.sites.token('GSN-086224-W')
30
+ expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
31
+ end
28
32
 
29
- it "retrieves a site by its site token" do
30
- gs.sites.token("GSN-086224-W")
31
- expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
32
- end
33
+ before do
34
+ stub_request(:post, 'https://api.gosquared.com/account/v1/blocked/ips?api_key=demo&ip=20.15.33.99&site_token=GSN-2194840-F')
35
+ .with(body: '[""]',
36
+ headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/json' })
37
+ .to_return(status: 200, body: '', headers: {})
38
+ stub_request(:delete, 'https://api.gosquared.com/account/v1/blocked/ips?api_key=demo&ip=20.15.33.99&site_token=GSN-2194840-F')
39
+ .with(body: '[""]',
40
+ headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/json' })
41
+ .to_return(status: 200, body: '', headers: {})
42
+ end
33
43
 
34
- before do
35
- stub_request(:post, "https://api.gosquared.com/account/v1/blocked/ips?api_key=demo&ip=20.15.33.99&site_token=GSN-2194840-F").
36
- with(:body => "[\"\"]",
37
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json'}).
38
- to_return(:status => 200, :body => "", :headers => {})
39
- stub_request(:delete, "https://api.gosquared.com/account/v1/blocked/ips?api_key=demo&ip=20.15.33.99&site_token=GSN-2194840-F").
40
- with(:body => "[\"\"]",
41
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json'}).
42
- to_return(:status => 200, :body => "", :headers => {})
43
- end
44
-
45
- it "posts a request to the GoSquared Account API with an IP address to block bots" do
46
- gs.blocked.ips.ip('20.15.33.99')
47
- expect(gs.post.code).to eq('200')
48
- end
49
-
50
- it "sends a delete request to the GoSquared Account API with an IP address to block bots" do
51
- gs.blocked.ips.ip('20.15.33.99')
52
- expect(gs.delete.code).to eq('200')
53
- end
54
-
55
- before do
56
- data = '{"a": [{"test": "response"}]}'
57
- stub_request(:get, "https://api.gosquared.com/account/v1/blocked/visitors/test.email@gmail.com?api_key=demo&site_token=GSN-2194840-F").
58
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
59
- to_return(:status => 200, :body => data, :headers => {})
60
- end
61
-
62
- it "retrieves a list of blocked visitors" do
63
- gs.blocked.visitors("test.email@gmail.com")
64
- expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
65
- end
44
+ it 'posts a request to the GoSquared Account API with an IP address to block bots' do
45
+ gs.blocked.ips.ip('20.15.33.99')
46
+ expect(gs.post.code).to eq('200')
47
+ end
66
48
 
49
+ it 'sends a delete request to the GoSquared Account API with an IP address to block bots' do
50
+ gs.blocked.ips.ip('20.15.33.99')
51
+ expect(gs.delete.code).to eq('200')
52
+ end
67
53
 
54
+ before do
55
+ data = '{"a": [{"test": "response"}]}'
56
+ stub_request(:get, 'https://api.gosquared.com/account/v1/blocked/visitors/test.email@gmail.com?api_key=demo&site_token=GSN-2194840-F')
57
+ .with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
58
+ .to_return(status: 200, body: data, headers: {})
59
+ end
68
60
 
61
+ it 'retrieves a list of blocked visitors' do
62
+ gs.blocked.visitors('test.email@gmail.com')
63
+ expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }])
64
+ end
69
65
  end
@@ -3,69 +3,68 @@ require 'uri'
3
3
  require 'json'
4
4
 
5
5
  describe Gosquared::Client do
6
- subject(:client) { described_class.new }
6
+ subject(:client) { described_class.new }
7
7
 
8
- EXCEPTIONS = [Timeout::Error, EOFError,
9
- Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError]
8
+ EXCEPTIONS = [Timeout::Error, EOFError,
9
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError].freeze
10
10
 
11
- EXCEPTIONS.each do |exception|
12
- it "raises a #{exception} error on a get request" do
13
- uri = URI('www.example.com')
14
- allow(Net::HTTP).to receive(:get).with(uri).and_raise(exception)
15
- expect{client.get('www.example.com')}.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not parse JSON\n").to_stdout
16
- end
17
- end
18
-
19
- it "raises a Errno::EINVAL error on a get request" do
20
- uri = URI('www.example.com')
21
- allow(Net::HTTP).to receive(:get).with(uri).and_raise(Errno::EINVAL)
22
- expect{client.get('www.example.com')}.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not parse JSON\n").to_stdout
23
- end
11
+ EXCEPTIONS.each do |exception|
12
+ it "raises a #{exception} error on a get request" do
13
+ uri = URI('www.example.com')
14
+ allow(Net::HTTP).to receive(:get).with(uri).and_raise(exception)
15
+ expect { client.get('www.example.com') }.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not parse JSON\n").to_stdout
16
+ end
17
+ end
24
18
 
25
- it "raises a Errno::ECONNRESET error on a get request" do
26
- uri = URI('www.example.com')
27
- allow(Net::HTTP).to receive(:get).with(uri).and_raise(Errno::ECONNRESET)
28
- expect{client.get('www.example.com')}.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not parse JSON\n").to_stdout
29
- end
19
+ it 'raises a Errno::EINVAL error on a get request' do
20
+ uri = URI('www.example.com')
21
+ allow(Net::HTTP).to receive(:get).with(uri).and_raise(Errno::EINVAL)
22
+ expect { client.get('www.example.com') }.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not parse JSON\n").to_stdout
23
+ end
30
24
 
31
- EXCEPTIONS.each do |exception|
32
- it "raises a #{exception} error on a post request" do
33
- uri = URI.parse("www.example.com")
34
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(exception)
35
- expect{client.post("www.example.com", "body")}.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not print response message\n").to_stdout
36
- end
37
- end
25
+ it 'raises a Errno::ECONNRESET error on a get request' do
26
+ uri = URI('www.example.com')
27
+ allow(Net::HTTP).to receive(:get).with(uri).and_raise(Errno::ECONNRESET)
28
+ expect { client.get('www.example.com') }.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not parse JSON\n").to_stdout
29
+ end
38
30
 
39
- it "raises a Errno::EINVAL error on a post request" do
40
- uri = URI.parse("www.example.com")
41
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::EINVAL)
42
- expect{client.post("www.example.com", "body")}.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not print response message\n").to_stdout
43
- end
31
+ EXCEPTIONS.each do |exception|
32
+ it "raises a #{exception} error on a post request" do
33
+ uri = URI.parse('www.example.com')
34
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(exception)
35
+ expect { client.post('www.example.com', 'body') }.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not print response message\n").to_stdout
36
+ end
37
+ end
44
38
 
45
- it "raises a Errno::ECONNRESET error on a post request" do
46
- uri = URI.parse("www.example.com")
47
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::ECONNRESET)
48
- expect{client.post("www.example.com", "body")}.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not print response message\n").to_stdout
49
- end
39
+ it 'raises a Errno::EINVAL error on a post request' do
40
+ uri = URI.parse('www.example.com')
41
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::EINVAL)
42
+ expect { client.post('www.example.com', 'body') }.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not print response message\n").to_stdout
43
+ end
50
44
 
51
- EXCEPTIONS.each do |exception|
52
- it "raises a #{exception} error on a delete request" do
53
- uri = URI.parse("www.example.com")
54
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(exception)
55
- expect{client.delete("www.example.com", "body")}.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not print response message\n").to_stdout
56
- end
57
- end
45
+ it 'raises a Errno::ECONNRESET error on a post request' do
46
+ uri = URI.parse('www.example.com')
47
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::ECONNRESET)
48
+ expect { client.post('www.example.com', 'body') }.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not print response message\n").to_stdout
49
+ end
58
50
 
59
- it "raises a Errno::EINVAL error on a delete request" do
60
- uri = URI.parse("www.example.com")
61
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::EINVAL)
62
- expect{client.delete("www.example.com", "body")}.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not print response message\n").to_stdout
63
- end
51
+ EXCEPTIONS.each do |exception|
52
+ it "raises a #{exception} error on a delete request" do
53
+ uri = URI.parse('www.example.com')
54
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(exception)
55
+ expect { client.delete('www.example.com', 'body') }.to output("[error] HTTP error: #{exception}\n[error] StandardError: Could not print response message\n").to_stdout
56
+ end
57
+ end
64
58
 
65
- it "raises a Errno::ECONNRESET error on a delete request" do
66
- uri = URI.parse("www.example.com")
67
- allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::ECONNRESET)
68
- expect{client.delete("www.example.com", "body")}.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not print response message\n").to_stdout
69
- end
59
+ it 'raises a Errno::EINVAL error on a delete request' do
60
+ uri = URI.parse('www.example.com')
61
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::EINVAL)
62
+ expect { client.delete('www.example.com', 'body') }.to output("[error] HTTP error: Invalid argument\n[error] StandardError: Could not print response message\n").to_stdout
63
+ end
70
64
 
65
+ it 'raises a Errno::ECONNRESET error on a delete request' do
66
+ uri = URI.parse('www.example.com')
67
+ allow(Net::HTTP).to receive(:new).with(uri.host, uri.port).and_raise(Errno::ECONNRESET)
68
+ expect { client.delete('www.example.com', 'body') }.to output("[error] HTTP error: Connection reset by peer\n[error] StandardError: Could not print response message\n").to_stdout
69
+ end
71
70
  end
@@ -1,32 +1,31 @@
1
1
  describe Gosquared::Now do
2
- subject(:gs) { described_class.new("demo", "GSN-2194840-F") }
2
+ subject(:gs) { described_class.new('demo', 'GSN-2194840-F') }
3
3
 
4
- Gosquared::Now::DIMENSIONS.each do |dimension|
5
- before do
6
- data = '{"a": [{"test": "response"}]}'
7
- stub_request(:get, "https://api.gosquared.com/now/v3/#{dimension}?api_key=demo&site_token=GSN-2194840-F" ).
8
- with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
9
- to_return(status: 200, body: data, headers: {})
10
- end
11
- end
4
+ Gosquared::Now::DIMENSIONS.each do |dimension|
5
+ before do
6
+ data = '{"a": [{"test": "response"}]}'
7
+ stub_request(:get, "https://api.gosquared.com/now/v3/#{dimension}?api_key=demo&site_token=GSN-2194840-F")
8
+ .with(headers: { 'Accept' => '*/*', 'User-Agent' => 'Ruby' })
9
+ .to_return(status: 200, body: data, headers: {})
10
+ end
11
+ end
12
12
 
13
- Gosquared::Now::DIMENSIONS.each do |dimension|
14
- it "fetches a request from the GoSquared Now API with #{dimension} dimension" do
15
- gs.send "#{dimension}"
16
- expect(gs.fetch).to eq("a" => [{"test"=>"response"}])
17
- end
18
- end
13
+ Gosquared::Now::DIMENSIONS.each do |dimension|
14
+ it "fetches a request from the GoSquared Now 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
- before do
21
- data = '{"a": [{"test": "response"}, {"with": "params"}]}'
22
- stub_request(:get, "https://api.gosquared.com/now/v3/browsers?api_key=demo&site_token=GSN-2194840-F&limit=5").
23
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com', 'User-Agent'=>'Ruby'}).
24
- to_return(:status => 200, :body => data, :headers => {})
25
- end
26
-
27
- it "fetches a request from the GoSquared Now API with paramaters" do
28
- gs.browsers.limit('5')
29
- expect(gs.fetch).to eq("a" => [{"test"=>"response"}, {"with"=>"params"}])
30
- end
20
+ before do
21
+ data = '{"a": [{"test": "response"}, {"with": "params"}]}'
22
+ stub_request(:get, 'https://api.gosquared.com/now/v3/browsers?api_key=demo&site_token=GSN-2194840-F&limit=5')
23
+ .with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'api.gosquared.com', 'User-Agent' => 'Ruby' })
24
+ .to_return(status: 200, body: data, headers: {})
25
+ end
31
26
 
27
+ it 'fetches a request from the GoSquared Now API with paramaters' do
28
+ gs.browsers.limit('5')
29
+ expect(gs.fetch).to eq('a' => [{ 'test' => 'response' }, { 'with' => 'params' }])
30
+ end
32
31
  end