revolut 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93a7c7c932fddd54aa5d9efd549e656a9774a85d50b0c9e70201e360ab286106
4
- data.tar.gz: 7342d283b3478a8e9992ca5aa95686a2c07c196d0f686205a7c0ffd722280d8e
3
+ metadata.gz: d0b1c2d729d0334087101570e662a4ce9c31e83876be7d7ae713753d931264a9
4
+ data.tar.gz: 385d36c85b4767113be2b02375cf76631a8b3ab11c4d989599bf4c78d0599a7d
5
5
  SHA512:
6
- metadata.gz: a9f184078e3ab12b7097e07029c4b21c1b1da32e3c0c320082d5288cea2d852ffb7a910e7af9073184d32ec120a6c2b6d2428ccc99b9edeadc497cbaf9ec3137
7
- data.tar.gz: 95d50abe6412d7af520722fa112d0c1da9b6c93d8ad0be07c853271340e6bd5e12fb1dbd7552af36dfa4701baa02f0a7e22aa85c9d6027e5b98d6dab7066885d
6
+ metadata.gz: 858a2c4d301a6e70dd934c4e9dede07b916eaab3194bdbe2124c3e6729fffcd58268f7b40af097a7630050d9556f43fe1e9afe052da304ef66cc582bf96071b7
7
+ data.tar.gz: 182cc741f02f6cb2a21bbb28d1b31d0b43324d64dff047a58e1e08df603ebf97efec8d78929cb04cadc88f4bec444fb294eccf154b338265e48bff87e6f2048c
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.1
2
+ TargetRubyVersion: 2.3
3
3
 
4
4
  Style/DoubleNegation:
5
5
  Exclude:
data/.travis.yml CHANGED
@@ -9,16 +9,15 @@ env:
9
9
 
10
10
  language: ruby
11
11
  rvm:
12
- - 2.1.0
13
- - 2.2.0
14
12
  - 2.3.0
15
13
  - 2.4.0
16
14
  - 2.5.0
15
+ - 2.6.0
17
16
  - ruby-head
18
17
 
19
18
  before_install:
20
- - gem install bundler -v 1.16.2
21
19
  - gem update --system
20
+ - gem install bundler
22
21
 
23
22
  before_script:
24
23
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Justas Palumickas
3
+ Copyright (c) 2019 Justas Palumickas
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  A Ruby gem which helps to communicate with [Revolut Business][revolut] API.
4
4
 
