exmo_api 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03d087b99e91c18cf049f4d8542cf5df9c6f5ac188e709436f805aac51587aed
4
- data.tar.gz: 3c9745dcb0fc537d38984d5f9bfe51cbb4eb7aa8fb1f0e4851e4fd6f073d5f2b
3
+ metadata.gz: dd4943d99b314e94a8528a4c41c9bc18b855b9f733ca5514ce1c38baff1aba81
4
+ data.tar.gz: 8f4ba5c8d8879c825328df6b7c94ddaae2a962d5409da127648f261116dade40
5
5
  SHA512:
6
- metadata.gz: 8844c73b7d15533658d99e2d867580ed7cba22d557179e6452c6f667425d879bfa70328662aace6e13a901ccb4f118d30431e9d8d908c6be78448df4991076a7
7
- data.tar.gz: '068b36ce20b1fafedd03e72d3c7e2df36a2245366b768d06d829045824b912cb9b4340a417c4f11bbeb124f7465c5a056e6a216a3a3d4e8cb298de0c23a237ae'
6
+ metadata.gz: 6b94dee993fbf18bce700e9ca2a26e4b0311638272433ca79a545a4abadf64890f2583bda35ffbf95196d3dfdf101254e1f921ce6969c25bf083448f52f67e00
7
+ data.tar.gz: a62cb34e7c0098a435ca93659c0517d0f99acf15d61579636eca72d4346e114cc54b54f1f445760fdccdfc8c84a47366bc39cde63549f876b6a71eb3583995f5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exmo_api (0.1.0)
4
+ exmo_api (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
- # ExmoApi
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
- 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/exmo_api`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ # ExmoApi
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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
 
@@ -5,6 +5,7 @@ require 'exmo_api/version'
5
5
  module ExmoApi
6
6
  autoload :Config, 'exmo_api/config'
7
7
  autoload :Request, 'exmo_api/request'
8
+ autoload :Client, 'exmo_api/client'
8
9
 
9
10
  def self.configuration
10
11
  @configuration ||= Config.new
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExmoApi
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
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.0
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: 2018-08-23 00:00:00.000000000 Z
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