rb-urlvoid 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd01c59240b617adf2ee9375ca69ed63e0a4d337
4
+ data.tar.gz: 210d4564f2130466340d4ae46d4b29b1cc741652
5
+ SHA512:
6
+ metadata.gz: c1514c8ac952f4fe9c03b08495af7c2167eb93782797f64d76ffd21f7f591e27d05461d8d4fd7defa52939387c76d6a7321e2509b50c3daa5c6f7ab889dcbdfa
7
+ data.tar.gz: a5e8da2d06e0d42a0944e6f7d9771e56de57c52afdd91bb4df82ce9300459ae76b59e75573a362229197a3d8811fc6743ab434ae292d7964ae6e08321369cb53
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/
@@ -0,0 +1,148 @@
1
+ # Relaxed.Ruby.Style
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.4
5
+
6
+ Style/Alias:
7
+ Enabled: false
8
+ StyleGuide: http://relaxed.ruby.style/#stylealias
9
+
10
+ Style/BeginBlock:
11
+ Enabled: false
12
+ StyleGuide: http://relaxed.ruby.style/#stylebeginblock
13
+
14
+ Style/BlockDelimiters:
15
+ Enabled: false
16
+ StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
17
+
18
+ Style/Documentation:
19
+ Enabled: false
20
+ StyleGuide: http://relaxed.ruby.style/#styledocumentation
21
+
22
+ Style/DotPosition:
23
+ Enabled: false
24
+ StyleGuide: http://relaxed.ruby.style/#styledotposition
25
+
26
+ Style/DoubleNegation:
27
+ Enabled: false
28
+ StyleGuide: http://relaxed.ruby.style/#styledoublenegation
29
+
30
+ Style/EndBlock:
31
+ Enabled: false
32
+ StyleGuide: http://relaxed.ruby.style/#styleendblock
33
+
34
+ Style/FormatString:
35
+ Enabled: false
36
+ StyleGuide: http://relaxed.ruby.style/#styleformatstring
37
+
38
+ Style/IfUnlessModifier:
39
+ Enabled: false
40
+ StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
41
+
42
+ Style/Lambda:
43
+ Enabled: false
44
+ StyleGuide: http://relaxed.ruby.style/#stylelambda
45
+
46
+ Style/ModuleFunction:
47
+ Enabled: false
48
+ StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
49
+
50
+ Style/MultilineBlockChain:
51
+ Enabled: false
52
+ StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
53
+
54
+ Style/NegatedIf:
55
+ Enabled: false
56
+ StyleGuide: http://relaxed.ruby.style/#stylenegatedif
57
+
58
+ Style/NegatedWhile:
59
+ Enabled: false
60
+ StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
61
+
62
+ Style/ParallelAssignment:
63
+ Enabled: false
64
+ StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
65
+
66
+ Style/PercentLiteralDelimiters:
67
+ Enabled: false
68
+ StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
69
+
70
+ Style/PerlBackrefs:
71
+ Enabled: false
72
+ StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
73
+
74
+ Style/Semicolon:
75
+ Enabled: false
76
+ StyleGuide: http://relaxed.ruby.style/#stylesemicolon
77
+
78
+ Style/SignalException:
79
+ Enabled: false
80
+ StyleGuide: http://relaxed.ruby.style/#stylesignalexception
81
+
82
+ Style/SingleLineBlockParams:
83
+ Enabled: false
84
+ StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
85
+
86
+ Style/SingleLineMethods:
87
+ Enabled: false
88
+ StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
89
+
90
+ Style/SpaceBeforeBlockBraces:
91
+ Enabled: false
92
+ StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
93
+
94
+ Style/SpaceInsideParens:
95
+ Enabled: false
96
+ StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
97
+
98
+ Style/SpecialGlobalVars:
99
+ Enabled: false
100
+ StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
101
+
102
+ Style/StringLiterals:
103
+ Enabled: false
104
+ StyleGuide: http://relaxed.ruby.style/#stylestringliterals
105
+
106
+ Style/TrailingCommaInLiteral:
107
+ Enabled: false
108
+ StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
109
+
110
+ Style/WhileUntilModifier:
111
+ Enabled: false
112
+ StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
113
+
114
+ Lint/AmbiguousRegexpLiteral:
115
+ Enabled: false
116
+ StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
117
+
118
+ Lint/AssignmentInCondition:
119
+ Enabled: false
120
+ StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
121
+
122
+ Metrics/AbcSize:
123
+ Enabled: false
124
+
125
+ Metrics/BlockNesting:
126
+ Enabled: false
127
+
128
+ Metrics/ClassLength:
129
+ Enabled: false
130
+
131
+ Metrics/ModuleLength:
132
+ Enabled: false
133
+
134
+ Metrics/CyclomaticComplexity:
135
+ Enabled: false
136
+
137
+ Metrics/LineLength:
138
+ Enabled: false
139
+
140
+ Metrics/MethodLength:
141
+ Enabled: false
142
+
143
+ Metrics/ParameterLists:
144
+ Enabled: false
145
+
146
+ Metrics/PerceivedComplexity:
147
+ Enabled: false
148
+
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.14.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at zgok0079@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rb-urlvoid.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 ninoseki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 manabu niseki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,173 @@
1
+ # rb-urlvoid
2
+
3
+ Yet another Ruby Gem for [URLVoid](http://www.urlvoid.com/) API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rb-urlvoid'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ $ gem install rb-urlvoid
23
+ $ urlvoid [options]
24
+ ```
25
+
26
+ ### Create your configuration file
27
+
28
+ ```bash
29
+ $ urlvoid create_config
30
+ ```
31
+
32
+ ### Edit your configuration file with API KEY
33
+
34
+ ```bash
35
+ $ $EDITOR ~/.urlvoid.yml
36
+ ```
37
+
38
+ ### Alternatively you can set Environment variables without a config file
39
+
40
+ ```bash
41
+ $ export URLVOID_API_KEY=<YOUR_API_KEY_HERE>
42
+ ```
43
+
44
+ ## CLI Usage
45
+
46
+ ### Retrieve information about a specific website
47
+
48
+ ```bash
49
+ $ urlvoid info malicious.com
50
+ =>
51
+ {
52
+ "details": {
53
+ "host": "malicious.com",
54
+ "updated": "1486047152",
55
+ "http_response_code": "0",
56
+ "domain_age": "808372800",
57
+ "google_page_rank": "0",
58
+ "alexa_rank": "0",
59
+ "connect_time": "0",
60
+ "header_size": "0",
61
+ "download_size": "0",
62
+ "speed_download": "0",
63
+ "external_url_redirect": null,
64
+ "ip": {
65
+ "addr": "93.184.216.34",
66
+ "hostname": null,
67
+ "asn": "15133",
68
+ "asname": "EdgeCast Networks, Inc.",
69
+ "country_code": "US",
70
+ "country_name": "United States",
71
+ "region_name": "Massachusetts",
72
+ "city_name": "Norwell",
73
+ "continent_code": "NA",
74
+ "continent_name": "North America",
75
+ "latitude": "42.1508",
76
+ "longitude": "-70.8228"
77
+ }
78
+ },
79
+ "detections": {
80
+ "engines": [
81
+ "BitDefender",
82
+ "Fortinet"
83
+ ],
84
+ "count": "2"
85
+ },
86
+ "page_load": "0.01"
87
+ }
88
+ ```
89
+
90
+ ### Rescan of a specific website
91
+
92
+ ```bash
93
+ $ urlvoid rescan example.com
94
+ =>
95
+ {
96
+ "details": {
97
+ "host": "example.com",
98
+ "updated": "1486798381",
99
+ "http_response_code": "0",
100
+ "domain_age": "808372800",
101
+ "google_page_rank": "0",
102
+ "alexa_rank": "0",
103
+ "connect_time": "0",
104
+ "header_size": "0",
105
+ "download_size": "0",
106
+ "speed_download": "0",
107
+ "external_url_redirect": null,
108
+ "ip": {
109
+ "addr": "93.184.216.34",
110
+ "hostname": null,
111
+ "asn": "15133",
112
+ "asname": "EdgeCast Networks, Inc.",
113
+ "country_code": "US",
114
+ "country_name": "United States",
115
+ "region_name": "Massachusetts",
116
+ "city_name": "Norwell",
117
+ "continent_code": "NA",
118
+ "continent_name": "North America",
119
+ "latitude": "42.1508",
120
+ "longitude": "-70.8228"
121
+ }
122
+ },
123
+ "action_result": "OK",
124
+ "page_load": "20.38"
125
+ }
126
+ ```
127
+
128
+ ### Scan a new website not present in the URLVoid's database
129
+
130
+ ```bash
131
+ $ urlvoid new_sacan unkown.com
132
+ =>
133
+ {
134
+ "page_load": "0.01"
135
+ }
136
+ ```
137
+
138
+ ** Get the number of queries remained **
139
+ ```
140
+ $ urlvoid stats
141
+ => Remained queries: 973
142
+ ```
143
+
144
+ ## API Usage
145
+
146
+ ```ruby
147
+ require 'urlvoid'
148
+
149
+ # Retrieve information about a specific website
150
+ result = URLVoid::Host.info "example.com"
151
+ # => Returns API response as a Hash
152
+
153
+ # Rescan of a specific website
154
+ result = URLVoid::Host.rescan "example.com"
155
+ # => Returns API response as a Hash
156
+
157
+ # Scan a new website not present in the URLVoid's database
158
+ result = URLVoid::Host.new_scan "example.com"
159
+ # => Returns API response as a Hash
160
+
161
+ # Get the number of queries remained
162
+ result = URLVoid::Stats.remained_queries
163
+ # => Returns API response as a Integer
164
+ ```
165
+
166
+ ## Contributing
167
+
168
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ninoseki/rb-urlvoid. 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.
169
+
170
+
171
+ ## License
172
+
173
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.warning = false
8
+ t.test_files = FileList['test/**/*_test.rb']
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'urlvoid'
3
+
4
+ URLVoid::CLI.start
@@ -0,0 +1,82 @@
1
+ module URLVoid
2
+ class CLI < Thor
3
+
4
+ # Default path to the config file
5
+ #
6
+ # @return [String] Default path to the config file
7
+ CONFIG_FILE = "#{Dir.home}/.urlvoid.yml".freeze
8
+
9
+ # Retrieve information about a specific website
10
+ #
11
+ # @param host_name [String] Host name
12
+ desc "info HOST_NAME", "Retrieve information about a specific website"
13
+ def info(host_name)
14
+ with_load_config { puts JSON.pretty_generate(Host.info(host_name)) }
15
+ end
16
+
17
+ # Update the report of a specific website
18
+ #
19
+ # @param host_name [String] Host name
20
+ desc "rescan HOST_NAME", "Update the report of a specific website"
21
+ def rescan(host_name)
22
+ with_load_config { puts JSON.pretty_generate(Host.rescan(host_name)) }
23
+ end
24
+
25
+ # Scan a new website not present in the database
26
+ #
27
+ # @param host_name [String] Host name
28
+ desc "new_scan HOST_NAME", "Scan a new website not present in the database"
29
+ def new_scan(host_name)
30
+ with_load_config { puts JSON.pretty_generate(Host.new_scan(host_name)) }
31
+ end
32
+
33
+ # Get the number of queries remained
34
+ desc "stats", "Get the number of queries remained"
35
+ def stats
36
+ with_load_config { puts "Remained queries: #{Stats.remained_queries}" }
37
+ end
38
+
39
+ # Create a config file
40
+ #
41
+ # @param file [String] Path to the config file
42
+ desc "create_config", "Create a config file"
43
+ def create_config(file = CONFIG_FILE)
44
+ path = File.expand_path(file)
45
+ if File.exist?(path)
46
+ puts "[!] #{path} is already exists. Please delete it if you want to re-create it."
47
+ else
48
+ h = { api_key: "INSERT YOUR API KEY", identifier: "api1000" }
49
+ YAML.dump h, File.open(path, "w+")
50
+ puts "[*] An empty #{path} has been created. Please edit and fill the correct values."
51
+ end
52
+ end
53
+
54
+ no_commands do
55
+ # Load a config file
56
+ #
57
+ # @note Configuration params are set as configatron attributes
58
+ # @param file [String] Path to the config file
59
+ def load_config(file = CONFIG_FILE)
60
+ path = File.expand_path(file)
61
+ if File.exist?(path)
62
+ h = YAML.load_file(path)
63
+ elsif ENV["URLVOID_API_KEY"]
64
+ h = { api_key: ENV["URLVOID_API_KEY"], identifier: ENV["URLVOID_IDENTIFIER"] || "api1000" }
65
+ else
66
+ raise URLVoidError, "[!] Missing API key: Create a config file or specify it via ENV variable"
67
+ end
68
+ configatron.configure_from_hash h
69
+ end
70
+
71
+ # Handling a method which needs config parameters
72
+ #
73
+ # @yield Give a block that pre-loaded a config file
74
+ def with_load_config
75
+ load_config
76
+ yield
77
+ rescue URLVoidError => e
78
+ puts e
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,49 @@
1
+ module URLVoid
2
+ class Client
3
+
4
+ attr_reader :api_key, :identifier
5
+
6
+ def initialize
7
+ raise URLVoidError, "API key not found" unless configatron.key?("api_key")
8
+ @api_key = configatron.api_key
9
+ @identifier = configatron.identifier
10
+ end
11
+
12
+ # URLVoid API endpoint URL
13
+ #
14
+ # @return [String] Endpoint URL
15
+ def endpoint
16
+ "http://api.urlvoid.com/#{identifier}/#{api_key}"
17
+ end
18
+
19
+ # Handling HTTP request that raise an exception
20
+ #
21
+ # @raise URLVoidError
22
+ # @yield Give a block that handling HTTP request error
23
+ def with_http_error_handling
24
+ yield
25
+ rescue RestClient::ExceptionWithResponse => e
26
+ raise URLVoidError, e.message
27
+ end
28
+
29
+ # Send a query to URLVoid API
30
+ #
31
+ # @param [String] path URL path
32
+ # @return [Hash] Parsed response
33
+ def query_api(path)
34
+ with_http_error_handling do
35
+ res = RestClient.get(endpoint + path)
36
+ h = Hash.from_xml(res.body)
37
+ h["response"]
38
+ end
39
+ end
40
+
41
+ # Send a query to URLVoid API
42
+ #
43
+ # @param [String] path URL path
44
+ # @return [Hash] Parsed response
45
+ def self.query_api(path)
46
+ new.query_api path
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module URLVoid
2
+ class URLVoidError < StandardError; end
3
+ end
@@ -0,0 +1,31 @@
1
+ module URLVoid
2
+ class Host
3
+
4
+ # Retrieve information about a specific website
5
+ #
6
+ # @return [Hash] Parsed response
7
+ def self.info(host_name)
8
+ res = Client.query_api("/host/#{host_name}/")
9
+ return res unless res.key?("detections")
10
+
11
+ # if "detections" key exists, refill "engines" values as an Array
12
+ engines = res["detections"]["engines"].values.flatten
13
+ res["detections"]["engines"] = engines
14
+ res
15
+ end
16
+
17
+ # Rescan of a specific website
18
+ #
19
+ # @return [Hash] Parsed response
20
+ def self.rescan(host_name)
21
+ Client.query_api("/host/#{host_name}/rescan/")
22
+ end
23
+
24
+ # Scan a new website not present in the URLVoid's database
25
+ #
26
+ # @return [Hash] Parsed response
27
+ def self.new_scan(host_name)
28
+ Client.query_api("/host/#{host_name}/newscan/")
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ module URLVoid
2
+ class Stats
3
+ # Get the number of queries remained
4
+ #
5
+ # @return [Integer] Response as an Integer
6
+ def self.remained_queries
7
+ res = Client.query_api("/stats/remained/")
8
+ res["queriesRemained"].to_i
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module URLVoid
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,17 @@
1
+ require "active_support/core_ext/hash"
2
+ require "configatron"
3
+ require "json"
4
+ require "rest-client"
5
+ require "thor"
6
+ require "yaml"
7
+
8
+ require "rb-urlvoid/cli"
9
+ require "rb-urlvoid/client"
10
+ require "rb-urlvoid/error"
11
+ require "rb-urlvoid/host"
12
+ require "rb-urlvoid/stats"
13
+ require "rb-urlvoid/version"
14
+
15
+ module URLVoid
16
+ # Your code goes here...
17
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rb-urlvoid/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rb-urlvoid"
8
+ spec.version = URLVoid::VERSION
9
+ spec.authors = ["ninoseki"]
10
+ spec.email = ["zgok0079@gmail.com"]
11
+
12
+ spec.summary = "Yet another ruby gem for URLVoid API"
13
+ spec.description = "Yet another ruby gem for URLVoid API"
14
+ spec.homepage = "https://github.com/ninoseki/rb-urlvoid"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest", "~> 5.0"
27
+ spec.add_development_dependency "fakefs"
28
+ spec.add_development_dependency "vcr"
29
+ spec.add_development_dependency "webmock"
30
+
31
+ spec.add_dependency "activesupport"
32
+ spec.add_dependency "configatron"
33
+ spec.add_dependency "rest-client"
34
+ spec.add_dependency "thor"
35
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rb-urlvoid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ninoseki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakefs
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: configatron
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rest-client
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: thor
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Yet another ruby gem for URLVoid API
154
+ email:
155
+ - zgok0079@gmail.com
156
+ executables:
157
+ - urlvoid
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".gitignore"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - CODE_OF_CONDUCT.md
165
+ - Gemfile
166
+ - LICENSE
167
+ - LICENSE.txt
168
+ - README.md
169
+ - Rakefile
170
+ - bin/urlvoid
171
+ - lib/rb-urlvoid/cli.rb
172
+ - lib/rb-urlvoid/client.rb
173
+ - lib/rb-urlvoid/error.rb
174
+ - lib/rb-urlvoid/host.rb
175
+ - lib/rb-urlvoid/stats.rb
176
+ - lib/rb-urlvoid/version.rb
177
+ - lib/urlvoid.rb
178
+ - rb-urlvoid.gemspec
179
+ homepage: https://github.com/ninoseki/rb-urlvoid
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubyforge_project:
199
+ rubygems_version: 2.6.8
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: Yet another ruby gem for URLVoid API
203
+ test_files: []