docodoco_jp 0.1.1 → 1.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 +5 -5
- data/.travis.yml +7 -0
- data/README.md +21 -11
- data/docodoco_jp.gemspec +6 -12
- data/{bin → exe}/docodoco_jp +0 -0
- data/fixtures/test_apikey.yml +2 -0
- data/lib/docodoco_jp.rb +11 -2
- data/lib/docodoco_jp/cli.rb +2 -2
- data/lib/docodoco_jp/version.rb +1 -1
- metadata +33 -21
- data/fixtures/sample_api_key.yml +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d7ad922934b2a9353c9a9fea4f48b11f5cf28cce8b9a169cc24ee68d1bcb32e2
|
4
|
+
data.tar.gz: 20dda45504df7ef9d5ea60f6b1a168dad5f3514140dc2f037f82d365877a0c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c582dc76cfa3fb02f5de0269fb32106e8e2322424b6aaa4151d2835060d6121ce08265beeac5a706ec90c3de43348913ec4114bea3a788d43cb24a0f9c9d414
|
7
|
+
data.tar.gz: 8c479d8e3933c55b2519c16326b0b68c65d7cf6aae585588512134b0c4a3b288648be627b441aefbbe0274fd157d9e1b26da864bd6c13708ab9fbcbb96d23ec8
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[](http://badge.fury.io/rb/docodoco_jp)
|
2
|
+
[](https://travis-ci.org/magicdrive/ruby-docodoco_jp)
|
3
|
+
|
1
4
|
# DocodocoJp
|
2
5
|
|
3
6
|
[www.docodoco.jp](http://www.docodoco.jp) api client library.
|
@@ -31,19 +34,26 @@ Or install it yourself as:
|
|
31
34
|
|
32
35
|
#### * ruby script
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
37
|
+
```ruby
|
38
|
+
require 'docodoco_jp'
|
39
|
+
|
40
|
+
apikey1 = "YOUR_APIKEY_1"
|
41
|
+
apikey2 = "YOUR_APIKEY_2"
|
40
42
|
|
41
|
-
|
43
|
+
options = {
|
44
|
+
ssl: false, # => default: true
|
45
|
+
faraday_log: true, # => default: false
|
46
|
+
charset: "euc_jp", # => default: utf-8
|
47
|
+
response_type: :json # => default: hashie
|
48
|
+
}
|
42
49
|
|
43
|
-
|
44
|
-
docodoco_jp.check_user # valid user, apikeys
|
50
|
+
ipv4addr = "210.251.250.30"
|
45
51
|
|
46
|
-
|
52
|
+
docodoco_jp = DocodocoJp.new(apikey1, apikey2, options)
|
53
|
+
docodoco_jp.check_user # valid user, apikeys
|
54
|
+
|
55
|
+
result = docodoco_jp.search(ipv4addr)
|
56
|
+
```
|
47
57
|
|
48
58
|
### enjoy!
|
49
59
|
|
@@ -55,7 +65,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
55
65
|
|
56
66
|
## Contributing
|
57
67
|
|
58
|
-
1. Fork it ( https://github.com/
|
68
|
+
1. Fork it ( https://github.com/magicdrive/docodoco_jp/fork )
|
59
69
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
70
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
71
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/docodoco_jp.gemspec
CHANGED
@@ -4,6 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'docodoco_jp/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = '>= 2.6.0'
|
7
8
|
spec.name = "docodoco_jp"
|
8
9
|
spec.version = DocodocoJp::VERSION
|
9
10
|
spec.authors = ["Hiroshi IKEGAMI"]
|
@@ -14,25 +15,18 @@ Gem::Specification.new do |spec|
|
|
14
15
|
spec.homepage = "https://github.com/magicdrive/ruby-docodoco_jp"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
-
# delete this section to allow pushing this gem to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
19
|
spec.bindir = "exe"
|
27
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
21
|
spec.require_paths = ["lib"]
|
29
22
|
|
30
23
|
spec.add_dependency "thor", "~> 0.0"
|
31
|
-
spec.add_dependency "faraday", "~> 0
|
24
|
+
spec.add_dependency "faraday", "~> 1.0"
|
32
25
|
spec.add_dependency "hashie", "~> 3.0"
|
33
26
|
|
34
|
-
spec.add_development_dependency "minitest", "~> 5.
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.14"
|
35
28
|
spec.add_development_dependency "pry"
|
36
|
-
spec.add_development_dependency "
|
37
|
-
spec.add_development_dependency "
|
29
|
+
spec.add_development_dependency "rack"
|
30
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
31
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
38
32
|
end
|
data/{bin → exe}/docodoco_jp
RENAMED
File without changes
|
data/lib/docodoco_jp.rb
CHANGED
@@ -13,13 +13,22 @@ require 'rexml/document'
|
|
13
13
|
|
14
14
|
class DocodocoJp
|
15
15
|
|
16
|
-
|
16
|
+
DEFAULT_API_HOST = 'api.docodoco.jp'
|
17
17
|
|
18
18
|
attr_reader :apikey
|
19
19
|
attr_reader :config
|
20
20
|
attr_reader :user_valid
|
21
21
|
|
22
22
|
class << self
|
23
|
+
def api_host=(host)
|
24
|
+
@api_host = host
|
25
|
+
end
|
26
|
+
|
27
|
+
def api_host
|
28
|
+
@api_host = DEFAULT_API_HOST if @api_host.nil?
|
29
|
+
return @api_host
|
30
|
+
end
|
31
|
+
|
23
32
|
def default_config
|
24
33
|
return {
|
25
34
|
ssl: true,
|
@@ -91,7 +100,7 @@ class DocodocoJp
|
|
91
100
|
return @connection ||= ->() {
|
92
101
|
protocol = config[:ssl] ? "https" : "http"
|
93
102
|
options = config[:ssl] ? { ssl: { verify: true } } : {}
|
94
|
-
Faraday.new("#{protocol}://#{
|
103
|
+
Faraday.new("#{protocol}://#{DocodocoJp::api_host}", options) do |builder|
|
95
104
|
builder.request :url_encoded
|
96
105
|
builder.response :logger if config[:faraday_log]
|
97
106
|
builder.adapter :net_http
|
data/lib/docodoco_jp/cli.rb
CHANGED
@@ -9,7 +9,7 @@ require 'docodoco_jp'
|
|
9
9
|
class DocodocoJp
|
10
10
|
class CLI < Thor
|
11
11
|
desc "search [IP_ADDRESS]", "Search target IP_ADDRESS infomation"
|
12
|
-
def search(ipaddr)
|
12
|
+
def search(ipaddr = nil)
|
13
13
|
$stdout.puts JSON.pretty_generate(client.search(ipaddr))
|
14
14
|
end
|
15
15
|
|
@@ -21,7 +21,7 @@ class DocodocoJp
|
|
21
21
|
FileUtils.mkdir_p(File.expand_path("~/.docodoco_jp/"))
|
22
22
|
File.open(File.expand_path("~/.docodoco_jp/apikey.yml"), "w") { |f| f.print(buf) }
|
23
23
|
$stdout.puts "config ok."
|
24
|
-
self.invoke(:
|
24
|
+
self.invoke(:show_key, [], {})
|
25
25
|
end
|
26
26
|
|
27
27
|
desc "show_key", "Show configred API key"
|
data/lib/docodoco_jp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docodoco_jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi IKEGAMI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '5.
|
61
|
+
version: '5.14'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '5.
|
68
|
+
version: '5.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,38 +80,53 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack
|
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'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '2.0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '2.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 12.3.3
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 12.3.3
|
111
125
|
description: Location service www.docodoco.jp API Client.
|
112
126
|
email:
|
113
127
|
- hiroshi.ikegami@magicdrive.jp
|
114
|
-
executables:
|
128
|
+
executables:
|
129
|
+
- docodoco_jp
|
115
130
|
extensions: []
|
116
131
|
extra_rdoc_files: []
|
117
132
|
files:
|
@@ -123,10 +138,10 @@ files:
|
|
123
138
|
- README.md
|
124
139
|
- Rakefile
|
125
140
|
- bin/console
|
126
|
-
- bin/docodoco_jp
|
127
141
|
- bin/setup
|
128
142
|
- docodoco_jp.gemspec
|
129
|
-
-
|
143
|
+
- exe/docodoco_jp
|
144
|
+
- fixtures/test_apikey.yml
|
130
145
|
- lib/docodoco_jp.rb
|
131
146
|
- lib/docodoco_jp/api_key_invalid.rb
|
132
147
|
- lib/docodoco_jp/cli.rb
|
@@ -135,8 +150,7 @@ files:
|
|
135
150
|
homepage: https://github.com/magicdrive/ruby-docodoco_jp
|
136
151
|
licenses:
|
137
152
|
- MIT
|
138
|
-
metadata:
|
139
|
-
allowed_push_host: https://rubygems.org
|
153
|
+
metadata: {}
|
140
154
|
post_install_message:
|
141
155
|
rdoc_options: []
|
142
156
|
require_paths:
|
@@ -145,17 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
159
|
requirements:
|
146
160
|
- - ">="
|
147
161
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
162
|
+
version: 2.6.0
|
149
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
164
|
requirements:
|
151
165
|
- - ">="
|
152
166
|
- !ruby/object:Gem::Version
|
153
167
|
version: '0'
|
154
168
|
requirements: []
|
155
|
-
|
156
|
-
rubygems_version: 2.4.5
|
169
|
+
rubygems_version: 3.1.4
|
157
170
|
signing_key:
|
158
171
|
specification_version: 4
|
159
172
|
summary: Location service www.docodoco.jp API Client.
|
160
173
|
test_files: []
|
161
|
-
has_rdoc:
|
data/fixtures/sample_api_key.yml
DELETED