transfeera 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +68 -0
- data/LICENSE.txt +21 -0
- data/README.md +33 -0
- data/Rakefile +12 -0
- data/lib/transfeera/authorization.rb +37 -0
- data/lib/transfeera/config.rb +19 -0
- data/lib/transfeera/errors/response_error.rb +16 -0
- data/lib/transfeera/request.rb +72 -0
- data/lib/transfeera/resources/default/balance.rb +10 -0
- data/lib/transfeera/resources/default/batch.rb +37 -0
- data/lib/transfeera/resources/default/transfer.rb +30 -0
- data/lib/transfeera/resources/default/webhook.rb +42 -0
- data/lib/transfeera/response.rb +38 -0
- data/lib/transfeera/version.rb +5 -0
- data/lib/transfeera.rb +81 -0
- metadata +71 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 765ff930da33d7c932bbb306c01dba0d4bf8f6d89d68a9561690c5408dd20335
|
|
4
|
+
data.tar.gz: bb069eef5cc5f9d62732901604360b93abebe543e9ad17793ac1ef4ede288750
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dc0fab8db39e501a8ab0f640c248fdb05c354dd5416cc2af80f09351f1dd0c3d23ad20671b32befd1cfd2599647c64ccbe2e7d636a9d081be43a463911060c43
|
|
7
|
+
data.tar.gz: 468e8e0fe372b8039fedbae13c0c1fce0050078b02d6c81ce8f54afcaf534681caae0942a0a1617d1c9543e471eb1ad551d454f1a2a1e15b45f1857454f76126
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in transfeera.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
gem "rake", "~> 13.0"
|
|
9
|
+
|
|
10
|
+
gem "rspec", "~> 3.0"
|
|
11
|
+
|
|
12
|
+
gem "rubocop", "~> 1.21"
|
|
13
|
+
|
|
14
|
+
gem "faraday"
|
|
15
|
+
|
|
16
|
+
gem "pry"
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
transfeera (0.1.0)
|
|
5
|
+
faraday
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
ast (2.4.2)
|
|
11
|
+
coderay (1.1.3)
|
|
12
|
+
diff-lcs (1.5.0)
|
|
13
|
+
faraday (2.3.0)
|
|
14
|
+
faraday-net_http (~> 2.0)
|
|
15
|
+
ruby2_keywords (>= 0.0.4)
|
|
16
|
+
faraday-net_http (2.0.3)
|
|
17
|
+
method_source (1.0.0)
|
|
18
|
+
parallel (1.22.1)
|
|
19
|
+
parser (3.1.2.0)
|
|
20
|
+
ast (~> 2.4.1)
|
|
21
|
+
pry (0.14.1)
|
|
22
|
+
coderay (~> 1.1)
|
|
23
|
+
method_source (~> 1.0)
|
|
24
|
+
rainbow (3.1.1)
|
|
25
|
+
rake (13.0.6)
|
|
26
|
+
regexp_parser (2.5.0)
|
|
27
|
+
rexml (3.2.5)
|
|
28
|
+
rspec (3.11.0)
|
|
29
|
+
rspec-core (~> 3.11.0)
|
|
30
|
+
rspec-expectations (~> 3.11.0)
|
|
31
|
+
rspec-mocks (~> 3.11.0)
|
|
32
|
+
rspec-core (3.11.0)
|
|
33
|
+
rspec-support (~> 3.11.0)
|
|
34
|
+
rspec-expectations (3.11.0)
|
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
+
rspec-support (~> 3.11.0)
|
|
37
|
+
rspec-mocks (3.11.1)
|
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
+
rspec-support (~> 3.11.0)
|
|
40
|
+
rspec-support (3.11.0)
|
|
41
|
+
rubocop (1.30.0)
|
|
42
|
+
parallel (~> 1.10)
|
|
43
|
+
parser (>= 3.1.0.0)
|
|
44
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
45
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
46
|
+
rexml (>= 3.2.5, < 4.0)
|
|
47
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
|
48
|
+
ruby-progressbar (~> 1.7)
|
|
49
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
50
|
+
rubocop-ast (1.18.0)
|
|
51
|
+
parser (>= 3.1.1.0)
|
|
52
|
+
ruby-progressbar (1.11.0)
|
|
53
|
+
ruby2_keywords (0.0.5)
|
|
54
|
+
unicode-display_width (2.1.0)
|
|
55
|
+
|
|
56
|
+
PLATFORMS
|
|
57
|
+
x86_64-linux
|
|
58
|
+
|
|
59
|
+
DEPENDENCIES
|
|
60
|
+
faraday
|
|
61
|
+
pry
|
|
62
|
+
rake (~> 13.0)
|
|
63
|
+
rspec (~> 3.0)
|
|
64
|
+
rubocop (~> 1.21)
|
|
65
|
+
transfeera!
|
|
66
|
+
|
|
67
|
+
BUNDLED WITH
|
|
68
|
+
2.3.12
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 João Paulo Correia
|
|
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,33 @@
|
|
|
1
|
+
# Transfeera
|
|
2
|
+
|
|
3
|
+
SDK para integração com a Transfeera (https://transfeera.com/).
|
|
4
|
+
|
|
5
|
+
**Não está completo pois não tenho mais acesso de testes para continuar o desenvolvimento**
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
10
|
+
|
|
11
|
+
$ bundle add transfeera
|
|
12
|
+
|
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
14
|
+
|
|
15
|
+
$ gem install transfeera
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
TODO: Write usage instructions here
|
|
20
|
+
|
|
21
|
+
## Development
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
26
|
+
|
|
27
|
+
## Contributing
|
|
28
|
+
|
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/joaopaulocorreia/transfeera.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
class Authorization < Transfeera::Request
|
|
3
|
+
def execute
|
|
4
|
+
response_raw = connection.post do |req|
|
|
5
|
+
req.path = path
|
|
6
|
+
req.headers = default_headers
|
|
7
|
+
req.body = body.to_json
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
response = Transfeera::Response.new(response_raw)
|
|
11
|
+
Transfeera.configuration.token = response.body[:access_token] if response.success?
|
|
12
|
+
|
|
13
|
+
response
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def path
|
|
19
|
+
Transfeera.urls[@environment][:auth]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def default_headers
|
|
23
|
+
{
|
|
24
|
+
"User-Agent": Transfeera.configuration.user_agent,
|
|
25
|
+
"Content-Type": "application/json"
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def body
|
|
30
|
+
{
|
|
31
|
+
grant_type: Transfeera.configuration.grant_type,
|
|
32
|
+
client_id: Transfeera.configuration.public_send("#{@application}_client_id"),
|
|
33
|
+
client_secret: Transfeera.configuration.public_send("#{@application}_client_secret")
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
class Config
|
|
3
|
+
attr_accessor :user_agent
|
|
4
|
+
attr_accessor :grant_type
|
|
5
|
+
attr_reader :environment
|
|
6
|
+
|
|
7
|
+
attr_accessor :contacerta_client_id
|
|
8
|
+
attr_accessor :contacerta_client_secret
|
|
9
|
+
|
|
10
|
+
attr_accessor :default_client_id
|
|
11
|
+
attr_accessor :default_client_secret
|
|
12
|
+
|
|
13
|
+
attr_accessor :token
|
|
14
|
+
|
|
15
|
+
def environment=(env)
|
|
16
|
+
@environment = env.to_sym
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
module Errors
|
|
3
|
+
class ResponseError < StandardError
|
|
4
|
+
attr_reader :error, :error_code, :message, :status_code
|
|
5
|
+
|
|
6
|
+
def initialize(error:, error_code:, message:, status_code:)
|
|
7
|
+
super
|
|
8
|
+
|
|
9
|
+
@error = error
|
|
10
|
+
@error_code = error_code
|
|
11
|
+
@message = message
|
|
12
|
+
@status_code = status_code
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'open-uri'
|
|
2
|
+
|
|
3
|
+
module Transfeera
|
|
4
|
+
class Request
|
|
5
|
+
def initialize(application)
|
|
6
|
+
@application = application
|
|
7
|
+
@environment = Transfeera.configuration.environment
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.instance
|
|
11
|
+
new(:default)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def post(uri, body: {}, headers: {})
|
|
15
|
+
response = connection.post do |req|
|
|
16
|
+
req.path = url(uri)
|
|
17
|
+
req.body = body.to_json unless body.empty?
|
|
18
|
+
req.headers = headers.merge(default_headers)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Transfeera::Response.new(response)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def put(uri, body: {})
|
|
25
|
+
response = connection.put do |req|
|
|
26
|
+
req.path = url(uri)
|
|
27
|
+
req.headers = default_headers
|
|
28
|
+
req.body = body.to_json unless body.empty?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Transfeera::Response.new(response)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def get(uri, headers: {}, params: {})
|
|
35
|
+
response = connection.get do |req|
|
|
36
|
+
req.path = url(uri)
|
|
37
|
+
req.params = params
|
|
38
|
+
req.headers = headers.merge(default_headers)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Transfeera::Response.new(response)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def delete(uri)
|
|
45
|
+
response = connection.delete do |req|
|
|
46
|
+
req.path = url(uri)
|
|
47
|
+
req.headers = default_headers
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Transfeera::Response.new(response)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def default_headers
|
|
56
|
+
{
|
|
57
|
+
Authorization: Transfeera.configuration.token,
|
|
58
|
+
"User-Agent": Transfeera.configuration.user_agent,
|
|
59
|
+
"Content-Type": 'application/json'
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def url(uri)
|
|
64
|
+
base_url = Transfeera.urls[@environment][@application]
|
|
65
|
+
URI.join(base_url, uri).to_s
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def connection
|
|
69
|
+
@connection ||= Faraday.new
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
module Default
|
|
3
|
+
class Batch < Transfeera::Request
|
|
4
|
+
def self.find(id)
|
|
5
|
+
parsed_uri = Transfeera.urls.dig(:uri, :batch, :find).sub(':id', id.to_s)
|
|
6
|
+
instance.get(parsed_uri)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.all(initial_date:, end_date:, page: 0, search: '', type: '')
|
|
10
|
+
params = {}
|
|
11
|
+
params.store :initialDate, initial_date
|
|
12
|
+
params.store :endDate, end_date
|
|
13
|
+
params.store :page, page
|
|
14
|
+
params.store :type, type unless type.empty?
|
|
15
|
+
params.store :search, search unless search.empty?
|
|
16
|
+
|
|
17
|
+
uri = Transfeera.urls.dig(:uri, :batch, :all)
|
|
18
|
+
instance.get(uri, params: params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.create(body:)
|
|
22
|
+
uri = Transfeera.urls.dig(:uri, :batch, :create)
|
|
23
|
+
instance.post(uri, body: body)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.update(id, body:)
|
|
27
|
+
uri = Transfeera.urls.dig(:uri, :batch, :update).sub(':id', id.to_s)
|
|
28
|
+
instance.put(uri, body: body)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.delete(id)
|
|
32
|
+
uri = Transfeera.urls.dig(:uri, :batch, :delete).sub(':id', id.to_s)
|
|
33
|
+
instance.delete(uri)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
module Default
|
|
3
|
+
class Transfer < Transfeera::Request
|
|
4
|
+
def self.find(id)
|
|
5
|
+
uri = Transfeera.urls.dig(:uri, :transfer, :find).sub(':id', id.to_s)
|
|
6
|
+
instance.get(uri)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.all(batch_id)
|
|
10
|
+
uri = Transfeera.urls.dig(:uri, :transfer, :all).sub(':batch_id', batch_id.to_s)
|
|
11
|
+
instance.get(uri)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.create(batch_id, body:)
|
|
15
|
+
uri = Transfeera.urls.dig(:uri, :transfer, :create).sub(':batch_id', batch_id.to_s)
|
|
16
|
+
instance.post(uri, body: body)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.update(id, batch_id, body:)
|
|
20
|
+
uri = Transfeera.urls.dig(:uri, :transfer, :update).sub(':batch_id', batch_id.to_s).sub(':id', id.to_s)
|
|
21
|
+
instance.put(uri, body: body)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.delete(id, batch_id)
|
|
25
|
+
uri = Transfeera.urls.dig(:uri, :transfer, :delete).sub(':batch_id', batch_id.to_s).sub(':id', id.to_s)
|
|
26
|
+
instance.delete(uri)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
module Default
|
|
3
|
+
class Webhook < Transfeera::Request
|
|
4
|
+
def self.all
|
|
5
|
+
uri = Transfeera.urls.dig(:uri, :webhook, :all)
|
|
6
|
+
instance.get(uri)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.create(url:, object_types:)
|
|
10
|
+
body = {
|
|
11
|
+
url: url,
|
|
12
|
+
object_types: object_types
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
uri = Transfeera.urls.dig(:uri, :webhook, :create)
|
|
16
|
+
instance.post(uri, body: body)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.update(id, body:)
|
|
20
|
+
uri = Transfeera.urls.dig(:uri, :webhook, :update).sub(':id', id.to_s)
|
|
21
|
+
instance.put(uri, body: body)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.delete(id)
|
|
25
|
+
uri = Transfeera.urls.dig(:uri, :webhook, :update).sub(':id', id.to_s)
|
|
26
|
+
instance.delete(uri)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.event_all(initial_date:, end_date:, page: 0, delivered: '', object_type: '')
|
|
30
|
+
params = {}
|
|
31
|
+
params.store :initialDate, initial_date
|
|
32
|
+
params.store :endDate, end_date
|
|
33
|
+
params.store :page, page
|
|
34
|
+
params.store :objectType, object_type unless object_type.empty?
|
|
35
|
+
params.store :delivered, delivered unless delivered.empty?
|
|
36
|
+
|
|
37
|
+
uri = Transfeera.urls.dig(:uri, :webhook, :event_all)
|
|
38
|
+
instance.get(uri, params: params)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Transfeera
|
|
2
|
+
class Response
|
|
3
|
+
def initialize(response)
|
|
4
|
+
@response = response
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def headers
|
|
8
|
+
@response.headers
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def body
|
|
12
|
+
@body ||= JSON.parse(@response.body, symbolize_names: true)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def status
|
|
16
|
+
@response.status
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success?
|
|
20
|
+
@response.success?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def error
|
|
24
|
+
return if @response.success?
|
|
25
|
+
|
|
26
|
+
Transfeera::Errors::ResponseError.new(
|
|
27
|
+
error: body[:error],
|
|
28
|
+
error_code: body[:error_code],
|
|
29
|
+
message: body[:message],
|
|
30
|
+
status_code: body[:statusCode]
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def default_response
|
|
35
|
+
@response
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/transfeera.rb
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
require_relative 'transfeera/version'
|
|
6
|
+
require_relative 'transfeera/config'
|
|
7
|
+
require_relative 'transfeera/request'
|
|
8
|
+
require_relative 'transfeera/authorization'
|
|
9
|
+
require_relative 'transfeera/response'
|
|
10
|
+
|
|
11
|
+
require_relative 'transfeera/errors/response_error'
|
|
12
|
+
|
|
13
|
+
require_relative 'transfeera/resources/default/batch'
|
|
14
|
+
require_relative 'transfeera/resources/default/webhook'
|
|
15
|
+
require_relative 'transfeera/resources/default/transfer'
|
|
16
|
+
require_relative 'transfeera/resources/default/balance'
|
|
17
|
+
|
|
18
|
+
module Transfeera
|
|
19
|
+
def self.urls
|
|
20
|
+
{
|
|
21
|
+
production: {
|
|
22
|
+
auth: 'https://login-api.transfeera.com/authorization',
|
|
23
|
+
default: 'https://api.transfeera.com',
|
|
24
|
+
contacerta: 'https://contacerta-api.transfeera.com'
|
|
25
|
+
},
|
|
26
|
+
sandbox: {
|
|
27
|
+
auth: 'https://login-api-sandbox.transfeera.com/authorization',
|
|
28
|
+
default: 'https://api-sandbox.transfeera.com',
|
|
29
|
+
contacerta: 'https://contacerta-api-sandbox.transfeera.com'
|
|
30
|
+
},
|
|
31
|
+
uri: {
|
|
32
|
+
webhook: {
|
|
33
|
+
all: 'webhook',
|
|
34
|
+
create: 'webhook',
|
|
35
|
+
update: 'webhook/:id',
|
|
36
|
+
delete: 'webhook/:id',
|
|
37
|
+
event_all: 'webhook/event'
|
|
38
|
+
# event_retry: 'webhook/event/retry'
|
|
39
|
+
},
|
|
40
|
+
batch: {
|
|
41
|
+
find: 'batch/:id',
|
|
42
|
+
all: 'batch',
|
|
43
|
+
create: 'batch',
|
|
44
|
+
delete: 'batch/:id',
|
|
45
|
+
update: 'batch/:id'
|
|
46
|
+
# close: 'batch/:id/close'
|
|
47
|
+
},
|
|
48
|
+
transfer: {
|
|
49
|
+
all: 'batch/:batch_id/transfer',
|
|
50
|
+
create: 'batch/:batch_id/transfer',
|
|
51
|
+
find: 'transfer/:id',
|
|
52
|
+
delete: 'batch/:batch_id/transfer/:id',
|
|
53
|
+
update: 'batch/:batch_id/transfer/:id'
|
|
54
|
+
},
|
|
55
|
+
balance: {
|
|
56
|
+
find: 'statement/balance'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.configuration
|
|
63
|
+
@configuration ||= Transfeera::Config.new
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.configure
|
|
67
|
+
yield configuration
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Transfeera.configure do |config|
|
|
72
|
+
config.user_agent = ENV['TRANSFEERA_USER_AGENT']
|
|
73
|
+
config.grant_type = ENV['TRANSFEERA_GRANT_TYPE']
|
|
74
|
+
config.environment = ENV['TRANSFEERA_ENVIRONMENT']
|
|
75
|
+
|
|
76
|
+
config.default_client_id = ENV['TRANSFEERA_DEFAULT_CLIENT_ID']
|
|
77
|
+
config.default_client_secret = ENV['TRANSFEERA_DEFAULT_CLIENT_SECRET']
|
|
78
|
+
|
|
79
|
+
config.contacerta_client_id = ENV['TRANSFEERA_CONTACERTA_CLIENT_ID']
|
|
80
|
+
config.contacerta_client_secret = ENV['TRASNFEERA_CONTACERTA_CLIENT_SECRET']
|
|
81
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: transfeera
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- João Paulo Correia
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
email:
|
|
27
|
+
- ijoohn@hotmail.com
|
|
28
|
+
executables: []
|
|
29
|
+
extensions: []
|
|
30
|
+
extra_rdoc_files: []
|
|
31
|
+
files:
|
|
32
|
+
- ".rspec"
|
|
33
|
+
- ".rubocop.yml"
|
|
34
|
+
- CHANGELOG.md
|
|
35
|
+
- Gemfile
|
|
36
|
+
- Gemfile.lock
|
|
37
|
+
- LICENSE.txt
|
|
38
|
+
- README.md
|
|
39
|
+
- Rakefile
|
|
40
|
+
- lib/transfeera.rb
|
|
41
|
+
- lib/transfeera/authorization.rb
|
|
42
|
+
- lib/transfeera/config.rb
|
|
43
|
+
- lib/transfeera/errors/response_error.rb
|
|
44
|
+
- lib/transfeera/request.rb
|
|
45
|
+
- lib/transfeera/resources/default/balance.rb
|
|
46
|
+
- lib/transfeera/resources/default/batch.rb
|
|
47
|
+
- lib/transfeera/resources/default/transfer.rb
|
|
48
|
+
- lib/transfeera/resources/default/webhook.rb
|
|
49
|
+
- lib/transfeera/response.rb
|
|
50
|
+
- lib/transfeera/version.rb
|
|
51
|
+
licenses:
|
|
52
|
+
- MIT
|
|
53
|
+
metadata: {}
|
|
54
|
+
rdoc_options: []
|
|
55
|
+
require_paths:
|
|
56
|
+
- lib
|
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 2.6.0
|
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - ">="
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '0'
|
|
67
|
+
requirements: []
|
|
68
|
+
rubygems_version: 3.6.9
|
|
69
|
+
specification_version: 4
|
|
70
|
+
summary: Transfeera
|
|
71
|
+
test_files: []
|