gosquared 3.0.5 → 3.0.6

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: 1ff55e13c13a2257f392ad1db2061ab1df6e5622
4
- data.tar.gz: 6eebd97fd56fd930e8a359d3fa891314dc85165d
3
+ metadata.gz: cf6aeda0866e2e3072ac4c3821b12c32b350e358
4
+ data.tar.gz: 2c536fa3596205200f292decfe44da65ee13a069
5
5
  SHA512:
6
- metadata.gz: 5e5ce765890f16d25ea8c7a626f29b4523724af4b50ac0411d5e62cff9efdc0cfefc312436b2a7850c4c0c47e8855706ce3eae9b7ee93d37d670b0a6c98eac19
7
- data.tar.gz: 1a569d045d27f60a3a0f2dda475dda8177911455315a1603bab71f33c2e21477787f5b858f1abaa8a9a3f3471934bdd46e8731509573e6ef5d1cc7e0a2341b09
6
+ metadata.gz: 90c64d33881ee8132c84c7272a3f1843b54be80317222769e8cb9623dec9984e7dc5e16db992ab8a77cfb90b50bc09fc2b6b4f570f4eb25e5ba4ac0461a1cdea
7
+ data.tar.gz: 6c71ea20b7604857953c34d8070c47a8a5e03834cb999cceaac2a9bc9293a65d0ba94d7f4d7acbe6619c204730a192197af027fdb856af8d10281dfbd9002e30
@@ -6,6 +6,8 @@ require_relative "gosquared/account"
6
6
 
7
7
  module Gosquared
8
8
 
9
+ VERSION = "3.0.6"
10
+
9
11
  class RubyLibrary
10
12
 
11
13
  def initialize api_key, site_id
@@ -27,8 +27,8 @@ module Gosquared
27
27
  begin
28
28
  https = Net::HTTP.new(uri.host, uri.port)
29
29
  https.use_ssl = true
30
- request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})
31
- request.body = "[ #{data.to_json} ]"
30
+ request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'ruby-client/'+ VERSION})
31
+ request.body = "[ #{data.to_json} ]"
32
32
  response = https.request(request)
33
33
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
34
34
  Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
@@ -71,7 +71,6 @@ module Gosquared
71
71
  end
72
72
 
73
73
  def post
74
- puts @data
75
74
  check_for_nil_user
76
75
  response = Client.new.post(url, @data)
77
76
  @data = nil if response.code === '200'
@@ -1,11 +1,13 @@
1
1
  describe Gosquared::Account do
2
2
  subject(:gs) { described_class.new("demo", "GSN-2194840-F") }
3
+ VERSION = "3.0.5"
4
+
3
5
 
4
6
  Gosquared::Account::DIMENSIONS.each do |dimension|
5
7
  before do
6
8
  data = '{"a": [{"test": "response"}]}'
7
9
  stub_request(:get, "https://api.gosquared.com/account/v1/#{dimension}?api_key=demo&site_token=GSN-2194840-F" ).
8
- with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
10
+ with(headers: {'Accept'=>'*/*'}).
9
11
  to_return(status: 200, body: data, headers: {})
10
12
  end
11
13
  end
@@ -20,7 +22,7 @@ describe Gosquared::Account do
20
22
  before do
21
23
  data = '{"a": [{"test": "response"}]}'
22
24
  stub_request(:get, "https://api.gosquared.com/account/v1/sites/GSN-086224-W?api_key=demo&site_token=GSN-2194840-F").
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'}).
25
+ with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'api.gosquared.com'}).
24
26
  to_return(:status => 200, :body => data, :headers => {})
25
27
  end
26
28
 
@@ -32,11 +34,11 @@ describe Gosquared::Account do
32
34
  before do
33
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").
34
36
  with(:body => "[ \"\" ]",
35
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
37
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json'}).
36
38
  to_return(:status => 200, :body => "", :headers => {})
37
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").
38
40
  with(:body => "[ \"\" ]",
39
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
41
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json'}).
40
42
  to_return(:status => 200, :body => "", :headers => {})
41
43
  end
42
44
 
@@ -1,11 +1,13 @@
1
1
  describe Gosquared::Tracking do
2
2
  subject(:gs) { described_class.new("demo", "GSN-2194840-F") }
3
3
 
4
+ VERSION = "3.0.6"
5
+
4
6
  Gosquared::Tracking::DIMENSIONS.each do |dimension|
5
7
  before do
6
8
  stub_request(:post, "https://api.gosquared.com/tracking/v1/#{dimension}?api_key=demo&site_token=GSN-2194840-F").
7
9
  with(:body => "[ {\"person_id\":\"email:test@example.com\",\"properties\":{\"email\":\"test@example.com\"}} ]",
8
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
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 }).
9
11
  to_return(:status => 200, :body => "", :headers => {response: "success"})
10
12
  end
11
13
  end
@@ -22,7 +24,7 @@ describe Gosquared::Tracking do
22
24
  before do
23
25
  stub_request(:post, "https://api.gosquared.com/tracking/v1/event?api_key=demo&site_token=GSN-2194840-F").
24
26
  with(:body => "[ {\"event\":{\"name\":\"event\"}} ]",
25
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
27
+ :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}).
26
28
  to_return(:status => 200, :body => "", :headers => {})
27
29
  @data = {person_id: nil, event: { name: 'event' } }
28
30
  end
@@ -35,7 +37,7 @@ describe Gosquared::Tracking do
35
37
  before do
36
38
  stub_request(:post, "https://api.gosquared.com/tracking/v1/event?api_key=demo&site_token=GSN-2194840-F").
37
39
  with(:body => "[ {\"person_id\":\"12345\",\"event\":{\"name\":\"event\"}} ]",
38
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
40
+ :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}).
39
41
  to_return(:status => 200, :body => "", :headers => {})
40
42
  @data = {person_id: '12345', event: { name: 'event' } }
41
43
  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.5
4
+ version: 3.0.6
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-07-20 00:00:00.000000000 Z
11
+ date: 2017-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec