phearb 1.1.1 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 138e7b210c9e312f6d8817ec4e25508467ac40dc
4
- data.tar.gz: 9623993163a3450d2f34943f67953a9215c7441a
3
+ metadata.gz: e6adff9a92ac0eb615547a830cb5ab9bbdce1e5a
4
+ data.tar.gz: 64cadfb796d6563ab53951922a6702cc02935062
5
5
  SHA512:
6
- metadata.gz: 09a9089b29461561e2d9273b09bd47c5a3a0d75d30c9a1a40a260a4e0b31d1c32fab59584711c2bd9a6c599e07d37f038cef1429e3677c80e063b7407920d5b2
7
- data.tar.gz: 9d40a8faaf34fb6211154403725185f4dc516a7bda4d88d3101c0a966a49fbd9c9edc78fc0bda276ca9fe170536aa57518e46152c4c1f0407df5947404fe18e5
6
+ metadata.gz: fbfad0576f12f35634e5b9d2ec1a91d58c50804de8e0bd042ff6db2cb705ea8ffafd312260fd1702049273bfacef371b3b88cd99a243d6d82816aacb4a2120ce
7
+ data.tar.gz: d5689416d988e531689d84de338ff025c02feaa3910c31fc192b0793f50c1acde3f51df9eaac075ced46f90782b0cd5e0164717a6d6850786455be085cc73a4f
data/README.md CHANGED
@@ -59,6 +59,13 @@ Simply calling `Phearb.fetch(<url>)` will do the job. It returns an `Phearb::Res
59
59
 
60
60
  Then if you need access to the `final_url` you can call `response.final_url`.
61
61
 
62
+ ### Passing options
63
+ As phear support optional parameters, so does the gem. The `fetch` method call supports passing an second parameter with a hash of options. For a list of available options see [phear's README](https://github.com/Tomtomgo/phearjs#usage) since the names are consistent.
64
+
65
+ ```ruby
66
+ Phearb.fetch('http://www.google.com', force: true, parse_delay: 500)
67
+ ```
68
+
62
69
  ## Development
63
70
 
64
71
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/lib/phearb.rb CHANGED
@@ -14,8 +14,8 @@ module Phearb
14
14
  yield(configuration)
15
15
  end
16
16
 
17
- def fetch(url)
18
- Agent.new(url).fetch
17
+ def fetch(url, options = {})
18
+ Agent.new(url).fetch(options)
19
19
  end
20
20
  end
21
21
  end
data/lib/phearb/agent.rb CHANGED
@@ -9,9 +9,11 @@ module Phearb
9
9
  @url = url
10
10
  end
11
11
 
12
- def fetch
12
+ def fetch(options = {})
13
+ params = options.merge(fetch_url: @url)
14
+
13
15
  Timeout::timeout(Phearb.configuration.timeout.to_f) do
14
- http_response = RestClient.get(server_url, params: { fetch_url: @url })
16
+ http_response = RestClient.get(server_url, params: params)
15
17
  Response.from_json(http_response)
16
18
  end
17
19
  rescue Timeout::Error => exception
@@ -1,3 +1,3 @@
1
1
  module Phearb
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phearb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joaquín Moreira