bogeyman 0.0.1 → 0.0.2
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 +67 -0
- data/lib/bogeyman/client.rb +18 -4
- data/lib/bogeyman/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 625872cca43376ec239d79f030d6c15413ca6202
|
4
|
+
data.tar.gz: b3442d45b21396e1cf0c14961a312569cbaff28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c211c9503823b24d6dc10c153f191d2f5a7692749c696d680ab5ba2e081c00f6893f5b7b854f0625b3305fe472784c883ad6abc9a39700c5b3e6b1fbdaa12af
|
7
|
+
data.tar.gz: 80df69a7256b3434d08dd92017ea71d8af0642a65a11f3f9342a41c740c14fc2ab9266c53404bb623f06ef73e486c2a17498c969ba79c16a175e390d7eb4591d
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Bogeyman Ruby Client
|
2
|
+
|
3
|
+
Bogeyman is Ruby client for
|
4
|
+
[Bogeyman.js](https://github.com/reneklacan/bogeyman.js)
|
5
|
+
which is server application providing headless **crawling
|
6
|
+
of heavy javascript web sites** via REST API.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
You can install it via gem
|
11
|
+
|
12
|
+
```bash
|
13
|
+
gem install bogeyman
|
14
|
+
```
|
15
|
+
|
16
|
+
Or you can put it in your Gemfile
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'bogeyman', '~> 0.0.2'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
At first make sure that your server is installed and running
|
25
|
+
|
26
|
+
```bash
|
27
|
+
npm install -g bogeyman # install it
|
28
|
+
bogeyman # start it
|
29
|
+
```
|
30
|
+
|
31
|
+
For more information about server follow [this
|
32
|
+
link](https://github.com/reneklacan/bogeyman.js)
|
33
|
+
|
34
|
+
So when your server is set up then you can do
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require 'bogeyman'
|
38
|
+
|
39
|
+
client = Bogeyman::Client.new
|
40
|
+
client.post 'http://example.com', param1: 'abc'
|
41
|
+
client.get 'http://example.com'
|
42
|
+
```
|
43
|
+
|
44
|
+
Or if you require advanced options
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
client = Bogeyman::Client.new(
|
48
|
+
host: 'bogeyman.com', # default: 'localhost'
|
49
|
+
port: 12345, # default: 12345
|
50
|
+
proxy: '127.0.0.1:41414', # default: nil
|
51
|
+
proxy_type: 'socks5', # default: 'http'
|
52
|
+
proxy_auth: 'user:passwd', # default: nil
|
53
|
+
disk_cache: true, # default: false
|
54
|
+
max_disk_cache_size: '1024', # default: nil
|
55
|
+
ssl_protocol: 'any', # default: 'sslv3'
|
56
|
+
ssl_certificates-path: '...', # default: system default
|
57
|
+
web_security: true, # default: false
|
58
|
+
)
|
59
|
+
```
|
60
|
+
|
61
|
+
For more information you can take a look at
|
62
|
+
[Bogeyman.js](https://github.com/reneklacan/bogeyman.js) or [PhantomJS
|
63
|
+
API Reference](https://github.com/ariya/phantomjs/wiki/API-Reference).
|
64
|
+
|
65
|
+
## License
|
66
|
+
|
67
|
+
This library is distributed under the Beerware license.
|
data/lib/bogeyman/client.rb
CHANGED
@@ -3,13 +3,27 @@
|
|
3
3
|
module Bogeyman
|
4
4
|
class Client
|
5
5
|
def initialize params={}
|
6
|
+
host = params.delete(:host) || 'localhost'
|
7
|
+
port = params.delete(:port) || 31313
|
8
|
+
|
9
|
+
@server = "http://#{host}:#{port}"
|
6
10
|
@params = params
|
7
|
-
@server = 'http://localhost:31313'
|
8
11
|
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
[:get, :post, :patch, :delete].each do |method|
|
14
|
+
define_method method do |url, data={}|
|
15
|
+
request(method, url, data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def request method, url, data
|
22
|
+
params = {
|
23
|
+
method: method,
|
24
|
+
url: url,
|
25
|
+
params: @params,
|
26
|
+
}
|
13
27
|
|
14
28
|
Response.new(
|
15
29
|
JSON.parse(
|
data/lib/bogeyman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogeyman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rene Klacan
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/bogeyman/client.rb
|
63
63
|
- lib/bogeyman/version.rb
|
64
64
|
- lib/bogeyman.rb
|
65
|
+
- README.md
|
65
66
|
homepage: https://github.com/reneklacan/bogeyman
|
66
67
|
licenses:
|
67
68
|
- Beerware
|