shb 0.0.4 → 0.1.0

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: b24b2293efb51a6d6bf1b42dfc1cac0350e7d442
4
- data.tar.gz: d57822f8141f5435ec505fa7c4117525c313b211
3
+ metadata.gz: 9e22bf77190d55794bb77de6071dfe0d5746da65
4
+ data.tar.gz: c0e62b975a01dd0d5d2676c65b0a0ef34b0f84db
5
5
  SHA512:
6
- metadata.gz: 7d0e7991dbc05e3ca7df6855f18e5c7e9175db0529972b1a3d4368ff4256bd7ec7ee7db32b921a86c562fcf8a05eb6724e909e5dd97044b928c746ded0018c6e
7
- data.tar.gz: 3b73cb75413c14cbcf3db4db95259124983209d4c17ae47d3d783616436d21ce207357cff946187aeaba0683a20e8d57d690204880e0af43656b7b1f449a73c7
6
+ metadata.gz: 7cacc210a5d3885cf5cf89b03d2bbd9266d2209ff5caa3b4211991ef835963530dfdac1b450df1f191dab216d489f0f1e4204a8895b82d44c9acb16d7fd352cb
7
+ data.tar.gz: 9709f91953f93ba30b87eb5e3cd6bcd71d8b4d05b94b8392f3fb9c7b5bd586561b24daddd96602f217a66bee9b24230163ee7afbab78de6ae89e35b813620807
@@ -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' => AGENT_ALIASES.first
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
@@ -1,3 +1,3 @@
1
1
  module Shb
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
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::AGENT_ALIASES.first }
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::AGENT_ALIASES[0]
11
- expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
12
- expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
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
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