tweakphoeus 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29477b8f68a5920b4dfccb0bb6e3ac8cfcbc1598d5cf21707b128f11ee930538
4
- data.tar.gz: fd0d5b8abf410c60ae8ca4938ac5fd85ec7165a4a0f40759635e6ac92c9db9d5
3
+ metadata.gz: 171c63200a3392f58a6ea35dc29ada88ed5cf17e62fb4b4ef1b4c7e98624bfd3
4
+ data.tar.gz: 7506da9725d2e9da7974de2c6e7a442a3f020b2dee44d07938d706a740ec67a0
5
5
  SHA512:
6
- metadata.gz: '0183ff90c46f024adc48de310cab5e076fe6a71b1334561f0c807c0f6afc3f946c76a096d3574db994eb1df5fa905c3be1be3cd5329c49436fa62095f5b7bd97'
7
- data.tar.gz: 685b76dc8f0da6177761f9a264e63072282865f41f526bb9b7778252991af424743f65510fd798e2c7831c5e6620e3b5d4dc12d05be43d9e16ecc511218fdf9a
6
+ metadata.gz: ce347b9def0b777b1fe73ae6f57ee99f493ea3059f90a764076109cb81f681d748cc73d7f08e9de5bde2ae0623d78cd5d1e47864eba469e597d7b8a1c884a9bd
7
+ data.tar.gz: deaee66b33576d2cdbe66f0bf3a2c65c86db5ea016806a10ae460344d05db5652c262bf1064b9727d2cc1e323970bde5935594f7db6aa8a385b5786f45ef4145
@@ -5,15 +5,18 @@ on: [pull_request]
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [ '2.6', '2.7', '3.0' ]
8
11
  steps:
9
- - uses: actions/checkout@v2
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 2.7.4
14
- bundler-cache: true
15
- - name: Run the default task
16
- run: bundle exec rake
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Ruby ${{ matrix.ruby }}
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ bundler-cache: true
18
+ - name: Run the default task
19
+ run: bundle exec rake
17
20
  services:
18
21
  whoami:
19
22
  image: containous/whoami
data/CHANGELOG.md CHANGED
@@ -40,3 +40,16 @@ Upgrading Typhoeus dependency to 1.4.0
40
40
  - ssl_verifypeer and redirect parameters removed from HTTP verb methods
41
41
  - cookie_jar is not longer an Hash, it has been extracted to Tweakphoeus::CookieJar class
42
42
  - refeer_list is not longer an Array, it has been extracted to Tweakphoeus::RefererList class
43
+
44
+ -- v0.6.1 - Fixing issues with the modification of a frozen string
45
+ - Adds missing requires in the mail `.rb` file
46
+ - Solves an issue with a modification on a frozen string
47
+ > /Users/davidmartingarcia/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/tweakphoeus-0.6.0/lib/tweakphoeus/user_agent.rb:17:in `gsub!': can't modify frozen String: "Mozilla/5.0 (X11; gNewSense; Linux x86) Gecko/20100101 Firefox/84.0" (FrozenError)
48
+
49
+ -- v0.6.2 - Fixing issues with RefererList calls
50
+ - Solves an issue with `RefererList` module calls
51
+ > /Users/davidmartingarcia/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/tweakphoeus-0.6.1/lib/tweakphoeus.rb:36:in `post': undefined method `referer_from_headers' for #<Tweakphoeus::Client:0x00007fec6b13dcd8> (NoMethodError)
52
+
53
+ -- v0.6.3 - Fixing issues with CookieJar module calls on Tweakphoeus::Client module
54
+ - Solves an issue with a missing CookieJar variable in the module calls
55
+ > /Users/davidmartingarcia/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/tweakphoeus-0.6.2/lib/tweakphoeus.rb:68:in `build_request_headers': undefined local variable or method `url' for #<Tweakphoeus::Client:0x00007ffa882acb48> (NameError)
@@ -14,8 +14,7 @@ module Tweakphoeus
14
14
  def random(systems: OS_DATA[:types])
15
15
  user_agent = "Mozilla/5.0 (#{os[systems.sample]}) #{browser}"
16
16
  firefox_version = user_agent.match(%r{Firefox/([0-9.]+)})
17
- user_agent.gsub!(')', "; rv:#{firefox_version[1]})") if firefox_version.is_a?(MatchData)
18
- user_agent
17
+ user_agent.gsub(')', "; rv:#{firefox_version[1]})") if firefox_version.is_a?(MatchData)
19
18
  end
20
19
 
21
20
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tweakphoeus
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.3'
5
5
  end
data/lib/tweakphoeus.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'tweakphoeus/version'
4
4
  require 'tweakphoeus/user_agent'
5
+ require 'tweakphoeus/cookie_jar'
6
+ require 'tweakphoeus/referer_list'
5
7
  require 'typhoeus'
6
8
 
7
9
  module Tweakphoeus
@@ -21,17 +23,17 @@ module Tweakphoeus
21
23
  end
22
24
 
23
25
  def get(url, body: nil, params: nil, headers: nil)
24
- referer_from_headers(headers)
26
+ referer_list.referer_from_headers(headers)
25
27
  http_request(url, body: body, params: params, headers: headers, method: :get)
26
28
  end
27
29
 
28
30
  def delete(url, body: nil, headers: nil)
29
- referer_from_headers(headers)
31
+ referer_list.referer_from_headers(headers)
30
32
  http_request(url, body: body, headers: headers, method: :delete)
31
33
  end
32
34
 
33
35
  def post(url, body: nil, headers: nil)
34
- referer_from_headers(headers)
36
+ referer_list.referer_from_headers(headers)
35
37
  http_request(url, body: body, headers: headers, method: :post)
36
38
  end
37
39
 
@@ -50,7 +52,7 @@ module Tweakphoeus
50
52
  private
51
53
 
52
54
  def http_request(url, body: nil, params: nil, headers: nil, method: :get)
53
- response = Typhoeus.send(method, url, body: body, params: params, headers: build_request_headers(headers),
55
+ response = Typhoeus.send(method, url, body: body, params: params, headers: build_request_headers(headers, url),
54
56
  proxy: @proxy, proxyuserpwd: @proxyuserpwd, ssl_verifypeer: ssl_verifypeer)
55
57
 
56
58
  @cookie_jar.obtain_cookies(response)
@@ -61,7 +63,7 @@ module Tweakphoeus
61
63
  response
62
64
  end
63
65
 
64
- def build_request_headers(headers)
66
+ def build_request_headers(headers, url)
65
67
  request_headers = merge_default_headers(headers)
66
68
  request_headers['Cookie'] = @cookie_jar.cookie_string(url, headers)
67
69
  request_headers['Referer'] = @referer_list.last_referer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweakphoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Martin Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus