securitytrails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c78dce6d2a5f9f147f573a36a86d2cec52e2248b414233a1a59d6f9ab90ece5
4
- data.tar.gz: dc09510aa36bf18d4c5bf16988af4faa5cc7b6e025c5b0108fe21a371077c959
3
+ metadata.gz: 283989ff3a2bf8ee9305be60810335216a2fa3211197093446a549feeea66f7e
4
+ data.tar.gz: 91db5d07036bcf5e1c0a43c41a7991ec1ba925db85c1c727d5c25f2d153e9129
5
5
  SHA512:
6
- metadata.gz: 935e6ae2b707285d1d7109dabda2c3d17d313b696e98e76026a05dea1713867ba7be8a7d4734f5a3a8560aef96803c055edf63a4135d2081b9bc7e3660c401a0
7
- data.tar.gz: 38044581872fab115d9612079fd4cdfb60bbfc9493ecab24d66030e1b96c17402d05c30b3fdd41dcc4cddf4f63417baa1b975e0ac057d73f43cd62cec21c84dd
6
+ metadata.gz: 17e09e312bd2c1fa72ee72fbbd61852b48aa6809c538d1c4d148a0d16145887f91e0289337ec28386b15961285827b52154b7305d0811007f59d4b611591c07d
7
+ data.tar.gz: ad56eba45fb851f6a20fad5db9e54045bc73992f4f5437258f5624d510290d0818c9b9eb394ed7e757cefce6a3b2dd241b8005d9129c2e59fb9f248fdc8d5342
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # SecurityTrails
2
2
 
3
3
  [![Build Status](https://travis-ci.org/ninoseki/securitytrails.svg?branch=master)](https://travis-ci.org/ninoseki/securitytrails)
4
- [![Codacy Badge](https://api.codacy.com/project/badge/Grade/797d576993224ddb9fdd54280417812b)](https://www.codacy.com/app/ninoseki/securitytrails?utm_source=github.com&utm_medium=referral&utm_content=ninoseki/securitytrails&utm_campaign=Badge_Grade)
4
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/9637f5ed2b8943c28d9d61db778330fb)](https://www.codacy.com/app/ninoseki/securitytrails)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/ninoseki/securitytrails/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/securitytrails?branch=master)
6
6
 
7
7
  [SecurityTrails](https://securitytrails.com) API wrapper for Ruby.
@@ -66,9 +66,19 @@ api.ips.search("ptr_part = 'ns1'")
66
66
  api.ips.stats("ptr_part = 'amazon.com'")
67
67
  ```
68
68
 
69
+ All the API response (JSON / Hash) is wrapped by [Hashie::Mash](https://github.com/intridea/hashie#mash).
70
+
71
+ It means you can access to a response through a property-like syntax.
72
+
73
+ ```ruby
74
+ res = api.domain.get_by_hostname("github.com")
75
+ puts res.hostname # => "github.com"
76
+ puts res.current_dns.a.first_seen # => "2018-09-12"
77
+ ```
78
+
69
79
  ## Contributing
70
80
 
71
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/securitytrails. 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.
81
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/securitytrails.
72
82
 
73
83
  ## License
74
84
 
@@ -3,6 +3,7 @@
3
3
  require "securitytrails/version"
4
4
 
5
5
  require "securitytrails/api"
6
+ require "securitytrails/response"
6
7
  require "securitytrails/client"
7
8
 
8
9
  require "securitytrails/clients/domain"
@@ -39,7 +39,7 @@ module SecurityTrails
39
39
  Net::HTTP.start(HOST, 443, https_options) do |http|
40
40
  response = http.request(req)
41
41
  if response.code == '200'
42
- yield JSON.parse(response.body)
42
+ yield Response.new(JSON.parse(response.body))
43
43
  else
44
44
  raise(Error, "unsupported response code returned: #{response.code}")
45
45
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hashie"
4
+
5
+ module SecurityTrails
6
+ class Response < Hashie::Mash
7
+ disable_warnings
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SecurityTrails
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
+ spec.add_dependency "hashie", "~> 3.6"
28
+
27
29
  spec.add_development_dependency "bundler", "~> 1.17"
28
30
  spec.add_development_dependency "coveralls", "~> 0.8"
29
31
  spec.add_development_dependency "dotenv", "~> 2.5"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: securitytrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2018-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.6'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -132,6 +146,7 @@ files:
132
146
  - lib/securitytrails/clients/domains.rb
133
147
  - lib/securitytrails/clients/history.rb
134
148
  - lib/securitytrails/clients/ips.rb
149
+ - lib/securitytrails/response.rb
135
150
  - lib/securitytrails/version.rb
136
151
  - securitytrails.gemspec
137
152
  homepage: https://github.com/ninoseki/securitytrails