cryptopay 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -5
- data/lib/cryptopay.rb +8 -1
- data/lib/cryptopay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3725bd46d2d4be5a5aab73b9a990541e56634a39
|
4
|
+
data.tar.gz: a0fef885b83407e3631e3ca78aab3e507441eb99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc1682789bff725c3db88dc8531b0f6eb77b3f5b7500d2f4e6c07d4020d34ab1bc563888c21dcb196b39f81ea20303d44780c0e192aebe4513d3a091c1813c9
|
7
|
+
data.tar.gz: 067527ce63e033c1cf9f4c5cc2a2b597a923fb32a62851b97fd00713b7d36feebaf340f3b45a29738b03f1db44833bb8aa2ba0f648683f9f2f7d9692a29d76b5
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Cryptopay
|
2
|
+
Easily accept Bitcoin payment with Cryptopay Payment API
|
3
|
+
|
4
|
+
Before you will be able to start using this gem, you will need to obtain an API key in Account - Merchant Tools - Settings.
|
5
|
+
|
6
|
+
|
1
7
|
# Installation
|
2
8
|
|
3
9
|
```ruby
|
@@ -5,7 +11,7 @@ gem install cryptopay
|
|
5
11
|
```
|
6
12
|
|
7
13
|
|
8
|
-
or your Gemfile:
|
14
|
+
or in your Gemfile:
|
9
15
|
|
10
16
|
```ruby
|
11
17
|
gem 'cryptopay'`
|
@@ -27,7 +33,15 @@ invoice = Cryptopay.new_invoice id: 'test',
|
|
27
33
|
currency: 'GBP',
|
28
34
|
description: 'test description',
|
29
35
|
success_redirect_url: 'https://cryptopay.me',
|
30
|
-
callback_url: 'https://cryptopay.me'
|
36
|
+
callback_url: 'https://cryptopay.me',
|
37
|
+
callback_params: {
|
38
|
+
customer_id: "12389",
|
39
|
+
array_params: ['Black', '36' 'XL'],
|
40
|
+
nested_hash: {
|
41
|
+
validations_hash: "other",
|
42
|
+
array_params_again: ['test1', 'test2' 'test3']
|
43
|
+
}
|
44
|
+
}
|
31
45
|
```
|
32
46
|
now invoice object is hash with next attributes
|
33
47
|
```ruby
|
@@ -37,7 +51,14 @@ status: 'pending',
|
|
37
51
|
btc_price: 0.0055,
|
38
52
|
btc_address: '16KcaBuNbHXhTweJspFkSku2nmvvyV8NoL',
|
39
53
|
short_id: 'CF47603E',
|
40
|
-
callback_params:
|
54
|
+
callback_params: {
|
55
|
+
validations_hash: "SUPERSECRETHASH",
|
56
|
+
array_params: ['test1', 'test2' 'test3'],
|
57
|
+
nested_hash: {
|
58
|
+
validations_hash: "other",
|
59
|
+
array_params_again: ['test1', 'test2' 'test3']
|
60
|
+
}
|
61
|
+
},
|
41
62
|
id: 'test',
|
42
63
|
price: 2.32,
|
43
64
|
currency: 'GBP',
|
@@ -45,14 +66,14 @@ created_at: 1387305401,
|
|
45
66
|
valid_till: 1387306001
|
46
67
|
```
|
47
68
|
|
48
|
-
You can save `uuid` and use this later
|
69
|
+
You can save `uuid` and use this later to update invoice status:
|
49
70
|
```ruby
|
50
71
|
Cryptopay.invoice invoice['uuid']
|
51
72
|
```
|
52
73
|
|
53
74
|
|
54
75
|
# Errors handle
|
55
|
-
classic ruby
|
76
|
+
Error handling is done in classic ruby way:
|
56
77
|
```ruby
|
57
78
|
begin
|
58
79
|
params = Cryptopay.new_invoice id: 'test',
|
data/lib/cryptopay.rb
CHANGED
@@ -6,7 +6,14 @@ require 'cryptopay/net'
|
|
6
6
|
module Cryptopay
|
7
7
|
class Error < Exception; attr_accessor :errors; end
|
8
8
|
# API Key
|
9
|
-
|
9
|
+
@@api_key = ''
|
10
|
+
def self.key=(new_key)
|
11
|
+
@@api_key = new_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.key
|
15
|
+
@@api_key
|
16
|
+
end
|
10
17
|
|
11
18
|
def self.new_invoice(params = {})
|
12
19
|
sanity_check!
|
data/lib/cryptopay/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vadim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|