similarweb 0.0.2 → 0.0.3
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/Gemfile.lock +5 -3
- data/README.md +2 -2
- data/Rakefile +5 -0
- data/lib/similarweb.rb +2 -1
- data/lib/similarweb/also_visited.rb +3 -4
- data/lib/similarweb/category.rb +3 -4
- data/lib/similarweb/category_rank.rb +3 -4
- data/lib/similarweb/client.rb +25 -8
- data/lib/similarweb/destinations.rb +3 -4
- data/lib/similarweb/engagement.rb +3 -4
- data/lib/similarweb/estimated_visits.rb +8 -5
- data/lib/similarweb/keywords.rb +3 -4
- data/lib/similarweb/referrals.rb +3 -4
- data/lib/similarweb/similar_sites.rb +3 -4
- data/lib/similarweb/social_referrals.rb +3 -4
- data/lib/similarweb/tags.rb +3 -4
- data/lib/similarweb/traffic.rb +3 -4
- data/lib/similarweb/version.rb +2 -2
- data/similarweb.gemspec +4 -3
- data/spec/similarweb/client_spec.rb +37 -34
- data/spec/spec_helper.rb +0 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57eac367099944002ab30a1fbe1beda535b63bb4
|
4
|
+
data.tar.gz: c62e69fec17045907f3ff97549f821c5a3e68fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d1fc71d851e9df88dc242517d0f6c24d2f2cac1cbffbbbe4bbe6c4e9277c1f0ca46e2a2d568e38002d3bbae5b1aa2b12e07a0d5c8c527a9f7cc54abd799443
|
7
|
+
data.tar.gz: f8a68c74107ac49a168413063e5de12b6ac7deb7c3dbb26de2a4f18d82b4fce6f7d6f818d0a461bc3c04a0c4258b990b3b1dec2b19289d260c11aa47ce2d2256
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
similarweb (0.0.
|
4
|
+
similarweb (0.0.3)
|
5
5
|
faraday
|
6
6
|
|
7
7
|
GEM
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
crack (0.4.2)
|
13
13
|
safe_yaml (~> 1.0.0)
|
14
14
|
diff-lcs (1.2.5)
|
15
|
-
faraday (0.9.
|
15
|
+
faraday (0.9.2)
|
16
16
|
multipart-post (>= 1.2, < 3)
|
17
17
|
method_source (0.8.2)
|
18
18
|
multipart-post (2.0.0)
|
@@ -29,8 +29,9 @@ GEM
|
|
29
29
|
rspec-expectations (2.14.5)
|
30
30
|
diff-lcs (>= 1.1.3, < 2.0)
|
31
31
|
rspec-mocks (2.14.6)
|
32
|
-
safe_yaml (1.0.
|
32
|
+
safe_yaml (1.0.4)
|
33
33
|
slop (3.5.0)
|
34
|
+
vcr (3.0.0)
|
34
35
|
webmock (1.17.4)
|
35
36
|
addressable (>= 2.2.7)
|
36
37
|
crack (>= 0.3.2)
|
@@ -44,4 +45,5 @@ DEPENDENCIES
|
|
44
45
|
rake
|
45
46
|
rspec
|
46
47
|
similarweb!
|
48
|
+
vcr
|
47
49
|
webmock
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# SimilarWeb
|
2
2
|
|
3
3
|
Ruby client for [SimilarWeb API](https://developer.similarweb.com/)
|
4
4
|
|
@@ -135,7 +135,7 @@ traffic = client.traffic('disney.com')
|
|
135
135
|
|
136
136
|
## Contributing
|
137
137
|
|
138
|
-
1. Fork it ( http://github.com
|
138
|
+
1. Fork it ( http://github.com/johnmcl/similarweb/fork )
|
139
139
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
140
140
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
141
141
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
data/lib/similarweb.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module AlsoVisited
|
3
3
|
def also_visited(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v2/alsovisited")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
data/lib/similarweb/category.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module CategoryRank
|
3
3
|
def category_rank(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v2/CategoryRank")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
data/lib/similarweb/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
class Client
|
3
3
|
include AlsoVisited
|
4
4
|
include EstimatedVisits
|
@@ -12,20 +12,37 @@ module Similarweb
|
|
12
12
|
include Referrals
|
13
13
|
include Tags
|
14
14
|
include Traffic
|
15
|
-
|
15
|
+
|
16
|
+
attr_reader :http_client
|
17
|
+
|
18
|
+
attr_accessor :api_key
|
16
19
|
|
17
20
|
def initialize(args = {})
|
18
21
|
args.each do |key, value|
|
19
22
|
send(:"#{key}=", value)
|
20
23
|
end
|
21
|
-
|
24
|
+
@http_client = Faraday.new(:url => base_url)
|
25
|
+
end
|
26
|
+
|
27
|
+
def base_url
|
28
|
+
@base_url ||= "https://api.similarweb.com/Site/"
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
def request(uri, params = {}, http_method = :get)
|
34
|
+
url = "#{uri}?Format=JSON&UserKey=#{api_key}&#{to_query(params)}"
|
35
|
+
parse_response(http_client.public_send(http_method, url))
|
36
|
+
end
|
37
|
+
|
38
|
+
def parse_response(response)
|
39
|
+
JSON(response.body)
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_query(params)
|
43
|
+
params.map { |key, value| "#{key}=#{value}" }.join("&")
|
22
44
|
end
|
23
45
|
|
24
|
-
private
|
25
46
|
|
26
|
-
def make_http_client!
|
27
|
-
base_url = "http://api.similarweb.com/Site/"
|
28
|
-
self.http_client = Faraday.new(:url => base_url)
|
29
|
-
end
|
30
47
|
end
|
31
48
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module Destinations
|
3
3
|
def destinations(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v2/leadingdestinationsites")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module Engagement
|
3
3
|
def engagement(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v1/engagement")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
@@ -1,8 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module EstimatedVisits
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
# API reference: https://developer.similarweb.com/estimated_visits_api
|
4
|
+
def estimated_visits(domain, params = {})
|
5
|
+
params[:start] ||= Date.today.prev_month.prev_month(3).strftime("%m-%Y")
|
6
|
+
params[:end] ||= Date.today.prev_month(2).strftime("%m-%Y")
|
7
|
+
|
8
|
+
request("#{domain}/v1/visits", params)
|
6
9
|
end
|
7
10
|
end
|
8
|
-
end
|
11
|
+
end
|
data/lib/similarweb/keywords.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module Keywords
|
3
3
|
def keywords(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v1/searchintelligence")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
data/lib/similarweb/referrals.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module Referrals
|
3
3
|
def referrals(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v2/leadingreferringsites")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module SimilarSites
|
3
3
|
def similar_sites(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v2/similarsites")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module SimilarWeb
|
2
2
|
module SocialReferrals
|
3
3
|
def social_referrals(domain)
|
4
|
-
|
5
|
-
JSON(response.body)
|
4
|
+
request("#{domain}/v1/socialreferringsites")
|
6
5
|
end
|
7
6
|
end
|
8
|
-
end
|
7
|
+
end
|
data/lib/similarweb/tags.rb
CHANGED
data/lib/similarweb/traffic.rb
CHANGED
data/lib/similarweb/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module SimilarWeb
|
2
|
+
VERSION = "0.0.3"
|
3
3
|
end
|
data/similarweb.gemspec
CHANGED
@@ -5,11 +5,11 @@ require 'similarweb/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "similarweb"
|
8
|
-
spec.version =
|
8
|
+
spec.version = SimilarWeb::VERSION
|
9
9
|
spec.authors = ["John McLaughlin", "Steven Lai"]
|
10
10
|
spec.email = ["j@yar.com", "mailto:lai.steven@gmail.com"]
|
11
|
-
spec.summary = %q{Ruby wrapper for
|
12
|
-
spec.description = %q{Ruby wrapper for
|
11
|
+
spec.summary = %q{Ruby wrapper for SimilarWeb API}
|
12
|
+
spec.description = %q{Ruby wrapper for SimilarWeb API}
|
13
13
|
spec.homepage = "http://github.com/johnmcl/similarweb"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "pry"
|
25
25
|
spec.add_development_dependency "webmock"
|
26
|
+
spec.add_development_dependency "vcr"
|
26
27
|
|
27
28
|
spec.add_runtime_dependency "faraday"
|
28
29
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe SimilarWeb::Client do
|
4
4
|
before do
|
5
|
-
@client =
|
5
|
+
@client = SimilarWeb::Client.new(api_key: 'test-key')
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '.api_key' do
|
@@ -32,8 +32,8 @@ describe Similarweb::Client do
|
|
32
32
|
}
|
33
33
|
eos
|
34
34
|
|
35
|
-
stub_request(:get, "
|
36
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
35
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v2/leadingreferringsites?Format=JSON&UserKey=test-key").
|
36
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
37
37
|
to_return(:status => 200, :body => body, :headers => {})
|
38
38
|
|
39
39
|
@referrals = @client.referrals('example.com')
|
@@ -80,8 +80,8 @@ describe Similarweb::Client do
|
|
80
80
|
}
|
81
81
|
eos
|
82
82
|
|
83
|
-
stub_request(:get, "
|
84
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
83
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v1/searchintelligence?Format=JSON&UserKey=test-key").
|
84
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
85
85
|
to_return(:status => 200, :body => body, :headers => {})
|
86
86
|
|
87
87
|
@keywords = @client.keywords('example.com')
|
@@ -110,19 +110,22 @@ describe Similarweb::Client do
|
|
110
110
|
before(:each) do
|
111
111
|
body = <<-eos
|
112
112
|
{
|
113
|
-
"
|
113
|
+
"Visits": 81178601
|
114
114
|
}
|
115
115
|
eos
|
116
116
|
|
117
|
-
|
118
|
-
|
117
|
+
prev_date = Date.today.prev_month.prev_month(3).strftime("%m-%Y")
|
118
|
+
curr_date = Date.today.prev_month(2).strftime("%m-%Y")
|
119
|
+
|
120
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v1/visits?Format=JSON&UserKey=test-key&start=#{prev_date}&end=#{curr_date}").
|
121
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
119
122
|
to_return(:status => 200, :body => body, :headers => {})
|
120
123
|
|
121
124
|
@estimated_visitors = @client.estimated_visits('example.com')
|
122
125
|
end
|
123
126
|
|
124
|
-
it 'should have
|
125
|
-
expect( @estimated_visitors ).to have_key('
|
127
|
+
it 'should have visits' do
|
128
|
+
expect( @estimated_visitors ).to have_key('Visits')
|
126
129
|
end
|
127
130
|
end
|
128
131
|
|
@@ -137,8 +140,8 @@ describe Similarweb::Client do
|
|
137
140
|
}
|
138
141
|
eos
|
139
142
|
|
140
|
-
stub_request(:get, "
|
141
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
143
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v1/engagement?Format=JSON&UserKey=test-key").
|
144
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
142
145
|
to_return(:status => 200, :body => body, :headers => {})
|
143
146
|
|
144
147
|
@engagement = @client.engagement('example.com')
|
@@ -174,8 +177,8 @@ describe Similarweb::Client do
|
|
174
177
|
}
|
175
178
|
eos
|
176
179
|
|
177
|
-
stub_request(:get, "
|
178
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
180
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v2/leadingdestinationsites?Format=JSON&UserKey=test-key").
|
181
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
179
182
|
to_return(:status => 200, :body => body, :headers => {})
|
180
183
|
|
181
184
|
@destinations = @client.destinations('example.com')
|
@@ -194,8 +197,8 @@ describe Similarweb::Client do
|
|
194
197
|
}
|
195
198
|
eos
|
196
199
|
|
197
|
-
stub_request(:get, "
|
198
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
200
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v2/category?Format=JSON&UserKey=test-key").
|
201
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
199
202
|
to_return(:status => 200, :body => body, :headers => {})
|
200
203
|
|
201
204
|
@category = @client.category('example.com')
|
@@ -215,8 +218,8 @@ describe Similarweb::Client do
|
|
215
218
|
}
|
216
219
|
eos
|
217
220
|
|
218
|
-
stub_request(:get, "
|
219
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
221
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v2/CategoryRank?Format=JSON&UserKey=test-key").
|
222
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
220
223
|
to_return(:status => 200, :body => body, :headers => {})
|
221
224
|
|
222
225
|
@category_rank = @client.category_rank('example.com')
|
@@ -244,8 +247,8 @@ describe Similarweb::Client do
|
|
244
247
|
}
|
245
248
|
eos
|
246
249
|
|
247
|
-
stub_request(:get, "
|
248
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
250
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v2/alsovisited?Format=JSON&UserKey=test-key").
|
251
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
249
252
|
to_return(:status => 200, :body => body, :headers => {})
|
250
253
|
|
251
254
|
@also_visited_metrics = @client.also_visited('example.com')
|
@@ -281,8 +284,8 @@ describe Similarweb::Client do
|
|
281
284
|
}
|
282
285
|
eos
|
283
286
|
|
284
|
-
stub_request(:get, "
|
285
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
287
|
+
stub_request(:get, "https://api.similarweb.com/Site/example.com/v1/traffic?Format=JSON&UserKey=test-key").
|
288
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
286
289
|
to_return(:status => 200, :body => body, :headers => {})
|
287
290
|
|
288
291
|
@traffic_metrics = @client.traffic('example.com')
|
@@ -330,8 +333,8 @@ describe Similarweb::Client do
|
|
330
333
|
}
|
331
334
|
eos
|
332
335
|
|
333
|
-
stub_request(:get, "
|
334
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
336
|
+
stub_request(:get, "https://api.similarweb.com/Site/disney.com/v2/similarsites?Format=JSON&UserKey=test-key").
|
337
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
335
338
|
to_return(:status => 200, :body => body, :headers => {})
|
336
339
|
|
337
340
|
@similar_sites = @client.similar_sites('disney.com')
|
@@ -362,16 +365,16 @@ describe Similarweb::Client do
|
|
362
365
|
"Source": "Youtube",
|
363
366
|
"Value": 0.699753626365037
|
364
367
|
},
|
365
|
-
{
|
366
|
-
"Source": "Reddit",
|
368
|
+
{
|
369
|
+
"Source": "Reddit",
|
367
370
|
"Value": 0.06447515408116457
|
368
371
|
}
|
369
372
|
]
|
370
373
|
}
|
371
374
|
eos
|
372
375
|
|
373
|
-
stub_request(:get, "
|
374
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
376
|
+
stub_request(:get, "https://api.similarweb.com/Site/disney.com/v1/socialreferringsites?Format=JSON&UserKey=test-key").
|
377
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
375
378
|
to_return(:status => 200, :body => body, :headers => {})
|
376
379
|
|
377
380
|
@social_referrals = @client.social_referrals('disney.com')
|
@@ -391,7 +394,7 @@ describe Similarweb::Client do
|
|
391
394
|
end
|
392
395
|
end
|
393
396
|
end
|
394
|
-
|
397
|
+
|
395
398
|
describe '.tags' do
|
396
399
|
before(:each) do
|
397
400
|
body = <<-eos
|
@@ -400,17 +403,17 @@ describe Similarweb::Client do
|
|
400
403
|
{
|
401
404
|
"Name": "disney",
|
402
405
|
"Score": 0.4535382529673987
|
403
|
-
},
|
406
|
+
},
|
404
407
|
{
|
405
|
-
"Name": "kids",
|
408
|
+
"Name": "kids",
|
406
409
|
"Score": 0.16695504510907133
|
407
410
|
}
|
408
411
|
]
|
409
412
|
}
|
410
413
|
eos
|
411
414
|
|
412
|
-
stub_request(:get, "
|
413
|
-
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.
|
415
|
+
stub_request(:get, "https://api.similarweb.com/Site/disney.com/v2/tags?Format=JSON&UserKey=test-key").
|
416
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
|
414
417
|
to_return(:status => 200, :body => body, :headers => {})
|
415
418
|
|
416
419
|
@website_tags = @client.tags('disney.com')
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: similarweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John McLaughlin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -81,6 +81,20 @@ dependencies:
|
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: vcr
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: faraday
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +109,7 @@ dependencies:
|
|
95
109
|
- - ">="
|
96
110
|
- !ruby/object:Gem::Version
|
97
111
|
version: '0'
|
98
|
-
description: Ruby wrapper for
|
112
|
+
description: Ruby wrapper for SimilarWeb API
|
99
113
|
email:
|
100
114
|
- j@yar.com
|
101
115
|
- mailto:lai.steven@gmail.com
|
@@ -147,10 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
161
|
version: '0'
|
148
162
|
requirements: []
|
149
163
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
164
|
+
rubygems_version: 2.4.6
|
151
165
|
signing_key:
|
152
166
|
specification_version: 4
|
153
|
-
summary: Ruby wrapper for
|
167
|
+
summary: Ruby wrapper for SimilarWeb API
|
154
168
|
test_files:
|
155
169
|
- spec/similarweb/client_spec.rb
|
156
170
|
- spec/spec_helper.rb
|