volabit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +21 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +23 -0
- data/CONTRIBUTORS.md +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +83 -0
- data/Rakefile +14 -0
- data/lib/volabit.rb +16 -0
- data/lib/volabit/api.rb +27 -0
- data/lib/volabit/api/rates.rb +24 -0
- data/lib/volabit/api/slips.rb +42 -0
- data/lib/volabit/api/transactions.rb +46 -0
- data/lib/volabit/api/users.rb +29 -0
- data/lib/volabit/auth.rb +51 -0
- data/lib/volabit/common.rb +9 -0
- data/lib/volabit/common/constants.rb +11 -0
- data/lib/volabit/common/helpers.rb +15 -0
- data/lib/volabit/version.rb +3 -0
- data/spec/spec_helper.rb +84 -0
- data/spec/volabit/volabit_spec.rb +39 -0
- data/volabit.gemspec +29 -0
- metadata +168 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a9a71b4413e6a7ac810053fed69ecf87a25b4fce
|
4
|
+
data.tar.gz: 9005664fb9dce17445a91d8225dc1be9dfbc16e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7bd51e4164682cb2c830f68b3e8476b7b002ae9ad5c22370ae9e7c9d9607103bab525a08f5b649d8d48532376889996b884977215f108d64d605e1e52fff300e
|
7
|
+
data.tar.gz: e8243667a39375eda24d7000a832a8ac9541c9914526e111ab5d9de94820991c7543b2f70c66c75d3cd1bbe9beb5fc0eaf7cb47afcb8f43f25ca6b80036a877a
|
data/.editorconfig
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
# EditorConfig helps developers define and maintain consistent
|
3
|
+
# coding styles between different editors and IDEs
|
4
|
+
# editorconfig.org
|
5
|
+
|
6
|
+
root = true
|
7
|
+
|
8
|
+
[*]
|
9
|
+
|
10
|
+
# Change these settings to your own preference
|
11
|
+
indent_style = space
|
12
|
+
indent_size = 2
|
13
|
+
|
14
|
+
# We recommend you to keep these unchanged
|
15
|
+
end_of_line = lf
|
16
|
+
charset = utf-8
|
17
|
+
trim_trailing_whitespace = true
|
18
|
+
insert_final_newline = true
|
19
|
+
|
20
|
+
[*.md]
|
21
|
+
trim_trailing_whitespace = false
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--no-private --protected lib/**/*.rb - CONTRIBUTORS.md CHANGELOG.md LICENSE.txt
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
# Change Log
|
3
|
+
|
4
|
+
## To Do
|
5
|
+
- Add specs.
|
6
|
+
- Add proper docs.
|
7
|
+
- Automatics test suite run. (Codeship)
|
8
|
+
- Check methods that require special permissions and bitcoin/pesos funds.
|
9
|
+
|
10
|
+
## [Unreleased](unreleased)
|
11
|
+
### Added
|
12
|
+
- No recent changes.
|
13
|
+
|
14
|
+
## [v0.0.1](v0.0.1)
|
15
|
+
- OAuth2 integration.
|
16
|
+
- Exchange rates wrappers.
|
17
|
+
- Users wrappers.
|
18
|
+
- Transactions wrappers.
|
19
|
+
- Slips wrappers.
|
20
|
+
- Merchants wrappers.
|
21
|
+
|
22
|
+
[v0.0.1]: https://github.com/coincovemx/api-client/tree/v0.0.1
|
23
|
+
[unreleased]: http://https://github.com/coincovemx/api-client/tree/development
|
data/CONTRIBUTORS.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 David O' Rojo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Volabit
|
2
|
+
|
3
|
+
Volabit's API library. Integrate the Volabit services in your apps with ease.
|
4
|
+
|
5
|
+
You can see the available methods on the [project wiki][wiki]. Details of the API use can be found on the [official page][api-docs].
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'volabit'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ git clone https://github.com/coincovemx/api-client.git
|
22
|
+
$ cd api-client
|
23
|
+
$ bundle
|
24
|
+
$ gem build volabit.gemspec
|
25
|
+
$ gem install volabit-[version].gem
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
1) Instance a new Volabit client object.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
app_id = 'The registered API for your APP.'
|
33
|
+
secret = 'The registered secret for your APP.'
|
34
|
+
callback = 'The registered callback URL for your APP'
|
35
|
+
|
36
|
+
volabit_client = Volabit::Client.new(app_id, secret, callback)
|
37
|
+
```
|
38
|
+
|
39
|
+
Note that the by default the Volabit client uses the **production** environment. If you want to use the **test** environment, set the sandbox flag to `true` before requesting the authorization code.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
volabit_client.sandbox true
|
43
|
+
```
|
44
|
+
|
45
|
+
2) Get the URL that will allow the user to authorize your app to use his/her account. (It should be opened in a browser.)
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
auth_url = volabit_client.authorize
|
49
|
+
```
|
50
|
+
|
51
|
+
3) After you get the authorization code (sent at the callback URL that you provided), you'll use it to get the refresh and access tokens. This code can be used only once, so be sure to store the token object for later use or your app will have to be reauthorized.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
volabit_client.get_token 'The given authorization code.'
|
55
|
+
```
|
56
|
+
|
57
|
+
4) With these tokens, you'll be ready to call the services. The methods will return a response object. The contend can be retrieved with the `body` property and will be in the JSON format.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
response = volabit_client.tickers
|
61
|
+
response.body
|
62
|
+
# => {
|
63
|
+
# "btc_usd_buy":"226.06",
|
64
|
+
# "btc_usd_sell":"226.56",
|
65
|
+
# "usd_mxn_buy":"14.53",
|
66
|
+
# "usd_mxn_sell":"15.13",
|
67
|
+
# "btc_mxn_buy":"3285.63",
|
68
|
+
# "btc_mxn_sell":"3427.3"
|
69
|
+
# }
|
70
|
+
```
|
71
|
+
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
1. Fork it ( https://github.com/[my-github-username]/volabit/fork )
|
76
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
77
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
78
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
79
|
+
5. Create a new Pull Request
|
80
|
+
|
81
|
+
|
82
|
+
[wiki]: https://github.com/coincovemx/api-client/wiki
|
83
|
+
[api-docs]: https://coincovemx.github.io/
|
data/Rakefile
ADDED
data/lib/volabit.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
require_relative 'volabit/auth'
|
3
|
+
require_relative 'volabit/api'
|
4
|
+
require_relative 'volabit/version'
|
5
|
+
|
6
|
+
module Volabit
|
7
|
+
class Client
|
8
|
+
include Auth
|
9
|
+
include API
|
10
|
+
|
11
|
+
def initialize(app_id, app_secret, app_url, env = 'production')
|
12
|
+
@url = app_url
|
13
|
+
set_oauth_client(app_id, app_secret, env)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/volabit/api.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require_relative 'api/rates'
|
3
|
+
require_relative 'api/users'
|
4
|
+
require_relative 'api/slips'
|
5
|
+
require_relative 'api/transactions'
|
6
|
+
|
7
|
+
module Volabit
|
8
|
+
module API
|
9
|
+
private
|
10
|
+
|
11
|
+
# Request a resource using the GET method.
|
12
|
+
def get_resource(resource, params = nil)
|
13
|
+
@token.refresh if @token.expired?
|
14
|
+
@token.get(resource, params: params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def post_to_resource(resource, params)
|
18
|
+
@token.refresh if @token.expired?
|
19
|
+
@token.post(resource, params: params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_resource(resource)
|
23
|
+
@token.refresh if @token.expired?
|
24
|
+
@token.delete(resource)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
# API endpoints to get information about exchange rates on currencies.
|
3
|
+
module Rates
|
4
|
+
# Gets the exchange price from certain currency amount to other currency.
|
5
|
+
# @note BTC units are expected in satoshis. Other currencies units are
|
6
|
+
# expected in cents.
|
7
|
+
def spot_prices(amount:, from: 'BTC', to: 'MXN')
|
8
|
+
raise ArgumentError, 'Currencies must be different.' if from.eql? to
|
9
|
+
get_resource 'api/v1/spot-prices', {
|
10
|
+
currency_from: from, currency_to: to, amount: amount
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Gets the exchange price list for the supported currencies.
|
15
|
+
def tickers
|
16
|
+
get_resource 'api/v1/tickers'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Volabit
|
21
|
+
module API
|
22
|
+
include Rates
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
# Methods to manage slips in the user wallet.
|
3
|
+
module Slips
|
4
|
+
# Creates a slip you can use to load your wallet.
|
5
|
+
def new_slip(currency:, amount:, type:)
|
6
|
+
post_to_resource 'api/v1/users/me/slips', {
|
7
|
+
currency: currency,
|
8
|
+
amount: amount,
|
9
|
+
type: type
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
# Gets the information of a specific slip.
|
14
|
+
def get_slip_data(id:)
|
15
|
+
get_resource "api/v1/users/me/slips/#{id}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Deletes a specific slip.
|
19
|
+
def delete_slip(id:)
|
20
|
+
delete_resource "api/v1/users/me/slips/#{id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Informs of a receipt used to load a wallet's slip.
|
24
|
+
def report_receipt(id:, amount:, affiliation:, authorization:)
|
25
|
+
post_to_resource "api/v1/users/me/slips/#{id}/report", {
|
26
|
+
amount: amount,
|
27
|
+
affiliation_number: affiliation,
|
28
|
+
authorization_number: authorization
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Lists the available options to load a slip.
|
33
|
+
def get_load_methods
|
34
|
+
get_resource 'api/v1/users/me/slips/methods'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module Volabit
|
39
|
+
module API
|
40
|
+
include Slips
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
# Methods to perform transactions with bitcoins and fiat currencies.
|
3
|
+
module Transactions
|
4
|
+
# Instantly buy bitcoins using fiat balance.
|
5
|
+
# @note The amount is expected in satoshis.
|
6
|
+
def buy_bitcoins(amount:)
|
7
|
+
post_to_resource 'api/v1/users/me/buys', {
|
8
|
+
amount: amount
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
# Instantly sell bitcoins to get fiat balance.
|
13
|
+
# @note The amount is expected in satoshis.
|
14
|
+
def sell_bitcoins(amount:)
|
15
|
+
post_to_resource 'api/v1/users/me/sells', {
|
16
|
+
amount: amount
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Instantly send fiat or bitcoins to an address.
|
21
|
+
# @note The amount is expected in satoshis for bitcoins and cents for fiat
|
22
|
+
# fiat currencies.
|
23
|
+
def send(currency:, amount:, address:)
|
24
|
+
post_to_resource 'api/v1/users/me/send', {
|
25
|
+
amount: amount,
|
26
|
+
address: address,
|
27
|
+
currency: currency
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Requests a special address to receive a bitcoin payment that will be
|
32
|
+
# instantly converted to the designated currency.
|
33
|
+
# @note This action requires special merchant permissions to be performed.
|
34
|
+
def new_payment(currency:, amount:)
|
35
|
+
post_to_resource 'api/v1/users/me/green-addresses', {
|
36
|
+
currency: currency,
|
37
|
+
amount: amount
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Volabit
|
43
|
+
module API
|
44
|
+
include Transactions
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
# API endpoints for user account management.
|
3
|
+
module Users
|
4
|
+
# Creates a new user account.
|
5
|
+
# @note Special partner permissions are required to perform this action.
|
6
|
+
def create_user(acceptance:, email:, pass: '')
|
7
|
+
post_to_resource 'api/v1/users', {
|
8
|
+
accepts_terms_of_service: acceptance,
|
9
|
+
user: {
|
10
|
+
email: email, password: pass
|
11
|
+
}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method :new_user, :create_user
|
16
|
+
|
17
|
+
# Get the account information from the user that authorized the app.
|
18
|
+
def me
|
19
|
+
get_resource 'api/v1/users/me'
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :user_data, :me
|
23
|
+
end
|
24
|
+
|
25
|
+
module Volabit
|
26
|
+
module API
|
27
|
+
include Users
|
28
|
+
end
|
29
|
+
end
|
data/lib/volabit/auth.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
require 'oauth2'
|
3
|
+
|
4
|
+
require_relative 'common'
|
5
|
+
|
6
|
+
module Volabit
|
7
|
+
include Common::Constants
|
8
|
+
extend Common::Helpers
|
9
|
+
|
10
|
+
# Methods to manage the OAuth2 authentication process.
|
11
|
+
module Auth
|
12
|
+
# Generates the URL to be opened in the browser so the user can authorize
|
13
|
+
# the app to use his/her Volabit account.
|
14
|
+
#
|
15
|
+
# @param url [String] callback URL to which the token will be sent on the
|
16
|
+
# redirection.
|
17
|
+
# @return [String] URL to open in the resource owner browser.
|
18
|
+
def authorize
|
19
|
+
@oauth_client.auth_code.authorize_url redirect_uri: @url
|
20
|
+
end
|
21
|
+
|
22
|
+
# Requests and sets the access and refresh tokens to use the Volabit API
|
23
|
+
# resources.
|
24
|
+
#
|
25
|
+
# @param auth_token [String]
|
26
|
+
# @return [OAuth2::AccessToken] object that includes the credentials to
|
27
|
+
# access the API and the methods to renew itself.
|
28
|
+
def get_token(auth_code)
|
29
|
+
@token = @oauth_client.auth_code.get_token auth_code, redirect_uri: @url
|
30
|
+
end
|
31
|
+
|
32
|
+
# Toggles the test environment with a boolean value.
|
33
|
+
# @note Set it before requiring the user authorization or your app will need
|
34
|
+
# to be reauthorized.)
|
35
|
+
def sandbox(flag)
|
36
|
+
@oauth_client.site = case flag
|
37
|
+
when true then Volabit.site_for 'sandbox'
|
38
|
+
when false then Volabit.site_for 'production'
|
39
|
+
else
|
40
|
+
@oauth_client.site
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
# Instances a new OAuth client to manage authorizations.
|
47
|
+
def set_oauth_client(id, secret, env)
|
48
|
+
@oauth_client = OAuth2::Client.new(id, secret, site: Volabit.site_for(env))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
module Volabit
|
3
|
+
module Common
|
4
|
+
module Constants
|
5
|
+
# Base URL for the Volabit production environment.
|
6
|
+
PRODUCTION_SITE = 'https://www.volabit.com'
|
7
|
+
# Base URL for the Volabit test environment.
|
8
|
+
SANDBOX_SITE = 'https://sandbox.volabit.com'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module Volabit
|
3
|
+
module Common
|
4
|
+
module Helpers
|
5
|
+
# Gets the base URL for the API service that will be used.
|
6
|
+
#
|
7
|
+
# @param env [String] The environment to be used.
|
8
|
+
# @return [String] URL of the Volabit site if the environment is
|
9
|
+
# production, otherwise it will return the URL for the sanbox.
|
10
|
+
def site_for(env)
|
11
|
+
(env.eql? 'production') ? Volabit::PRODUCTION_SITE : Volabit::SANDBOX_SITE
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
3
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
4
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
5
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
6
|
+
# a separate helper file that requires the additional dependencies and performs
|
7
|
+
# the additional setup, and require it from the spec files that actually need it.
|
8
|
+
#
|
9
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
10
|
+
# users commonly want.
|
11
|
+
|
12
|
+
require 'awesome_print'
|
13
|
+
require 'pry-byebug'
|
14
|
+
require 'pry-coolline'
|
15
|
+
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
# config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
59
|
+
# file, and it's useful to allow more verbose output when running an
|
60
|
+
# individual spec file.
|
61
|
+
if config.files_to_run.one?
|
62
|
+
# Use the documentation formatter for detailed output,
|
63
|
+
# unless a formatter has already been configured
|
64
|
+
# (e.g. via a command-line flag).
|
65
|
+
config.default_formatter = 'doc'
|
66
|
+
end
|
67
|
+
|
68
|
+
# Print the 10 slowest examples and example groups at the
|
69
|
+
# end of the spec run, to help surface which specs are running
|
70
|
+
# particularly slow.
|
71
|
+
# config.profile_examples = 10
|
72
|
+
|
73
|
+
# Run specs in random order to surface order dependencies. If you find an
|
74
|
+
# order dependency and want to debug it, you can fix the order by providing
|
75
|
+
# the seed, which is printed after each run.
|
76
|
+
# --seed 1234
|
77
|
+
# config.order = :random
|
78
|
+
|
79
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
80
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
81
|
+
# test failures related to randomization by passing the same `--seed` value
|
82
|
+
# as the one that triggered the failure.
|
83
|
+
# Kernel.srand config.seed
|
84
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
require File.expand_path('spec/spec_helper')
|
3
|
+
require File.expand_path('lib/volabit')
|
4
|
+
|
5
|
+
PRODUCTION_URL = 'https://www.volabit.com'
|
6
|
+
SANDBOX_URL = 'https://sandbox.volabit.com'
|
7
|
+
|
8
|
+
RSpec.describe Volabit do
|
9
|
+
subject { described_class }
|
10
|
+
|
11
|
+
it { should respond_to :site_for }
|
12
|
+
|
13
|
+
it 'holds the constant for the production environment' do
|
14
|
+
expect(subject::PRODUCTION_SITE).to be
|
15
|
+
expect(subject::PRODUCTION_SITE).to eql PRODUCTION_URL
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'holds the constant for the test environment' do
|
19
|
+
expect(subject::SANDBOX_SITE).to be
|
20
|
+
expect(subject::SANDBOX_SITE).to eql SANDBOX_URL
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.site_for' do
|
24
|
+
context 'receiving "production"' do
|
25
|
+
xit 'returns the production url' do
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'receiving other value than "production"' do
|
30
|
+
xit 'returns the sandbox url' do
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec.describe Volabit::Client do
|
37
|
+
subject { described_class }
|
38
|
+
# Lots of tests required.
|
39
|
+
end
|
data/volabit.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'volabit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "volabit"
|
8
|
+
spec.version = Volabit::VERSION
|
9
|
+
spec.authors = ["The Volabit Team & Contributors"]
|
10
|
+
spec.email = ["hola@volabit.com"]
|
11
|
+
spec.summary = %q{Library for the Volabit API.}
|
12
|
+
spec.description = %q{Integrate the Volabit services in your app with ease.}
|
13
|
+
spec.homepage = "https://github.com/coincovemx/api-client"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'oauth2', '~> 1.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
26
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'awesome_print', '~> 1.6'
|
28
|
+
spec.add_development_dependency 'pry-coolline', '~> 0.2'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: volabit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Volabit Team & Contributors
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: awesome_print
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-coolline
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.2'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.2'
|
111
|
+
description: Integrate the Volabit services in your app with ease.
|
112
|
+
email:
|
113
|
+
- hola@volabit.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".editorconfig"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".yardopts"
|
122
|
+
- CHANGELOG.md
|
123
|
+
- CONTRIBUTORS.md
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- lib/volabit.rb
|
129
|
+
- lib/volabit/api.rb
|
130
|
+
- lib/volabit/api/rates.rb
|
131
|
+
- lib/volabit/api/slips.rb
|
132
|
+
- lib/volabit/api/transactions.rb
|
133
|
+
- lib/volabit/api/users.rb
|
134
|
+
- lib/volabit/auth.rb
|
135
|
+
- lib/volabit/common.rb
|
136
|
+
- lib/volabit/common/constants.rb
|
137
|
+
- lib/volabit/common/helpers.rb
|
138
|
+
- lib/volabit/version.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/volabit/volabit_spec.rb
|
141
|
+
- volabit.gemspec
|
142
|
+
homepage: https://github.com/coincovemx/api-client
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
metadata: {}
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.4.5
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: Library for the Volabit API.
|
166
|
+
test_files:
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
- spec/volabit/volabit_spec.rb
|