spyonweb 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/lib/spyonweb.rb +20 -0
- data/lib/spyonweb/api.rb +41 -0
- data/lib/spyonweb/response.rb +17 -0
- data/lib/spyonweb/version.rb +3 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/spyonweb_spec.rb +13 -0
- data/spyonweb.gemspec +29 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 267187c6a12dbe928091e0f27764e094b20ffa3d
|
4
|
+
data.tar.gz: da141339fdfd0707c9019c87fff7430994947ebb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38c36b368115c1637377486769eeebc4c8c09741c616486f741d1664c94594d6a4cecd4e4c7a1b7a035580c5402db9d18acba3a9672def404539ee5eee1c176c
|
7
|
+
data.tar.gz: b8a07399d60f93f9b0a9fdf0fa87b4efcb382dfba8da8706d38340eb99970ba60d72411bed2d224d4dc36936e67fb5ac68573d9562fa069826c4a84c31cc2824
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Anton Bogdanovich
|
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.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Spyonweb.com Ruby bindings
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'spyonweb'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install spyonweb
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# initialize
|
23
|
+
Spyonweb.api_token = 'MY_TOKEN'
|
24
|
+
|
25
|
+
# queries
|
26
|
+
Spyonweb.summary('fullmooncalendar.net')
|
27
|
+
|
28
|
+
Spyonweb.domain('fullmooncalendar.net')
|
29
|
+
|
30
|
+
Spyonweb.adsense('pub-5953444431482912')
|
31
|
+
|
32
|
+
Spyonweb.analytics('UA-34505845')
|
33
|
+
|
34
|
+
Spyonweb.ip('157.166.226.25', limit: 10)
|
35
|
+
|
36
|
+
Spyonweb.dns_domain('sjc-dns1.ebaydns.com', start: 'ebaystores.com', limit: 10)
|
37
|
+
|
38
|
+
Spyonweb.ip_dns('8.8.8.8')
|
39
|
+
```
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it ( https://github.com/[my-github-username]/spyonweb-ruby/fork )
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/spyonweb.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require 'spyonweb/version'
|
5
|
+
require 'spyonweb/response'
|
6
|
+
require 'spyonweb/api'
|
7
|
+
|
8
|
+
module Spyonweb
|
9
|
+
extend self
|
10
|
+
|
11
|
+
@api_base = 'https://api.spyonweb.com/v1'
|
12
|
+
|
13
|
+
attr_accessor :api_token, :api_base
|
14
|
+
|
15
|
+
def resource
|
16
|
+
RestClient::Resource.new @api_base
|
17
|
+
end
|
18
|
+
|
19
|
+
extend Spyonweb::API
|
20
|
+
end
|
data/lib/spyonweb/api.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Spyonweb
|
2
|
+
module API
|
3
|
+
|
4
|
+
def summary(query)
|
5
|
+
get('summary', query)
|
6
|
+
end
|
7
|
+
|
8
|
+
def domain(query)
|
9
|
+
get('domain', query)
|
10
|
+
end
|
11
|
+
|
12
|
+
def ip(query, args = {})
|
13
|
+
get('ip', query, args)
|
14
|
+
end
|
15
|
+
|
16
|
+
def adsense(query, args = {})
|
17
|
+
get('adsense', query, args)
|
18
|
+
end
|
19
|
+
|
20
|
+
def analytics(query, args = {})
|
21
|
+
get('analytics', query, args)
|
22
|
+
end
|
23
|
+
|
24
|
+
def dns_domain(query, args = {})
|
25
|
+
get('dns_domain', query, args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def ip_dns(query, args = {})
|
29
|
+
get('ip_dns', query, args)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def get(method, query, args = {})
|
35
|
+
params = { access_token: Spyonweb.api_token }.merge(args)
|
36
|
+
response = Spyonweb.resource["#{method}/#{CGI.escape(query)}"].get params: params
|
37
|
+
Response.parse(response)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spyonweb
|
2
|
+
|
3
|
+
class Response < Struct.new(:status, :result, :response)
|
4
|
+
def self.parse(response)
|
5
|
+
begin
|
6
|
+
hash = JSON.parse(response.body)
|
7
|
+
status = hash['status']
|
8
|
+
result = hash['result']
|
9
|
+
rescue JSON::ParserError => e
|
10
|
+
status = "error"
|
11
|
+
result = e.message
|
12
|
+
end
|
13
|
+
Response.new(status, result, response)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spyonweb'
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.expect_with :rspec do |expectations|
|
5
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
+
end
|
7
|
+
|
8
|
+
config.mock_with :rspec do |mocks|
|
9
|
+
mocks.verify_partial_doubles = true
|
10
|
+
end
|
11
|
+
|
12
|
+
# The settings below are suggested to provide a good initial experience
|
13
|
+
# with RSpec, but feel free to customize to your heart's content.
|
14
|
+
=begin
|
15
|
+
# These two settings work together to allow you to limit a spec run
|
16
|
+
# to individual examples or groups you care about by tagging them with
|
17
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
18
|
+
# get run.
|
19
|
+
config.filter_run :focus
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
|
22
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
23
|
+
# recommended. For more details, see:
|
24
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
25
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
26
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
27
|
+
config.disable_monkey_patching!
|
28
|
+
|
29
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
30
|
+
# be too noisy due to issues in dependencies.
|
31
|
+
config.warnings = true
|
32
|
+
|
33
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
34
|
+
# file, and it's useful to allow more verbose output when running an
|
35
|
+
# individual spec file.
|
36
|
+
if config.files_to_run.one?
|
37
|
+
# Use the documentation formatter for detailed output,
|
38
|
+
# unless a formatter has already been configured
|
39
|
+
# (e.g. via a command-line flag).
|
40
|
+
config.default_formatter = 'doc'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Print the 10 slowest examples and example groups at the
|
44
|
+
# end of the spec run, to help surface which specs are running
|
45
|
+
# particularly slow.
|
46
|
+
config.profile_examples = 10
|
47
|
+
|
48
|
+
# Run specs in random order to surface order dependencies. If you find an
|
49
|
+
# order dependency and want to debug it, you can fix the order by providing
|
50
|
+
# the seed, which is printed after each run.
|
51
|
+
# --seed 1234
|
52
|
+
config.order = :random
|
53
|
+
|
54
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
55
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
56
|
+
# test failures related to randomization by passing the same `--seed` value
|
57
|
+
# as the one that triggered the failure.
|
58
|
+
Kernel.srand config.seed
|
59
|
+
=end
|
60
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe '#api_token' do
|
4
|
+
|
5
|
+
it "responds_to api_token" do
|
6
|
+
expect(Spyonweb).to respond_to(:api_token)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "sets api_token" do
|
10
|
+
Spyonweb.api_token = 'LkvWvMuzlJYG'
|
11
|
+
expect(Spyonweb.api_token).to eq 'LkvWvMuzlJYG'
|
12
|
+
end
|
13
|
+
end
|
data/spyonweb.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spyonweb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spyonweb"
|
8
|
+
spec.version = Spyonweb::VERSION
|
9
|
+
spec.authors = ["Anton Bogdanovich"]
|
10
|
+
spec.email = ["27bogdanovich@gmail.com"]
|
11
|
+
spec.summary = %q{Spyonweb.com Ruby bindings}
|
12
|
+
spec.description = %q{Spyonweb.com API ruby bindings}
|
13
|
+
spec.homepage = "https://github.com/bogdanovich/spyonweb-ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency('rest-client', '~> 1.4')
|
22
|
+
spec.add_dependency('json', '>= 1.8.1')
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", ">= 3"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "pry-byebug"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spyonweb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anton Bogdanovich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.8.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
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: pry-byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Spyonweb.com API ruby bindings
|
112
|
+
email:
|
113
|
+
- 27bogdanovich@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- lib/spyonweb.rb
|
125
|
+
- lib/spyonweb/api.rb
|
126
|
+
- lib/spyonweb/response.rb
|
127
|
+
- lib/spyonweb/version.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/spyonweb_spec.rb
|
130
|
+
- spyonweb.gemspec
|
131
|
+
homepage: https://github.com/bogdanovich/spyonweb-ruby
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.2.2
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: Spyonweb.com Ruby bindings
|
155
|
+
test_files:
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
- spec/spyonweb_spec.rb
|
158
|
+
has_rdoc:
|