xmrto 0.4.1 → 0.4.2

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: 182e3dab1b10889c90419313f32f8195eb1e50466e35e96b3a916ea533832d3a
4
- data.tar.gz: ef27526dd95e9f719038d43182fa8d2028adff91236666d5f9333b61eaf68062
3
+ metadata.gz: c682681d31653a8143a451362928455c9e198980c0ce8f3057a7496a86fa73f9
4
+ data.tar.gz: 95133e6f9841682f1396ff519297906d8966fdeb5d825909bd6b83f2558b3bdf
5
5
  SHA512:
6
- metadata.gz: d281d251debd109dbfb837c3a547b99d7eb689ca003f5803313d27f1a20c3caa2ee83753ff76dc1bfb812a0bc4e475a5219786f6b8446e650eafb8206218c3f4
7
- data.tar.gz: b5023abe4aa83568fea46492b69915f72eaecd39cb44f69acdfdf96ee4d3fa1ee7cb259391eae15e7af87cdf67525444ab5a80508cc832dbefc0da4582a9f630
6
+ metadata.gz: 37a8e701d3d2111b923c6be153eda2ce4d0480af6b21d5202ad0ccba6420e5e16bbadb67e397721bfcf4c9131d0feba8ea02876dc94f6f937d3188ddbd883df6
7
+ data.tar.gz: f1d6cb28b9e9a37cc492429f6ed24bb40983325922f4dc9fe4ab7bd35259ef3e25f00379d3b0fb962a94c4ed48813854010ae128d367db4ef6d9c318dcd871c4
data/README.md CHANGED
@@ -14,6 +14,13 @@ default the gem wil run in `:testnet` mode. http://test.xmr.to. However, this ve
14
14
 
15
15
  Xmrto.config.network = :testnet #livenet
16
16
 
17
+
18
+ To get a quote:
19
+
20
+ Xmrto::Quote.get
21
+ => {"zero_conf_enabled"=>true, "price"=>0.010802, "upper_limit"=>1.468, "lower_limit"=>0.001, "zero_conf_max_amount"=>0.1}
22
+
23
+
17
24
  To create a transfer, simply call
18
25
 
19
26
  transfer = Xmrto::Transfer.create("mqm6GJzsmzvwqPbH5p7tKrRRdHrMkmRXjS", 0.01333)
@@ -0,0 +1,6 @@
1
+ module Xmrto
2
+ (1..14).map do |i|
3
+ clazz = "class Error#{i.to_s.rjust(3, "0")} < StandardError; end"
4
+ eval(clazz)
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ module Xmrto
2
+ class Quote
3
+
4
+ def self.get
5
+ response = HTTParty.get("#{base_url}/order_parameter_query/")
6
+ if response["error"]
7
+ raise("Xmrto::Error#{response["error"][-3..-1]}".constantize, response["error_msg"] )
8
+ end
9
+ response
10
+ end
11
+
12
+ private
13
+
14
+ def self.testnet?
15
+ Xmrto.config.network == :testnet
16
+ end
17
+
18
+ def self.livenet?
19
+ Xmrto.config.network == :livenet
20
+ end
21
+
22
+ def self.base_url
23
+ if testnet?
24
+ "https://test.xmr.to/api/v2/xmr2btc"
25
+ else
26
+ "https://xmr.to/api/v2/xmr2btc"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -8,13 +8,13 @@ module Xmrto
8
8
  class Transfer
9
9
 
10
10
 
11
- attr_accessor :uuid, :xmr_price_btc, :state, :btc_amount, :btc_dest_address, :xmr_required_amount, :xmr_receiving_address,
12
- :xmr_receiving_integrated_address, :xmr_required_payment_id_long, :xmr_required_payment_id_short, :created_at, :expires_at, :seconds_till_timeout, :xmr_amount_total, :xmr_amount_remaining, :xmr_num_confirmations_remaining, :xmr_recommended_mixin, :btc_num_confirmations_before_purge, :btc_num_confirmations, :btc_transaction_id
11
+ attr_accessor :uuid, :xmr_price_btc, :state, :btc_amount, :btc_dest_address, :xmr_required_amount, :xmr_receiving_address,
12
+ :xmr_receiving_integrated_address, :xmr_required_payment_id_long, :xmr_required_payment_id_short, :created_at, :expires_at, :seconds_till_timeout, :xmr_amount_total, :xmr_amount_remaining, :xmr_num_confirmations_remaining, :xmr_recommended_mixin, :btc_num_confirmations_before_purge, :btc_num_confirmations, :btc_transaction_id
13
13
 
14
14
 
15
- def initialize(uuid = nil)
16
- self.uuid = uuid
17
- end
15
+ def initialize(uuid = nil)
16
+ self.uuid = uuid
17
+ end
18
18
 
19
19
  def self.create(btc_address, btc_amount)
20
20
  new.create(btc_address, btc_amount)
data/lib/xmrto/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xmrto
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/xmrto.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'xmrto/config'
2
2
  require 'xmrto/transfer'
3
+ require 'xmrto/errors'
4
+ require 'xmrto/quote'
3
5
  require 'xmrto/version'
4
6
  require 'httparty'
5
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmrto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Kretschmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-18 00:00:00.000000000 Z
11
+ date: 2019-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,6 +85,8 @@ files:
85
85
  - bin/setup
86
86
  - lib/xmrto.rb
87
87
  - lib/xmrto/config.rb
88
+ - lib/xmrto/errors.rb
89
+ - lib/xmrto/quote.rb
88
90
  - lib/xmrto/transfer.rb
89
91
  - lib/xmrto/version.rb
90
92
  - xmrto.gemspec