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 +4 -4
- data/README.md +7 -0
- data/lib/phearb.rb +2 -2
- data/lib/phearb/agent.rb +4 -2
- data/lib/phearb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6adff9a92ac0eb615547a830cb5ab9bbdce1e5a
|
4
|
+
data.tar.gz: 64cadfb796d6563ab53951922a6702cc02935062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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:
|
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
|
data/lib/phearb/version.rb
CHANGED