nl-anx 0.0.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 +7 -0
- data/lib/nl-anx.rb +37 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 010606e6e685aaf86659456769bd660985073364
|
4
|
+
data.tar.gz: bf53c27f25c8823dc89f325a369049eca102bc46
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67176fc50b057a1700d57881cca9c1f36e11f21977194f5aace0e3db26a48ca7f21e3d0cd8bd5dda35c8cfcd6d94307c519a0ed783eec6ea18aefc350cd96d1f
|
7
|
+
data.tar.gz: ad361390beb3b5b0241c13546439785959590e6c524b7484c265a10a56fd09ae80a2cb091141efdd9a30a1b19d075dd1ddf998248cb58aeec96a120e744ee831
|
data/lib/nl-anx.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'cgi'
|
3
|
+
require 'openssl'
|
4
|
+
require 'json'
|
5
|
+
require 'digest/md5'
|
6
|
+
require 'httparty'
|
7
|
+
|
8
|
+
class ANX
|
9
|
+
include HTTParty
|
10
|
+
base_uri 'https://anxpro.com/api/2'
|
11
|
+
|
12
|
+
def initialize(options={})
|
13
|
+
@apisecret = Base64.decode64(ENV['anx_access_secret'])
|
14
|
+
@apikey = ENV['anx_access_key']
|
15
|
+
@currency = ENV['anx_currency']
|
16
|
+
@values = 'nonce=' + (Time.now.to_f * 1000).to_i.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def show_fiat_currency
|
20
|
+
@currency
|
21
|
+
end
|
22
|
+
|
23
|
+
def method_missing(method_sym, *arguments, &block)
|
24
|
+
convert_undercores_to_slashes = method_sym.to_s.gsub('_','/')
|
25
|
+
convert_undercores_to_slashes = convert_undercores_to_slashes.to_s.gsub('sendsimple','send_simple') # An exception where theres an underscore
|
26
|
+
convert_undercores_to_slashes = convert_undercores_to_slashes.gsub('currencypair', "BTC#{@currency}")
|
27
|
+
if arguments.length == 1 then
|
28
|
+
if arguments[0].kind_of? Hash
|
29
|
+
arguments[0].each {|k,v| @values = "#{@values}&#{k}=#{v}"}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
to_sign = convert_undercores_to_slashes + 0.chr + @values
|
33
|
+
ssl_sign = OpenSSL::HMAC.digest('sha512', @apisecret, to_sign)
|
34
|
+
signed = Base64.encode64(ssl_sign).to_s.gsub("\n",'')
|
35
|
+
self.class.post('/' + convert_undercores_to_slashes, :body => @values, :headers => {'Content-Type' => "application/x-www-form-urlencoded", 'Rest-Key' => @apikey , 'Rest-Sign' => signed}).to_json
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nl-anx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Barry Teoh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: nl-anx is a rubygem which interfaces directly with the ANXBTC.com API.
|
14
|
+
This is unofficial so please use at your own risk
|
15
|
+
email: hello@barryteoh.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/nl-anx.rb
|
21
|
+
homepage: http://github.com/nolim1t/ANXBTC
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.5.0
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: ANXBTC
|
45
|
+
test_files: []
|