revolut 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/revolut.rb +24 -0
- data/lib/revolut/client.rb +37 -0
- data/lib/revolut/clients/accounts.rb +27 -0
- data/lib/revolut/configuration.rb +38 -0
- data/lib/revolut/connection.rb +73 -0
- data/lib/revolut/error.rb +122 -0
- data/lib/revolut/mash.rb +7 -0
- data/lib/revolut/middleware/raise_error.rb +15 -0
- data/lib/revolut/version.rb +3 -0
- data/revolut.gemspec +35 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e78472bddc6b9b4a144e58443790a36e86b323d15d9c2e486e475aef7797dd64
|
4
|
+
data.tar.gz: 77607ab1818d51ff6fa56b32b5cd0ac52ee5b3faf532657f3a75773923121f45
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 700c67c2106597bd89d3d44f8abda929b29dfa3a209c2dad0e7485260b3e918c95bca3dea18cc3bf8b8036340da8c0371ac1faf12299a0374fd73f11191c51d4
|
7
|
+
data.tar.gz: 0d17e68f636e0eaf36556791c93c2434577060d740c0231fd1a8f64865eccdd90e31ea49dc7b9e13efe679e9a7d90dd6e1f03041d41fdca67e1b289fb15696e4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at jpalumickas@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'rubocop', '~> 0.56'
|
7
|
+
end
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem 'pry'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'rake' # For Travis CI
|
15
|
+
gem 'simplecov', '~> 0.16', require: false
|
16
|
+
gem 'webmock', '~> 3.4'
|
17
|
+
end
|
18
|
+
|
19
|
+
# Specify your gem's dependencies in revolut.gemspec
|
20
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Justas Palumickas
|
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
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Revolut
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/revolut`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'revolut'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install revolut
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/revolut. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Revolut project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/revolut/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'revolut'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/revolut.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'revolut/version'
|
2
|
+
# require 'revolut/utils'
|
3
|
+
require 'revolut/error'
|
4
|
+
require 'revolut/client'
|
5
|
+
|
6
|
+
# Main module for gem.
|
7
|
+
module Revolut
|
8
|
+
class << self
|
9
|
+
def client
|
10
|
+
@client ||= Revolut::Client.new
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def method_missing(method_name, *args, &block)
|
16
|
+
return super unless client.respond_to?(method_name)
|
17
|
+
client.send(method_name, *args, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def respond_to_missing?(method_name, include_private = false)
|
21
|
+
client.respond_to?(method_name, include_private)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'revolut/connection'
|
2
|
+
require 'revolut/configuration'
|
3
|
+
|
4
|
+
require 'revolut/clients/accounts'
|
5
|
+
|
6
|
+
module Revolut
|
7
|
+
# Wrapper class for all actions.
|
8
|
+
class Client
|
9
|
+
include Revolut::Clients::Accounts
|
10
|
+
|
11
|
+
# Initialize client.
|
12
|
+
#
|
13
|
+
# @param options [Hash] A customizable set of options.
|
14
|
+
# @option options [String] :api_key API Key provider from Revlut.
|
15
|
+
def initialize(options = {})
|
16
|
+
config.api_key = options[:api_key] if options[:api_key]
|
17
|
+
config.environment = options[:environment] if options[:environment]
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Configuration]
|
21
|
+
def config
|
22
|
+
@config ||= Configuration.new
|
23
|
+
end
|
24
|
+
alias configuration config
|
25
|
+
|
26
|
+
# Configure client with a block of settings.
|
27
|
+
def configure
|
28
|
+
yield(config) if block_given?
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Connection]
|
33
|
+
def connection
|
34
|
+
@connection ||= Connection.new(self)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Revolut
|
2
|
+
module Clients
|
3
|
+
# Revolut Accounts
|
4
|
+
module Accounts
|
5
|
+
# Get accounts list.
|
6
|
+
#
|
7
|
+
# @see https://revolutdev.github.io/business-api/?shell--production#get-accounts
|
8
|
+
#
|
9
|
+
# @return [Hash] Response from API.
|
10
|
+
def accounts
|
11
|
+
connection.get('accounts')
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get account information.
|
15
|
+
#
|
16
|
+
# @see
|
17
|
+
# https://revolutdev.github.io/business-api/?shell--sandbox#get-account
|
18
|
+
#
|
19
|
+
# @param id [Integer] Id of group
|
20
|
+
#
|
21
|
+
# @return [Hash] Response from API.
|
22
|
+
def account(id)
|
23
|
+
connection.get("accounts/#{id}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Revolut
|
2
|
+
# A class responsible for all configurations.
|
3
|
+
class Configuration
|
4
|
+
# Default API endpoint.
|
5
|
+
PRODUCTION_API_ENDPOINT = 'https://b2b.revolut.com/api/1.0'.freeze
|
6
|
+
SANDBOX_API_ENDPOINT = 'https://sandbox-b2b.revolut.com/api/1.0'.freeze
|
7
|
+
|
8
|
+
# Default User Agent header string.
|
9
|
+
USER_AGENT = "Revolut Ruby v#{Revolut::VERSION}".freeze
|
10
|
+
|
11
|
+
attr_accessor :api_key
|
12
|
+
attr_writer :url, :user_agent, :environment
|
13
|
+
|
14
|
+
# Takes url provided from configuration or uses default one.
|
15
|
+
#
|
16
|
+
# @return [String] An API Endpoint url which will be used for connection.
|
17
|
+
def url
|
18
|
+
return @url if @url
|
19
|
+
|
20
|
+
if environment == :production
|
21
|
+
PRODUCTION_API_ENDPOINT
|
22
|
+
elsif environment == :sandbox
|
23
|
+
SANDBOX_API_ENDPOINT
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Takes user agent from configuration or uses default one.
|
28
|
+
#
|
29
|
+
# @return [String] User agent which will be used for connection headers.
|
30
|
+
def user_agent
|
31
|
+
@user_agent || USER_AGENT
|
32
|
+
end
|
33
|
+
|
34
|
+
def environment
|
35
|
+
@environment || :production
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require 'revolut/mash'
|
6
|
+
require 'revolut/middleware/raise_error'
|
7
|
+
|
8
|
+
module Revolut
|
9
|
+
# A class responsible for connecting to Revolut API and making requests.
|
10
|
+
class Connection
|
11
|
+
attr_reader :client
|
12
|
+
|
13
|
+
def initialize(client)
|
14
|
+
@client = client
|
15
|
+
end
|
16
|
+
|
17
|
+
def get(path, options = {})
|
18
|
+
request(:get, path, options).body
|
19
|
+
end
|
20
|
+
|
21
|
+
def put(path, options = {})
|
22
|
+
request(:put, path, {}, options).body
|
23
|
+
end
|
24
|
+
|
25
|
+
def post(path, options = {})
|
26
|
+
request(:post, path, {}, options).body
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete(path, options = {})
|
30
|
+
request(:delete, path, options).body
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def request(method, path, query_params = {}, body_params = {})
|
36
|
+
response = connection.send(method) do |request|
|
37
|
+
request.url(path, query_params)
|
38
|
+
request.headers['Content-Type'] = 'application/json'
|
39
|
+
|
40
|
+
if client.config.api_key
|
41
|
+
request.headers['Authorization'] = "Bearer #{client.config.api_key}"
|
42
|
+
end
|
43
|
+
|
44
|
+
request.body = body_params.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
response
|
48
|
+
end
|
49
|
+
|
50
|
+
def connection
|
51
|
+
conn_opts = {
|
52
|
+
headers: { user_agent: client.config.user_agent },
|
53
|
+
url: client.config.url,
|
54
|
+
builder: middleware
|
55
|
+
}
|
56
|
+
|
57
|
+
Faraday.new(conn_opts)
|
58
|
+
end
|
59
|
+
|
60
|
+
def middleware
|
61
|
+
@middleware ||= Faraday::RackBuilder.new do |builder|
|
62
|
+
builder.request :json
|
63
|
+
|
64
|
+
builder.use FaradayMiddleware::FollowRedirects
|
65
|
+
builder.use FaradayMiddleware::Mashify, mash_class: Revolut::Mash
|
66
|
+
builder.use Revolut::Middleware::RaiseError
|
67
|
+
builder.use FaradayMiddleware::ParseJson
|
68
|
+
|
69
|
+
builder.adapter Faraday.default_adapter
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module Revolut
|
2
|
+
# Base Revolut error.
|
3
|
+
class Error < StandardError
|
4
|
+
def initialize(msg = nil)
|
5
|
+
@message = msg
|
6
|
+
end
|
7
|
+
|
8
|
+
# Returns the appropriate Revolut::Error sublcass based on status and
|
9
|
+
# response message.
|
10
|
+
#
|
11
|
+
# @param response [Faraday::Env] HTTP response.
|
12
|
+
#
|
13
|
+
# @return [Revolut::Error]
|
14
|
+
def self.from_response(response)
|
15
|
+
status = response.status.to_i
|
16
|
+
message = error_message(response)
|
17
|
+
|
18
|
+
klass = error_class(status)
|
19
|
+
klass.new(message) if klass
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.error_class(status)
|
23
|
+
case status
|
24
|
+
when 400 then Revolut::BadRequest
|
25
|
+
when 401 then Revolut::Unauthorized
|
26
|
+
when 403 then Revolut::Forbidden
|
27
|
+
when 404 then Revolut::NotFound
|
28
|
+
when 405 then Revolut::MethodNotAllowed
|
29
|
+
when 406 then Revolut::NotAcceptable
|
30
|
+
when 429 then Revolut::TooManyRequests
|
31
|
+
when 500 then Revolut::InternalServerError
|
32
|
+
when 503 then Revolut::ServiceUnavailable
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the appropriate Revolut error message based on response
|
37
|
+
#
|
38
|
+
# @param response [Faraday::Env] HTTP response.
|
39
|
+
#
|
40
|
+
# @return [String] Revolut error message.
|
41
|
+
def self.error_message(_response)
|
42
|
+
nil
|
43
|
+
# return unless response.body.is_a?(Hash)
|
44
|
+
# return unless response.body['error']
|
45
|
+
#
|
46
|
+
# message = response.body['error']['message']
|
47
|
+
# Revolut::Utils.presence(message)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Raised when Revolut returns a 400 HTTP status code
|
52
|
+
class BadRequest < Error
|
53
|
+
# Default error message.
|
54
|
+
def to_s
|
55
|
+
@message || 'Your request is invalid.'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Raised when Revolut returns a 401 HTTP status code
|
60
|
+
class Unauthorized < Error
|
61
|
+
# Default error message.
|
62
|
+
def to_s
|
63
|
+
@message || 'Your API key is wrong.'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Raised when Revolut returns a 403 HTTP status code
|
68
|
+
class Forbidden < Error
|
69
|
+
# Default error message.
|
70
|
+
def to_s
|
71
|
+
@message || 'Access to the requested resource or action is forbidden.'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Raised when Revolut returns a 404 HTTP status code
|
76
|
+
class NotFound < Error
|
77
|
+
# Default error message.
|
78
|
+
def to_s
|
79
|
+
@message || 'The requested resource could not be found.'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Raised when Revolut returns a 405 HTTP status code
|
84
|
+
class MethodNotAllowed < Error
|
85
|
+
# Default error message.
|
86
|
+
def to_s
|
87
|
+
@message || 'You tried to access an endpoint with an invalid method.'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Raised when Revolut returns a 406 HTTP status code
|
92
|
+
class NotAcceptable < Error
|
93
|
+
# Default error message.
|
94
|
+
def to_s
|
95
|
+
@message || "You requested a format that isn't JSON."
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Raised when Revolut returns a 429 HTTP status code
|
100
|
+
class TooManyRequests < Error
|
101
|
+
# Default error message.
|
102
|
+
def to_s
|
103
|
+
@message || "You're sending too many requests."
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Raised when Revolut returns a 500 HTTP status code
|
108
|
+
class InternalServerError < Error
|
109
|
+
# Default error message.
|
110
|
+
def to_s
|
111
|
+
@message || 'We had a problem with our server. Try again later.'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Raised when Revolut returns a 503 HTTP status code
|
116
|
+
class ServiceUnavailable < Error
|
117
|
+
# Default error message.
|
118
|
+
def to_s
|
119
|
+
@message || "We're temporarily offline for maintenance. Please try again later."
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/lib/revolut/mash.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Revolut
|
2
|
+
# Faraday response middleware
|
3
|
+
module Middleware
|
4
|
+
# This class raises an exception based HTTP status codes returned
|
5
|
+
# by the API.
|
6
|
+
class RaiseError < Faraday::Response::Middleware
|
7
|
+
private
|
8
|
+
|
9
|
+
def on_complete(response)
|
10
|
+
error = Revolut::Error.from_response(response)
|
11
|
+
raise error if error
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/revolut.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'revolut/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'revolut'
|
7
|
+
spec.version = Revolut::VERSION
|
8
|
+
spec.authors = ['Justas Palumickas']
|
9
|
+
spec.email = ['jpalumickas@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby wrapper for Revolut API'
|
12
|
+
spec.description = 'Ruby gem for Revolut API'
|
13
|
+
spec.homepage = 'https://github.com/jpalumickas/revolut-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added
|
18
|
+
# into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
22
|
+
end
|
23
|
+
end
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
spec.add_dependency 'faraday', '~> 0.10'
|
29
|
+
spec.add_dependency 'faraday_middleware', '~> 0.10'
|
30
|
+
spec.add_dependency 'hashie', '~> 3.5.5'
|
31
|
+
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
33
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: revolut
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justas Palumickas
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.10'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.5.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.5.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.7'
|
97
|
+
description: Ruby gem for Revolut API
|
98
|
+
email:
|
99
|
+
- jpalumickas@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/setup
|
114
|
+
- lib/revolut.rb
|
115
|
+
- lib/revolut/client.rb
|
116
|
+
- lib/revolut/clients/accounts.rb
|
117
|
+
- lib/revolut/configuration.rb
|
118
|
+
- lib/revolut/connection.rb
|
119
|
+
- lib/revolut/error.rb
|
120
|
+
- lib/revolut/mash.rb
|
121
|
+
- lib/revolut/middleware/raise_error.rb
|
122
|
+
- lib/revolut/version.rb
|
123
|
+
- revolut.gemspec
|
124
|
+
homepage: https://github.com/jpalumickas/revolut-ruby
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.7.6
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Ruby wrapper for Revolut API
|
148
|
+
test_files: []
|