lionshare 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +75 -0
- data/Rakefile +2 -0
- data/circle.yml +3 -0
- data/lib/lionshare/client.rb +10 -0
- data/lib/lionshare/version.rb +3 -0
- data/lib/lionshare/wrapper/base.rb +34 -0
- data/lib/lionshare/wrapper/markets.rb +11 -0
- data/lib/lionshare/wrapper/prices.rb +11 -0
- data/lib/lionshare.rb +9 -0
- data/lionshare.gemspec +34 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1cffbf27f1bef5cbd38a544ab7ff81770d9469d4
|
4
|
+
data.tar.gz: af2bda6ea69d318e4c1abd11d019dc5db8fb990f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e3a215431ec5cf9a1714b0a9bfc49d857e75c24929176ec31e51781588393f3f8f0031bb7910836b19af547827268ec27f88db550088de6bec6b385e97117ee
|
7
|
+
data.tar.gz: 60342c048f9aa07910377a9d896fc2426f00b48904342823c5d349b9a141b554d6795c42075f808f730a5f7431c8e27569492af5a75d78da24a8a99eefc7bcfb
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
StyleGuideCopsOnly: true
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
Max: 120
|
9
|
+
|
10
|
+
Documentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
FrozenStringLiteralComment:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/FileName:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/ModuleLength:
|
20
|
+
Exclude:
|
21
|
+
- spec/**/*_spec.rb
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Kirill Shevchenko
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Lionshare
|
2
|
+
|
3
|
+
A Ruby interface to the Lionshare API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'lionshare'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install lionshare
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Initialize client:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
client = Lionshare::Client.new
|
27
|
+
```
|
28
|
+
|
29
|
+
### Prices
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
client.prices.get
|
33
|
+
```
|
34
|
+
|
35
|
+
Response:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
{"data"=>{"BTC"=>[1755, 1780.32, 1794.99, 1781.91, 1777.96, 1782, 1794.99, 1785.54, 1795.52, 1843, 1877.6, 1880.91, 1848.77], "ETH"=>[91.27, 88.59, 89.34, 89.28, 88.77, 87.28, 88.36, 89.08, 88.41, 87.16, 88.2, 89.7, 90.33], "LTC"=>[37.1, 36.16, 34.31, 31.72, 32.41, 33.55, 32.82, 32.21, 29.92, 31.71, 31.2, 32.27, 32.79]}}
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
or with `period` key
|
43
|
+
`hour | day | week | month | year`
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
client.prices.get(period: :hour)
|
47
|
+
```
|
48
|
+
Response:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
{"data"=>{"BTC"=>[1852, 1851.98, 1851.39, 1851.96, 1851.88, 1851.96, 1852.95, 1853, 1852.96, 1852.95, 1853, 1852.99, 1853], "ETH"=>[89.75, 89.4, 89.59, 89.58, 89.54, 89.52, 89.48, 89.39, 89.46, 89.39, 89.21, 89.18, 88.9], "LTC"=>[31.82, 31.9, 31.94, 31.92, 31.94, 31.87, 31.96, 31.81, 31.66, 31.45, 31.64, 31.73, 31.63]}}
|
52
|
+
```
|
53
|
+
|
54
|
+
Response:
|
55
|
+
|
56
|
+
### Markets
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
client.markets.get(period: :hour)
|
60
|
+
```
|
61
|
+
|
62
|
+
Response:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
{"data"=>{"BTC"=>28317131524, "ETH"=>8372895792", "XRP"=>6477081639, "LTC"=>1562510222, "XEM"=>1104930000, "DASH"=>704585094, "ETC"=>606619545, "XMR"=>417501622}}
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kirillweb/lionshare.
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
75
|
+
|
data/Rakefile
ADDED
data/circle.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Lionshare
|
2
|
+
module Wrapper
|
3
|
+
class Base
|
4
|
+
API_URL = 'https://api.lionshare.capital/api'.freeze
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@root_url = API_URL + prefix
|
8
|
+
@client = HTTP::Client.new(headers: {
|
9
|
+
'Accept': 'application/json',
|
10
|
+
'Content-Type': 'application/json'
|
11
|
+
})
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def wrap(response)
|
17
|
+
body = response.body.to_s
|
18
|
+
if response.status == 200
|
19
|
+
body && !body.empty? ? JSON.parse(body) : nil
|
20
|
+
else
|
21
|
+
body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.prefix(value)
|
26
|
+
define_method :prefix do
|
27
|
+
value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :root_url, :client
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/lionshare.rb
ADDED
data/lionshare.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'lionshare/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'lionshare'
|
9
|
+
spec.version = Lionshare::VERSION
|
10
|
+
spec.authors = ['Kirill Shevchenko']
|
11
|
+
spec.email = ['hello@kirillshevch.com']
|
12
|
+
|
13
|
+
spec.summary = 'A Ruby interface to the Lionshare API.'
|
14
|
+
spec.description = spec.summary
|
15
|
+
spec.homepage = 'https://github.com/kirillshevch/lionshare'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'http'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.5.0'
|
30
|
+
spec.add_development_dependency 'byebug', '~> 3.5.0'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.48.0'
|
32
|
+
spec.add_development_dependency 'vcr', '~> 3.0.3'
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.0.1'
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lionshare
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kirill Shevchenko
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.5.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.5.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.5.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.48.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.48.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.3
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.3
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.0.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.0.1
|
125
|
+
description: A Ruby interface to the Lionshare API.
|
126
|
+
email:
|
127
|
+
- hello@kirillshevch.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- circle.yml
|
140
|
+
- lib/lionshare.rb
|
141
|
+
- lib/lionshare/client.rb
|
142
|
+
- lib/lionshare/version.rb
|
143
|
+
- lib/lionshare/wrapper/base.rb
|
144
|
+
- lib/lionshare/wrapper/markets.rb
|
145
|
+
- lib/lionshare/wrapper/prices.rb
|
146
|
+
- lionshare.gemspec
|
147
|
+
homepage: https://github.com/kirillshevch/lionshare
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.5.2
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: A Ruby interface to the Lionshare API.
|
171
|
+
test_files: []
|