icobench 0.1.0
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 +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +35 -0
- data/README.md +104 -0
- data/Rakefile +2 -0
- data/icobench.gemspec +36 -0
- data/lib/icobench.rb +5 -0
- data/lib/icobench/icobench_client.rb +80 -0
- data/lib/icobench/version.rb +3 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 826fd20edafe83d1aaaf34d12e3ac8fad0a07b32
|
4
|
+
data.tar.gz: 835fe0960c298578f69b079aef3e1e485bbb47b7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3aa564ec2ed8ea83b5b6714070245b95b1884b2a26501f28d863ae5b03d6dc6dc2b3d191903f35566d873579692f5d61b4785123d905116254e6a188d583df33
|
7
|
+
data.tar.gz: ae9a9c68161327e084609914b5af4741c332e472f5a904a048dee8cdf3f37b37969b1f1c3916f1350f63034c1f910fc890fc61cc37a03f57c708d88a8ae824e9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
icobench (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.7.0)
|
12
|
+
rspec-core (~> 3.7.0)
|
13
|
+
rspec-expectations (~> 3.7.0)
|
14
|
+
rspec-mocks (~> 3.7.0)
|
15
|
+
rspec-core (3.7.0)
|
16
|
+
rspec-support (~> 3.7.0)
|
17
|
+
rspec-expectations (3.7.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.7.0)
|
20
|
+
rspec-mocks (3.7.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.7.0)
|
23
|
+
rspec-support (3.7.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.16)
|
30
|
+
icobench!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# Icobench
|
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/icobench`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'icobench'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install icobench
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
English
|
26
|
+
```ruby
|
27
|
+
ib = IcobenchClient.new(private_key = nil, public_key = nil)
|
28
|
+
# get all ICOs
|
29
|
+
ib.icos
|
30
|
+
|
31
|
+
# get filters for ICOs
|
32
|
+
ib.icos_filters
|
33
|
+
|
34
|
+
# Recommended brands ICOBench
|
35
|
+
ib.trending
|
36
|
+
|
37
|
+
# ICOBenchの銘柄別評価
|
38
|
+
ib.ratings
|
39
|
+
|
40
|
+
# ICOBench brand name evaluation
|
41
|
+
ib.profile(id:1) # ICO一覧のid
|
42
|
+
ib.profile(url:"viberate") # urlが"https://icobench.com/ico/viberate"なら"viberate"
|
43
|
+
|
44
|
+
# ICO statistics
|
45
|
+
ib.stats
|
46
|
+
|
47
|
+
# People related to ICO
|
48
|
+
ib.people_all
|
49
|
+
|
50
|
+
# Experts related to ICO
|
51
|
+
ib.people_expert
|
52
|
+
|
53
|
+
# Registered people related to ICO
|
54
|
+
ib.people_registered
|
55
|
+
|
56
|
+
```
|
57
|
+
|
58
|
+
Japanese
|
59
|
+
```ruby
|
60
|
+
ib = IcobenchClient.new(private_key = nil, public_key = nil)
|
61
|
+
# ICO一覧を取得
|
62
|
+
ib.icos
|
63
|
+
|
64
|
+
# ICOのfilter一覧を取得
|
65
|
+
ib.icos_filters
|
66
|
+
|
67
|
+
# ICOBenchおすすめの銘柄
|
68
|
+
ib.trending
|
69
|
+
|
70
|
+
# ICOBenchの銘柄別評価
|
71
|
+
ib.ratings
|
72
|
+
|
73
|
+
# ICOの銘柄詳細
|
74
|
+
ib.profile(id:1) # ICO一覧のid
|
75
|
+
ib.profile(url:"viberate") # urlが"https://icobench.com/ico/viberate"なら"viberate"
|
76
|
+
|
77
|
+
# ICOの統計
|
78
|
+
ib.stats
|
79
|
+
|
80
|
+
# ICOに関連する人々
|
81
|
+
ib.people_all
|
82
|
+
|
83
|
+
# ICOに関連する専門家
|
84
|
+
ib.people_expert
|
85
|
+
|
86
|
+
# ICOに関連する登録された人々
|
87
|
+
ib.people_registered
|
88
|
+
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
## Development
|
93
|
+
|
94
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
95
|
+
|
96
|
+
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).
|
97
|
+
|
98
|
+
## Contributing
|
99
|
+
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/icobench.
|
101
|
+
|
102
|
+
## License
|
103
|
+
|
104
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/icobench.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "icobench/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "icobench"
|
8
|
+
spec.version = Icobench::VERSION
|
9
|
+
spec.authors = ["yuma_mitsuyoshi"]
|
10
|
+
spec.email = ["glorymanchesteru@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Easy to get the data from IcoBench API.}
|
13
|
+
spec.description = %q{Easy to get the data from IcoBench API.}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
#end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
end
|
data/lib/icobench.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
require 'net/http'
|
5
|
+
require 'base64'
|
6
|
+
|
7
|
+
class IcobenchClient
|
8
|
+
BASE_URL = 'https://icobench.com/api/v1/'
|
9
|
+
SSL = true
|
10
|
+
|
11
|
+
def initialize(private_key = nil, public_key = nil, params = {})
|
12
|
+
@private_key = private_key
|
13
|
+
@public_key = public_key
|
14
|
+
end
|
15
|
+
|
16
|
+
def icos
|
17
|
+
url = "#{BASE_URL}icos/all"
|
18
|
+
get_data(url)
|
19
|
+
end
|
20
|
+
|
21
|
+
def icos_filters
|
22
|
+
url = "#{BASE_URL}icos/filters"
|
23
|
+
get_data(url)
|
24
|
+
end
|
25
|
+
|
26
|
+
def trending
|
27
|
+
url = "#{BASE_URL}icos/trending"
|
28
|
+
get_data(url)
|
29
|
+
end
|
30
|
+
|
31
|
+
def ratings
|
32
|
+
url = "#{BASE_URL}icos/ratings"
|
33
|
+
get_data(url)
|
34
|
+
end
|
35
|
+
|
36
|
+
def profile(params)
|
37
|
+
if params[:id]
|
38
|
+
url = "#{BASE_URL}ico/#{params[:id]}"
|
39
|
+
get_data(url)
|
40
|
+
elsif params[:url]
|
41
|
+
url = "#{BASE_URL}ico/#{params[:url]}"
|
42
|
+
end
|
43
|
+
get_data(url)
|
44
|
+
end
|
45
|
+
|
46
|
+
def stats
|
47
|
+
url = "#{BASE_URL}other/stats"
|
48
|
+
get_data(url)
|
49
|
+
end
|
50
|
+
|
51
|
+
def people_all
|
52
|
+
url = "#{BASE_URL}people/all"
|
53
|
+
get_data(url)
|
54
|
+
end
|
55
|
+
|
56
|
+
def people_expert
|
57
|
+
url = "#{BASE_URL}people/expert"
|
58
|
+
get_data(url)
|
59
|
+
end
|
60
|
+
|
61
|
+
def people_registered
|
62
|
+
url = "#{BASE_URL}people/registered"
|
63
|
+
get_data(url)
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_data(url)
|
67
|
+
uri = URI.parse(url)
|
68
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
69
|
+
if SSL
|
70
|
+
https.use_ssl = true
|
71
|
+
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
72
|
+
end
|
73
|
+
req = Net::HTTP::Post.new(uri.request_uri)
|
74
|
+
req['X-ICObench-Key'] = @public_key
|
75
|
+
req['X-ICObench-Sig'] = Base64.strict_encode64(OpenSSL::HMAC.digest('sha384', @private_key, '')).force_encoding("utf-8")
|
76
|
+
https.set_debug_output $stderr
|
77
|
+
res = https.request(req)
|
78
|
+
JSON.parse(res.body)
|
79
|
+
end
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: icobench
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yuma_mitsuyoshi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-28 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Easy to get the data from IcoBench API.
|
56
|
+
email:
|
57
|
+
- glorymanchesteru@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- Gemfile.lock
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- icobench.gemspec
|
68
|
+
- lib/icobench.rb
|
69
|
+
- lib/icobench/icobench_client.rb
|
70
|
+
- lib/icobench/version.rb
|
71
|
+
homepage: ''
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.5.1
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Easy to get the data from IcoBench API.
|
95
|
+
test_files: []
|