5
+ [![Gem Version](https://img.shields.io/gem/v/revolut.svg?style=flat-square)][rubygems]
6
+ [![Build Status](https://img.shields.io/travis/jpalumickas/revolut-ruby.svg?style=flat-square)][travis]
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -55,11 +58,10 @@ Revolut.accounts
55
58
  This library aims to support and is [tested against][travis] the following Ruby
56
59
  implementations:
57
60
 
58
- * Ruby 2.1.0
59
- * Ruby 2.2.0
60
61
  * Ruby 2.3.0
61
62
  * Ruby 2.4.0
62
63
  * Ruby 2.5.0
64
+ * Ruby 2.6.0
63
65
 
64
66
  ## Development
65
67
 
@@ -79,6 +81,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
79
81
 
80
82
  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/jpalumickas/revolut-ruby/blob/master/CODE_OF_CONDUCT.md).
81
83
 
84
+ [rubygems]: https://rubygems.org/gems/revolut
82
85
  [travis]: https://travis-ci.org/jpalumickas/revolut-ruby
83
86
 
84
87
  [revolut]: https://www.revolut.com
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'revolut'
data/lib/revolut.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'revolut/version'
2
4
  require 'revolut/utils'
3
5
  require 'revolut/error'
@@ -14,6 +16,7 @@ module Revolut
14
16
 
15
17
  def method_missing(method_name, *args, &block)
16
18
  return super unless client.respond_to?(method_name)
19
+
17
20
  client.send(method_name, *args, &block)
18
21
  end
19
22
 
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'revolut/connection'
2
4
  require 'revolut/configuration'
3
5
 
4
6
  require 'revolut/clients/accounts'
5
7
  require 'revolut/clients/counterparties'
8
+ require 'revolut/clients/payment_drafts'
6
9
  require 'revolut/clients/payments'
7
10
  require 'revolut/clients/webhooks'
8
11
 
@@ -11,6 +14,7 @@ module Revolut
11
14
  class Client
12
15
  include Revolut::Clients::Accounts
13
16
  include Revolut::Clients::Counterparties
17
+ include Revolut::Clients::PaymentDrafts
14
18
  include Revolut::Clients::Payments
15
19
  include Revolut::Clients::Webhooks
16
20
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  module Clients
3
5
  # Revolut Accounts
@@ -21,6 +23,17 @@ module Revolut
21
23
  def account(id)
22
24
  connection.get("accounts/#{id}")
23
25
  end
26
+
27
+ # Get account bank details.
28
+ #
29
+ # @see https://revolutdev.github.io/business-api/#get-account-details
30
+ #
31
+ # @param id [UUID] Id of account.
32
+ #
33
+ # @return [Hash] Response from API.
34
+ def account_details(id)
35
+ connection.get("accounts/#{id}/bank-details")
36
+ end
24
37
  end
25
38
  end
26
39
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  module Clients
3
5
  # Revolut Accounts
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Revolut
4
+ module Clients
5
+ # Revolut Payment Drafts
6
+ module PaymentDrafts
7
+ # Get payment drafts
8
+ #
9
+ # @see https://revolutdev.github.io/business-api/#get-payment-drafts
10
+ #
11
+ # @return [Hash] Response from API.
12
+ def payment_drafts
13
+ connection.get('payment-drafts')
14
+ end
15
+
16
+ # Get payment draft
17
+ #
18
+ # @see https://revolutdev.github.io/business-api/#get-payment-draft-by-id
19
+ #
20
+ # @param id [UUID] Id of transaction.
21
+ #
22
+ # @return [Hash] Response from API.
23
+ def payment_draft(id)
24
+ connection.get("payment-drafts/#{id}")
25
+ end
26
+
27
+ # Create payment draft
28
+ #
29
+ # @see https://revolutdev.github.io/business-api/#create-payment-draft
30
+ #
31
+ # @param params [Hash] A customizable set of params.
32
+ #
33
+ # @return [Hash] Response from API.
34
+ def create_payment_draft(params = {})
35
+ connection.post('payment-drafts', params)
36
+ end
37
+
38
+ # Delete payment draft
39
+ #
40
+ # @see https://revolutdev.github.io/business-api/#delete-payment-draft
41
+ #
42
+ # @param id [UUID] Id of transaction.
43
+ #
44
+ # @return [Hash] Response from API.
45
+ def delete_payment_draft(id)
46
+ connection.delete("payment-drafts/#{id}")
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  module Clients
3
- # Revolut Accounts
5
+ # Revolut Payments
4
6
  module Payments
5
7
  # Transfer payment
6
8
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  module Clients
3
5
  # Revolut Webhooks
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  # A class responsible for all configurations.
3
5
  class Configuration
4
- PRODUCTION_API_ENDPOINT = 'https://b2b.revolut.com/api/1.0'.freeze
5
- SANDBOX_API_ENDPOINT = 'https://sandbox-b2b.revolut.com/api/1.0'.freeze
6
+ PRODUCTION_API_ENDPOINT = 'https://b2b.revolut.com/api/1.0'
7
+ SANDBOX_API_ENDPOINT = 'https://sandbox-b2b.revolut.com/api/1.0'
6
8
  AVAILABLE_ENVIRONMENTS = %i[production sandbox].freeze
7
9
  DEFAULT_ENVIRONMENT = :production
8
- USER_AGENT = "Revolut Ruby v#{Revolut::VERSION}".freeze
10
+ USER_AGENT = "Revolut Ruby v#{Revolut::VERSION}"
9
11
 
10
12
  attr_accessor :api_key
11
13
  attr_writer :url, :user_agent
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'faraday_middleware'
3
5
  require 'json'
data/lib/revolut/error.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  # Base Revolut error.
3
5
  class Error < StandardError
@@ -21,7 +23,7 @@ module Revolut
21
23
  message = error_message(response)
22
24
 
23
25
  klass = error_class(status)
24
- klass.new(message) if klass
26
+ klass&.new(message)
25
27
  end
26
28
 
27
29
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
@@ -47,8 +49,10 @@ module Revolut
47
49
  # @return [String] Revolut error message.
48
50
  def self.error_message(response)
49
51
  return unless response.body.is_a?(Hash)
52
+
50
53
  message = response.body['message']
51
54
  return unless message
55
+
52
56
  Revolut::Utils.presence(message)
53
57
  end
54
58
  end
data/lib/revolut/mash.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hashie/mash'
2
4
 
3
5
  module Revolut
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  # Faraday response middleware
3
5
  module Middleware
data/lib/revolut/utils.rb CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
4
  # Custom utilities
3
5
  module Utils
4
- BLANK_RE = /\A[[:space:]]*\z/
6
+ BLANK_RE = /\A[[:space:]]*\z/.freeze
5
7
 
6
8
  class << self
7
9
  def blank?(obj)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Revolut
2
- VERSION = '0.3.0'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
data/revolut.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'revolut/version'
@@ -17,7 +19,7 @@ Gem::Specification.new do |spec|
17
19
  spec.metadata = {
18
20
  'bug_tracker_uri' => "#{github_repo_url}/issues",
19
21
  'source_code_uri' => "#{github_repo_url}/tree/v#{Revolut::VERSION}",
20
- 'changelog_uri' => "#{github_repo_url}/releases/tag/v#{Revolut::VERSION}"
22
+ 'changelog_uri' => "#{github_repo_url}/releases/tag/v#{Revolut::VERSION}"
21
23
  }
22
24
 
23
25
  # Specify which files should be added to the gem when it is released.
@@ -31,16 +33,17 @@ Gem::Specification.new do |spec|
31
33
  spec.bindir = 'exe'
32
34
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
35
  spec.require_paths = ['lib']
36
+ spec.required_ruby_version = '>= 2.3.0'
34
37
 
35
38
  spec.add_dependency 'faraday', '~> 0.10'
36
39
  spec.add_dependency 'faraday_middleware', '~> 0.10'
37
- spec.add_dependency 'hashie', '~> 3.5.5'
40
+ spec.add_dependency 'hashie', '>= 3.5.5'
38
41
 
39
- spec.add_development_dependency 'bundler', '~> 1.16'
40
- spec.add_development_dependency 'pry', '~> 0.11'
41
- spec.add_development_dependency 'rake', '~> 10.0'
42
- spec.add_development_dependency 'rspec', '~> 3.7'
43
- spec.add_development_dependency 'rubocop', '~> 0.56'
42
+ spec.add_development_dependency 'bundler', '~> 2.0'
43
+ spec.add_development_dependency 'pry', '~> 0.12'
44
+ spec.add_development_dependency 'rake', '~> 12.3'
45
+ spec.add_development_dependency 'rspec', '~> 3.8'
46
+ spec.add_development_dependency 'rubocop', '~> 0.66'
44
47
  spec.add_development_dependency 'simplecov', '~> 0.16'
45
- spec.add_development_dependency 'webmock', '~> 3.4'
48
+ spec.add_development_dependency 'webmock', '~> 3.5'
46
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revolut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justas Palumickas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-29 00:00:00.000000000 Z
11
+ date: 2019-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: hashie
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.5.5
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.5.5
55
55
  - !ruby/object:Gem::Dependency
@@ -58,70 +58,70 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.16'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.16'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.11'
75
+ version: '0.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.11'
82
+ version: '0.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '12.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '12.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.7'
103
+ version: '3.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.7'
110
+ version: '3.8'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.56'
117
+ version: '0.66'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.56'
124
+ version: '0.66'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: simplecov
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.4'
145
+ version: '3.5'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '3.4'
152
+ version: '3.5'
153
153
  description: Ruby gem for Revolut API
154
154
  email:
155
155
  - jpalumickas@gmail.com
@@ -172,6 +172,7 @@ files:
172
172
  - lib/revolut/client.rb
173
173
  - lib/revolut/clients/accounts.rb
174
174
  - lib/revolut/clients/counterparties.rb
175
+ - lib/revolut/clients/payment_drafts.rb
175
176
  - lib/revolut/clients/payments.rb
176
177
  - lib/revolut/clients/webhooks.rb
177
178
  - lib/revolut/configuration.rb
@@ -187,8 +188,8 @@ licenses:
187
188
  - MIT
188
189
  metadata:
189
190
  bug_tracker_uri: https://github.com/jpalumickas/revolut-ruby/issues
190
- source_code_uri: https://github.com/jpalumickas/revolut-ruby/tree/v0.3.0
191
- changelog_uri: https://github.com/jpalumickas/revolut-ruby/releases/tag/v0.3.0
191
+ source_code_uri: https://github.com/jpalumickas/revolut-ruby/tree/v1.0.0
192
+ changelog_uri: https://github.com/jpalumickas/revolut-ruby/releases/tag/v1.0.0
192
193
  post_install_message:
193
194
  rdoc_options: []
194
195
  require_paths:
@@ -197,15 +198,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
198
  requirements:
198
199
  - - ">="
199
200
  - !ruby/object:Gem::Version
200
- version: '0'
201
+ version: 2.3.0
201
202
  required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  requirements:
203
204
  - - ">="
204
205
  - !ruby/object:Gem::Version
205
206
  version: '0'
206
207
  requirements: []
207
- rubyforge_project:
208
- rubygems_version: 2.7.6
208
+ rubygems_version: 3.0.2
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Ruby wrapper for Revolut API