coingate 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +112 -1
- data/lib/coingate.rb +2 -2
- data/lib/coingate/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5cacfa153fb957d6aabc39b4256088635c10476
|
4
|
+
data.tar.gz: 46c1dd848e2f5aef091c8b4767550794b5a7d8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95110b8ac7444f6867193206ef5a9ba35c1bfca54d8d802d985a11cbd3cd0ef4f1df681e92bd754d11406276012e7d0153c02fe9549e230a35988a002795545f
|
7
|
+
data.tar.gz: b9ebb74fa958b7c0cee75cda771ac1f2e18c6c59dbc0962bada10b3401859f3f7b8849d2303620ee491a773e3d9be03d902e09e7df0af5369249c99b23604c5d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 CoinGate https://coingate.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1 +1,112 @@
|
|
1
|
-
#
|
1
|
+
# CoinGate Ruby Gem
|
2
|
+
|
3
|
+
CoinGate Bitcoin payment gateway.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Sign up for CoinGate account at <https://coingate.com> for live (production) and <https://sandbox.coingate.com> for testing (sandbox) environment.
|
8
|
+
|
9
|
+
Please note, that for Sandbox you must generate separate API credentials on <https://sandbox.coingate.com>. API credentials generated on <https://coingate.com> will not work for Sandbox mode.
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'coingate'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself by executing:
|
22
|
+
|
23
|
+
$ gem install coingate
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
### Create API credentials
|
28
|
+
|
29
|
+
To create API credentials go to <https://coingate.com> for production or <https://sandbox.coingate.com> for testing environment
|
30
|
+
|
31
|
+
### Setup CoinGate library
|
32
|
+
|
33
|
+
You can set default configuration like this:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
CoinGate.config do |config|
|
37
|
+
config.app_id = 1
|
38
|
+
config.api_key = 'get_your_key_at_coingatecom'
|
39
|
+
config.api_secret = 'get_your_key_at_coingatecom'
|
40
|
+
config.environment = 'live' # live or sandbox. Default: live
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Or you can pass authentication params individually, for example:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
CoinGate::Merchant::Order.find(1, {app_id: 1, api_key: 'coingate', api_secret: 'coingate', environment: 'sandbox'})
|
48
|
+
```
|
49
|
+
|
50
|
+
### Create Order
|
51
|
+
|
52
|
+
#### CoinGate::Merchant::Order#create
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
post_params = {
|
56
|
+
order_id: 'ORDER-1412759367',
|
57
|
+
price: 1050.99,
|
58
|
+
currency: 'USD',
|
59
|
+
receive_currency: 'EUR',
|
60
|
+
callback_url: 'https://example.com/payments/callback?token=6tCENGUYI62ojkuzDPX7Jg',
|
61
|
+
cancel_url: 'https://example.com/cart',
|
62
|
+
success_url: 'https://example.com/account/orders',
|
63
|
+
description: 'Apple Iphone 6'
|
64
|
+
}
|
65
|
+
|
66
|
+
order = CoinGate::Merchant::Order.create(post_params)
|
67
|
+
|
68
|
+
if order
|
69
|
+
# success
|
70
|
+
else
|
71
|
+
# order is not valid
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
#### CoinGate::Merchant::Order#create!
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
post_params = {
|
79
|
+
order_id: 'ORDER-1412759367',
|
80
|
+
price: 1050.99,
|
81
|
+
currency: 'USD',
|
82
|
+
receive_currency: 'EUR',
|
83
|
+
callback_url: 'https://example.com/payments/callback?token=6tCENGUYI62ojkuzDPX7Jg',
|
84
|
+
cancel_url: 'https://example.com/cart',
|
85
|
+
success_url: 'https://example.com/account/orders',
|
86
|
+
description: 'Apple Iphone 6'
|
87
|
+
}
|
88
|
+
|
89
|
+
# Raises exception if order is not valid.
|
90
|
+
order = CoinGate::Merchant::Order.create!(post_params)
|
91
|
+
```
|
92
|
+
|
93
|
+
### Find Order
|
94
|
+
|
95
|
+
#### CoinGate::Merchant::Order.find
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
order = CoinGate::Merchant::Order.find(1)
|
99
|
+
|
100
|
+
if order
|
101
|
+
# success
|
102
|
+
else
|
103
|
+
# order not found
|
104
|
+
end
|
105
|
+
```
|
106
|
+
|
107
|
+
#### CoinGate::Merchant::Order.find!
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
# Raises exception when order is not found
|
111
|
+
order = CoinGate::Merchant::Order.find!(1)
|
112
|
+
```
|
data/lib/coingate.rb
CHANGED
@@ -39,9 +39,9 @@ module CoinGate
|
|
39
39
|
url = (
|
40
40
|
case environment
|
41
41
|
when 'sandbox'
|
42
|
-
'https://sandbox.coingate.com/
|
42
|
+
'https://api-sandbox.coingate.com/v1'
|
43
43
|
else
|
44
|
-
'https://coingate.com/
|
44
|
+
'https://api.coingate.com/v1'
|
45
45
|
end) + url
|
46
46
|
|
47
47
|
nonce = (Time.now.to_f * 1e6).to_i
|
data/lib/coingate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coingate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Achmedovas
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- ".gitignore"
|
78
78
|
- Gemfile
|
79
79
|
- Gemfile.lock
|
80
|
+
- LICENSE
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|
82
83
|
- coingate.gemspec
|
@@ -109,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
112
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.5.1
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
116
|
summary: Library for CoinGate
|