exmo_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +65 -4
- data/lib/exmo_api.rb +1 -0
- data/lib/exmo_api/client.rb +16 -0
- data/lib/exmo_api/request.rb +2 -1
- data/lib/exmo_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd4943d99b314e94a8528a4c41c9bc18b855b9f733ca5514ce1c38baff1aba81
|
4
|
+
data.tar.gz: 8f4ba5c8d8879c825328df6b7c94ddaae2a962d5409da127648f261116dade40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b94dee993fbf18bce700e9ca2a26e4b0311638272433ca79a545a4abadf64890f2583bda35ffbf95196d3dfdf101254e1f921ce6969c25bf083448f52f67e00
|
7
|
+
data.tar.gz: a62cb34e7c0098a435ca93659c0517d0f99acf15d61579636eca72d4346e114cc54b54f1f445760fdccdfc8c84a47366bc39cde63549f876b6a71eb3583995f5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://semaphoreci.com/api/v1/igormalinovskiy/exmo_api/branches/master/shields_badge.svg)](https://semaphoreci.com/igormalinovskiy/exmo_api)
|
2
|
+
[![Code Climate](https://codeclimate.com/github/psyipm/exmo_api/badges/gpa.svg)](https://codeclimate.com/github/psyipm/exmo_api)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/exmo_api.svg)](https://badge.fury.io/rb/exmo_api)
|
2
4
|
|
3
|
-
|
5
|
+
# ExmoApi
|
4
6
|
|
5
|
-
|
7
|
+
This gem is a simple wrapper for Exmo.com exchange API. Please, refer to [official documentation](https://exmo.com/en/api) for detailed API methods description.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -20,9 +22,68 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
$ gem install exmo_api
|
22
24
|
|
25
|
+
## Configuration
|
26
|
+
|
27
|
+
Configure your gem if you want to use private API methods:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# config/initializers/exmo_api.rb
|
31
|
+
|
32
|
+
ExmoApi.setup do |config|
|
33
|
+
config.api_key = 'your_api_key'
|
34
|
+
config.api_secret = 'your_api_secret'
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
There is some additional configuration options available. These options are set by default:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
ExmoApi.setup do |config|
|
42
|
+
# API endpoint can be changed via configuration
|
43
|
+
#
|
44
|
+
config.api_endpoint = 'https://api/exmo.com/v1'
|
45
|
+
|
46
|
+
# Public methods list can also be changed
|
47
|
+
#
|
48
|
+
public_api_methods = [
|
49
|
+
:trades,
|
50
|
+
:order_book,
|
51
|
+
:ticker,
|
52
|
+
:pair_settings,
|
53
|
+
:currency
|
54
|
+
]
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
23
58
|
## Usage
|
24
59
|
|
25
|
-
|
60
|
+
```ruby
|
61
|
+
request = ExmoApi::Request.new(:ticker)
|
62
|
+
|
63
|
+
request.perform
|
64
|
+
{
|
65
|
+
"BTC_USD"=>{
|
66
|
+
"buy_price"=>"6559.79",
|
67
|
+
"sell_price"=>"6569",
|
68
|
+
"last_trade"=>"6559.79000001",
|
69
|
+
"high"=>"6591.15652728",
|
70
|
+
"low"=>"6414",
|
71
|
+
"avg"=>"6508.36792358",
|
72
|
+
"vol"=>"789.26528294",
|
73
|
+
"vol_curr"=>"5177414.51040588",
|
74
|
+
"updated"=>1535105637
|
75
|
+
},
|
76
|
+
# ... truncated ...
|
77
|
+
}
|
78
|
+
```
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
r = ExmoApi::Request.new(:currency)
|
82
|
+
=> #<ExmoApi::Request:0x00007f9af8814080 @api_method=:currency, @params={}>
|
83
|
+
|
84
|
+
r.perform
|
85
|
+
=> ["USD", "EUR", "RUB", "PLN", "UAH", "BTC", "LTC", "DOGE", "DASH", "ETH", "WAVES", "ZEC", "USDT", "XMR", "XRP", "KICK", "ETC", "BCH", "BTG", "EOS", "HBZ", "BTCZ", "DXT", "STQ", "XLM", "MNX", "OMG", "TRX", "ADA", "INK"]
|
86
|
+
```
|
26
87
|
|
27
88
|
## Development
|
28
89
|
|
data/lib/exmo_api.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module ExmoApi
|
2
|
+
class Client
|
3
|
+
attr_reader :config
|
4
|
+
|
5
|
+
def initialize(config)
|
6
|
+
@config = config
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(api_method, params)
|
10
|
+
request = ExmoApi::Request.new(api_method, params)
|
11
|
+
request.config = config
|
12
|
+
|
13
|
+
request.perform
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/exmo_api/request.rb
CHANGED
@@ -7,6 +7,7 @@ require 'openssl'
|
|
7
7
|
module ExmoApi
|
8
8
|
class Request
|
9
9
|
attr_reader :api_method
|
10
|
+
attr_writer :config
|
10
11
|
|
11
12
|
def initialize(api_method, params = {})
|
12
13
|
@api_method = api_method
|
@@ -65,7 +66,7 @@ module ExmoApi
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def config
|
68
|
-
ExmoApi.configuration
|
69
|
+
@config ||= ExmoApi.configuration
|
69
70
|
end
|
70
71
|
end
|
71
72
|
end
|
data/lib/exmo_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exmo_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Malinovskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- bin/setup
|
169
169
|
- exmo_api.gemspec
|
170
170
|
- lib/exmo_api.rb
|
171
|
+
- lib/exmo_api/client.rb
|
171
172
|
- lib/exmo_api/config.rb
|
172
173
|
- lib/exmo_api/request.rb
|
173
174
|
- lib/exmo_api/version.rb
|