shb 0.0.4 → 0.1.0
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/lib/shb/abstract_client.rb +2 -1
- data/lib/shb/version.rb +1 -1
- data/spec/shb_spec.rb +1 -1
- data/spec/{cycle_user_agent_spec.rb → user_agent_spec.rb} +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e22bf77190d55794bb77de6071dfe0d5746da65
|
|
4
|
+
data.tar.gz: c0e62b975a01dd0d5d2676c65b0a0ef34b0f84db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cacc210a5d3885cf5cf89b03d2bbd9266d2209ff5caa3b4211991ef835963530dfdac1b450df1f191dab216d489f0f1e4204a8895b82d44c9acb16d7fd352cb
|
|
7
|
+
data.tar.gz: 9709f91953f93ba30b87eb5e3cd6bcd71d8b4d05b94b8392f3fb9c7b5bd586561b24daddd96602f217a66bee9b24230163ee7afbab78de6ae89e35b813620807
|
data/lib/shb/abstract_client.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Shb
|
|
|
4
4
|
include ActiveSupport::Configurable
|
|
5
5
|
include HTTParty
|
|
6
6
|
|
|
7
|
+
USER_AGENT = "Shb/#{VERSION}"
|
|
7
8
|
AGENT_ALIASES = [
|
|
8
9
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.71 (KHTML, like Gecko) Version/6.1 Safari/537.71', # Safari on OSX Lion
|
|
9
10
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71', # Safari on OSX Mavericks
|
|
@@ -24,7 +25,7 @@ module Shb
|
|
|
24
25
|
|
|
25
26
|
parser ::Shb::Parser
|
|
26
27
|
follow_redirects false
|
|
27
|
-
headers 'User-Agent' =>
|
|
28
|
+
headers 'User-Agent' => USER_AGENT
|
|
28
29
|
|
|
29
30
|
def initialize(base_uri: 'http://supremegolf.com')
|
|
30
31
|
self.class.base_uri base_uri
|
data/lib/shb/version.rb
CHANGED
data/spec/shb_spec.rb
CHANGED
|
@@ -8,7 +8,7 @@ describe Shb::Client do
|
|
|
8
8
|
specify { expect(Shb::Client.new.config.use_cookies).to be_falsey }
|
|
9
9
|
specify { expect(Shb::Client.new.class.default_options[:parser]).to eq Shb::Parser }
|
|
10
10
|
specify { expect(Shb::Client.new.class.default_options[:follow_redirects]).to be_falsey }
|
|
11
|
-
specify { expect(Shb::Client.new.class.default_options[:headers]['User-Agent']).to eq Shb::AbstractClient::
|
|
11
|
+
specify { expect(Shb::Client.new.class.default_options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
context "simple requests" do
|
|
@@ -7,9 +7,9 @@ describe Shb::Client do
|
|
|
7
7
|
shb = Shb::Client.new
|
|
8
8
|
shb.config.cycle_user_agent = false
|
|
9
9
|
|
|
10
|
-
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::
|
|
11
|
-
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::
|
|
12
|
-
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::
|
|
10
|
+
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT
|
|
11
|
+
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT
|
|
12
|
+
expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "cycles the user agent" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Hallstrom
|
|
@@ -129,13 +129,13 @@ files:
|
|
|
129
129
|
- lib/shb/version.rb
|
|
130
130
|
- shb.gemspec
|
|
131
131
|
- spec/cache_spec.rb
|
|
132
|
-
- spec/cycle_user_agent_spec.rb
|
|
133
132
|
- spec/debug_spec.rb
|
|
134
133
|
- spec/html_spec.rb
|
|
135
134
|
- spec/json_spec.rb
|
|
136
135
|
- spec/logger_spec.rb
|
|
137
136
|
- spec/shb_spec.rb
|
|
138
137
|
- spec/spec_helper.rb
|
|
138
|
+
- spec/user_agent_spec.rb
|
|
139
139
|
- spec/user_cookies_spec.rb
|
|
140
140
|
- spec/xml_spec.rb
|
|
141
141
|
homepage: https://github.com/supremegolf/shb
|
|
@@ -164,12 +164,12 @@ specification_version: 4
|
|
|
164
164
|
summary: ''
|
|
165
165
|
test_files:
|
|
166
166
|
- spec/cache_spec.rb
|
|
167
|
-
- spec/cycle_user_agent_spec.rb
|
|
168
167
|
- spec/debug_spec.rb
|
|
169
168
|
- spec/html_spec.rb
|
|
170
169
|
- spec/json_spec.rb
|
|
171
170
|
- spec/logger_spec.rb
|
|
172
171
|
- spec/shb_spec.rb
|
|
173
172
|
- spec/spec_helper.rb
|
|
173
|
+
- spec/user_agent_spec.rb
|
|
174
174
|
- spec/user_cookies_spec.rb
|
|
175
175
|
- spec/xml_spec.rb
|