zoomeye 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -21
  3. data/lib/zoomeye/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ced33e88f2d4cc7bbebbd232cbaf09ff926d3163
4
- data.tar.gz: 5ea14ba53ebc4d2023c420f90986dd045c6dbbdd
3
+ metadata.gz: 74c39663cbf9404a62405becb0ede9ee827278c9
4
+ data.tar.gz: bf60a8d999c5bf0eea093cbad5fd255031e62ed9
5
5
  SHA512:
6
- metadata.gz: 04eab519342dc0c9fc29f186e699ef97c30830a62da2d117fee7ba73b8467d5e9b8eedc921f3202e79171a01a4c722e2ff499799617555d90080255debba4041
7
- data.tar.gz: f4fa92cf4d71b678f1fd87721ad777e4f1b58d21540db787f02d507068733629e8751bd05f5c74a28349a62a80599527b52781cf444431abc72f0048571a9e30
6
+ metadata.gz: d710cc6e7ea02c4995bf9bb59fc654e8def36f61acb6039c50d151524ab030ab394df2bcd71133165a74e60ec887f5858ae830338ededa7b6f600b4513123416
7
+ data.tar.gz: c9b479108b12c22cc51cf3e740a29d9e935cb7e25dba8474914e7727c2656d1a04f5a206d4aa3a3149ada3339ba427373ba1b5aed0a664323370d89f249a6299
data/README.md CHANGED
@@ -1,41 +1,77 @@
1
- # Zoomeye
1
+ # rb_zoomeye
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zoomeye`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ zoomeye api for ruby.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Install
6
+ ``` bash
7
+ gem install zoomeye
8
+ ```
6
9
 
7
- ## Installation
10
+ ## Reference
8
11
 
9
- Add this line to your application's Gemfile:
12
+ As the official website, the interfaces provided encapsulation are below:
10
13
 
11
- ```ruby
12
- gem 'zoomeye'
13
- ```
14
+ + login
15
+
16
+ login with username and password, get an access token. for the details, please read the official api doc:
17
+ [https://www.zoomeye.org/api/doc#user](https://www.zoomeye.org/api/doc#user)
18
+
19
+ + resouces_info
14
20
 
15
- And then execute:
21
+ get resources info for account. for the details, please read the official api doc:
16
22
 
17
- $ bundle
23
+ [https://www.zoomeye.org/api/doc#resources-info](https://www.zoomeye.org/api/doc#resources-info)
18
24
 
19
- Or install it yourself as:
25
+ + host_search
20
26
 
21
- $ gem install zoomeye
27
+ search the host devices. for the details, please read the official api doc:
22
28
 
23
- ## Usage
29
+ [https://www.zoomeye.org/api/doc#host-search](https://www.zoomeye.org/api/doc#host-search)
24
30
 
25
- TODO: Write usage instructions here
26
31
 
27
- ## Development
32
+ + web_search
28
33
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+ search the web technologies. for the details, please read the official api doc:
30
35
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+ [https://www.zoomeye.org/api/doc#web-search] (https://www.zoomeye.org/api/doc#web-search)
32
37
 
33
- ## Contributing
38
+ **normally, a dict type is returned when call all above apis, except the 'login' api.**
34
39
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zoomeye. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
40
 
41
+ ## 异常捕获
37
42
 
38
- ## License
43
+ ``` ruby
44
+ class ZoomEyeError < StandardError
45
+ attr_reader :code, :desc
46
+ def initialize(code, desc)
47
+ @code = code # string: http status code
48
+ @desc = desc # string: http message
49
+ end
39
50
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
51
+ # return exceptial mesesage.
52
+ def message
53
+ "[#{@code}]#{@desc}"
54
+ end
55
+ end
41
56
 
57
+ ```
58
+
59
+ ## Example
60
+
61
+ ``` ruby
62
+ #!/usr/bin/ruby -w
63
+ # -*- coding: utf-8 -*-
64
+ require File.dirname(__FILE__) + '/../zoom_eye.rb'
65
+
66
+ if __FILE__ == $0
67
+ begin
68
+ ze = ZoomEye.new(("foo@bar.com", "foopass")
69
+ ze.login
70
+ puts ze.resources
71
+ puts ze.host_search("port:80", 7, "app,device")
72
+ puts ze.web_search("port:21", 1, "webapp,os")
73
+ rescue => e
74
+ puts e.message
75
+ end
76
+ end
77
+ ```
@@ -1,3 +1,3 @@
1
1
  module Zoomeye
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoomeye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - CharellKing