tide-api 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9ec2c251ba56f87e5ccbc4d970ec642f52ca04d98fcb739da167baa200c9436b
4
+ data.tar.gz: 1690057695f361604045fcc386bc2538a85add4f2d0db8549d6650a5d93d212d
5
+ SHA512:
6
+ metadata.gz: f47db1720338256d0b8c9019aca314e2f18b72d97360b9ca6c1af6114983bbeccefb53c3153984371712026691287b3fc0dce657e02a6d89da490a492e04863b
7
+ data.tar.gz: a79c51198faa008060a14385a6934cb5542d73c402e06f3fe6736301ca91bd4aa864a274ce657ef168748e3978d7cb72be40b3a237b9d6e3101c6fbed93d6061
data/.editorconfig ADDED
@@ -0,0 +1,11 @@
1
+ # Unix-style newlines with a newline ending every file
2
+ [*]
3
+ end_of_line = lf
4
+ insert_final_newline = true
5
+ max_line_length = 120
6
+ trim_trailing_whitespace = true
7
+
8
+ # 2 space indentation
9
+ [*.rb]
10
+ indent_style = space
11
+ indent_size = 2
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /measurements/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ # Let Bundler resolve the dependency versions using the gemspec only
15
+ Gemfile.lock
data/.overcommit.yml ADDED
@@ -0,0 +1,33 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/sds/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+
18
+ PreCommit:
19
+ RuboCop:
20
+ enabled: true
21
+ on_warn: fail # Treat all warnings as failures
22
+
23
+ # TrailingWhitespace:
24
+ # enabled: true
25
+ # exclude:
26
+ # - '**/db/structure.sql' # Ignore trailing whitespace in generated files
27
+ #
28
+ #PostCheckout:
29
+ # ALL: # Special hook name that customizes all hooks of this type
30
+ # quiet: true # Change all post-checkout hooks to only display output on failure
31
+ #
32
+ # IndexTags:
33
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,33 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+
6
+ # ---------------------- Layout ----------------------
7
+
8
+ Layout/ExtraSpacing:
9
+ Exclude:
10
+ - lib/tide/api/transaction.rb
11
+
12
+ # ---------------------- Metrics ----------------------
13
+
14
+ Metrics/BlockLength:
15
+ Exclude:
16
+ - spec/**/*_spec.rb
17
+ - tide-api.gemspec
18
+
19
+ Metrics/LineLength:
20
+ Max: 120
21
+
22
+ # ----------------------- RSpec -----------------------
23
+
24
+ RSpec/ExampleLength:
25
+ Enabled: false
26
+
27
+ # ----------------------- Style -----------------------
28
+
29
+ Style/FrozenStringLiteralComment:
30
+ Enabled: false
31
+
32
+ Style/NumericLiterals:
33
+ Enabled: false
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.6.3
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+
8
+ before_install: gem install bundler -v 1.17.2
9
+
10
+ before_script:
11
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
+ - chmod +x ./cc-test-reporter
13
+ - ./cc-test-reporter before-build
14
+
15
+ script:
16
+ - bundle exec bundle-audit
17
+ - bundle exec rspec
18
+ - bundle exec rubocop
19
+ - bundle exec rake yard:junk
20
+
21
+ after_script:
22
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --plugin junk
data/.yardstick.yml ADDED
@@ -0,0 +1,29 @@
1
+ threshold: 100
2
+ rules:
3
+ ApiTag::Presence:
4
+ enabled: false
5
+ exclude: []
6
+ ApiTag::Inclusion:
7
+ enabled: false
8
+ exclude: []
9
+ ApiTag::ProtectedMethod:
10
+ enabled: true
11
+ exclude: []
12
+ ApiTag::PrivateMethod:
13
+ enabled: true
14
+ exclude: []
15
+ ExampleTag:
16
+ enabled: false
17
+ exclude:
18
+ ReturnTag:
19
+ enabled: false
20
+ Summary::Presence:
21
+ enabled: false
22
+ Summary::Length:
23
+ enabled: false
24
+ Summary::Delimiter:
25
+ enabled: false
26
+ exclude: []
27
+ Summary::SingleLine:
28
+ enabled: false
29
+ exclude: []
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.2.0] - 2019-06-30
8
+ ### Added
9
+ - Initial core business logic
10
+
11
+ ## [0.1.0] - 2019-05-26
12
+ ### Added
13
+ - Codebase maintenance tools
@@ -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 wilson.dsigns@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,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in tide-api.gemspec
6
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,20 @@
1
+ guard :bundler do
2
+ watch('tide-api.gemspec')
3
+ end
4
+
5
+ guard :bundler_audit, run_on_start: true do
6
+ watch('Gemfile.lock')
7
+ end
8
+
9
+ group :tests do
10
+ guard :rspec, all_on_start: true, cmd: 'COVERAGE=false bundle exec rspec --format progress' do
11
+ watch(%r{^spec/.+_spec\.rb$})
12
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
13
+ watch('spec/spec_helper.rb') { 'spec' }
14
+ end
15
+ end
16
+
17
+ guard :rubocop do
18
+ watch(/.+\.rb$/)
19
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
20
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Wilson Silva
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,88 @@
1
+ # Tide::API
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/tide-api.svg)](https://badge.fury.io/rb/tide-api)
4
+ [![Build Status](https://travis-ci.org/wilsonsilva/tide-api.svg?branch=master)](https://travis-ci.org/wilsonsilva/tide-api)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/15feb9e5e8d4faeb9921/maintainability)](https://codeclimate.com/github/wilsonsilva/tide-api/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/15feb9e5e8d4faeb9921/test_coverage)](https://codeclimate.com/github/wilsonsilva/tide-api/test_coverage)
7
+ [![Security](https://hakiri.io/github/wilsonsilva/tide-api/master.svg)](https://hakiri.io/github/wilsonsilva/tide-api/master)
8
+ [![Inline docs](http://inch-ci.org/github/wilsonsilva/tide-api.svg?branch=master)](http://inch-ci.org/github/wilsonsilva/tide-api)
9
+
10
+ Ruby interface to Tide's bank RESTful API.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'tide-api'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install tide-api
27
+
28
+ ## Usage
29
+
30
+ Tide uses `Access Tokens` to allow access to the API via OAuth 2. You can find more about authentication on
31
+ [the official API reference](https://tideapi.github.io/docs/#authentication).
32
+
33
+ Follow the documentation until you have an `Authorization Grant Code`. I'm developing a command-line utility to
34
+ automate the authentication process.
35
+
36
+ ```ruby
37
+ require 'tide/api'
38
+
39
+ client = Tide::API::Client.new
40
+
41
+ # Authentication
42
+ auth_grant_code = 'CBCAzT2L6A5oFZyE78R2TtYYtaJ60er0'
43
+ tokens = client.fetch_tokens(auth_grant_code)
44
+
45
+ # Fetching companies
46
+ companies = client.fetch_companies
47
+
48
+ # Fetch accounts
49
+ accounts = client.fetch_accounts(companies.first.id)
50
+
51
+ # Fetch transactions
52
+ transactions = client.fetch_transactions(accounts.first.id)
53
+ ```
54
+
55
+ ## Development
56
+
57
+ After checking out the repo, run `bin/setup` to install dependencies, configure git hooks and create support files.
58
+
59
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
60
+
61
+ The health and maintainability of the codebase is ensured through a set of
62
+ Rake tasks to test, lint and audit the gem for security vulnerabilities and documentation:
63
+
64
+ ```
65
+ rake bundle:audit # Checks for vulnerable versions of gems
66
+ rake qa # Test, lint and perform security and documentation audits
67
+ rake rubocop # Lint the codebase with RuboCop
68
+ rake rubocop:auto_correct # Auto-correct RuboCop offenses
69
+ rake spec # Run RSpec code examples
70
+ rake verify_measurements # Verify that yardstick coverage is at least 100%
71
+ rake yard # Generate YARD Documentation
72
+ rake yard:junk # Check the junk in your YARD Documentation
73
+ rake yardstick_measure # Measure docs in lib/**/*.rb with yardstick
74
+ ```
75
+ ## Contributing
76
+
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/tide-api.
78
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected
79
+ to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
80
+
81
+ ## License
82
+
83
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
84
+
85
+ ## Code of Conduct
86
+
87
+ Everyone interacting in the Tide::API project’s codebases, issue trackers, chat rooms and mailing lists
88
+ is expected to follow the [code of conduct](https://github.com/wilsonsilva/tide-api/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'bundler/audit/task'
3
+ require 'rspec/core/rake_task'
4
+ require 'rubocop/rake_task'
5
+ require 'yaml'
6
+ require 'yard/rake/yardoc_task'
7
+ require 'yard-junk/rake'
8
+ require 'yardstick/rake/measurement'
9
+ require 'yardstick/rake/verify'
10
+
11
+ yardstick_options = YAML.load_file('.yardstick.yml')
12
+
13
+ Bundler::Audit::Task.new
14
+ RuboCop::RakeTask.new
15
+ RSpec::Core::RakeTask.new(:spec)
16
+ YARD::Rake::YardocTask.new
17
+ YardJunk::Rake.define_task
18
+ Yardstick::Rake::Measurement.new(:yardstick_measure, yardstick_options)
19
+ Yardstick::Rake::Verify.new
20
+
21
+ task default: :spec
22
+
23
+ # Remove the report on rake clobber
24
+ CLEAN.include('measurements', 'doc', '.yardoc', 'tmp')
25
+
26
+ # Delete these files and folders when running rake clobber.
27
+ CLOBBER.include('coverage', '.rspec_status')
28
+
29
+ desc 'Run spec with coverage'
30
+ task :coverage do
31
+ ENV['COVERAGE'] = 'true'
32
+ Rake::Task['spec'].execute
33
+ `open coverage/index.html`
34
+ end
35
+
36
+ desc 'Test, lint and perform security and documentation audits'
37
+ task qa: %w[spec rubocop yard:junk verify_measurements bundle:audit]
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'tide/api'
5
+ require 'pry'
6
+
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ if ! which overcommit >/dev/null; then
9
+ echo 'The gem overcommit is not installed. It is necessary to lint the git history through git hooks.'
10
+ echo 'Please install overcommit and run this script again.'
11
+ exit 1
12
+ fi
13
+
14
+ overcommit --install
@@ -0,0 +1,66 @@
1
+ module Tide
2
+ module API
3
+ # A bank account
4
+ class Account < Dry::Struct::Value
5
+ # Tide's unique account ID.
6
+ #
7
+ # @return [Integer]
8
+ #
9
+ attribute :account_id, Types::Strict::Integer
10
+
11
+ # Tide's unique company ID.
12
+ #
13
+ # @return [Integer]
14
+ #
15
+ attribute :company_id, Types::Strict::Integer
16
+
17
+ # The company's bank account number.
18
+ #
19
+ # @return [String]
20
+ #
21
+ attribute :account_number, Types::Strict::String
22
+
23
+ # Account type.
24
+ #
25
+ # @return [String]
26
+ #
27
+ attribute :name, Types::Strict::String
28
+
29
+ # Account balance.
30
+ #
31
+ # @return [BigDecimal]
32
+ #
33
+ attribute :balance, Types::Params::Decimal
34
+
35
+ # Available account balance.
36
+ #
37
+ # @return [BigDecimal]
38
+ #
39
+ attribute :available_balance, Types::Params::Decimal
40
+
41
+ # ISO 4217 currency code.
42
+ #
43
+ # @return [String]
44
+ #
45
+ attribute :currency_code, Types::Strict::String
46
+
47
+ # Sort code of the bank account.
48
+ #
49
+ # @return [String]
50
+ #
51
+ attribute :sort_code, Types::Strict::String
52
+
53
+ # Date of creation of the account.
54
+ #
55
+ # @return [DateTime]
56
+ #
57
+ attribute :iso_created_on, Types::Params::DateTime
58
+
59
+ # Date when the account was last updated.
60
+ #
61
+ # @return [DateTime]
62
+ #
63
+ attribute :iso_updated_on, Types::Params::DateTime
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,103 @@
1
+ require 'tide/api/http_client'
2
+ require 'tide/api/mapper'
3
+ require 'tide/api/account'
4
+ require 'tide/api/transaction'
5
+ require 'tide/api/company'
6
+ require 'tide/api/error'
7
+ require 'tide/api/tokens'
8
+
9
+ module Tide
10
+ module API
11
+ # Main interface to Tide API
12
+ class Client
13
+ # Base path to Tide API version 1
14
+ BASE_PATH = 'https://api.tide.co/tide-backend/rest/api/v1'.freeze
15
+
16
+ # Instantiates an API client
17
+ #
18
+ # @param [Mapper] mapper Converts JSON responses into concrete instances of Tide API concepts
19
+ # @param [HTTPClient] http_client Performs HTTP requests
20
+ #
21
+ def initialize(mapper: Mapper.new, http_client: HTTPClient.new)
22
+ @mapper = mapper
23
+ @http_client = http_client
24
+ end
25
+
26
+ # Exchanges an auth nonce for OAuth2 access and refresh tokens.
27
+ #
28
+ # @param [String] auth_grant_code An authentication nonce provided by the OAuth2 redirect callback.
29
+ #
30
+ def fetch_tokens(auth_grant_code)
31
+ response = http_client.get("#{BASE_PATH}/oauth2/tokens?code=#{auth_grant_code}")
32
+
33
+ return build_error_from(response) if response.error?
34
+
35
+ build_tokens_from(response).tap do |tokens|
36
+ http_client.refresh_token = tokens.refresh_token
37
+ http_client.access_token = tokens.access_token
38
+ end
39
+ end
40
+
41
+ # Retrieves all companies of the authenticated user
42
+ #
43
+ # @return [Error|Array<Company>] A list of companies
44
+ #
45
+ def fetch_companies
46
+ response = http_client.get("#{BASE_PATH}/external/companies")
47
+ response.error? && build_error_from(response) || build_companies_from(response)
48
+ end
49
+
50
+ # Retrieves all accounts of a given company
51
+ #
52
+ # @param [Integer] company_id Tide's internal ID of the company
53
+ #
54
+ # @return [Error|Array<Transaction>]
55
+ #
56
+ def fetch_accounts(company_id)
57
+ response = http_client.get("#{BASE_PATH}/external/companies/#{company_id}/accounts")
58
+ response.error? && build_error_from(response) || build_accounts_from(response)
59
+ end
60
+
61
+ # Retrieves all transactions of a given account
62
+ #
63
+ # @param [Integer] account_id Tide's internal ID of the account
64
+ #
65
+ # @return [Error|Array<Transaction>]
66
+ #
67
+ def fetch_transactions(account_id)
68
+ response = http_client.get("#{BASE_PATH}/external/accounts/#{account_id}/transactions")
69
+ response.error? && build_error_from(response) || build_transactions_from(response)
70
+ end
71
+
72
+ private
73
+
74
+ # @api private
75
+ attr_reader :mapper, :http_client
76
+
77
+ # @api private
78
+ def build_tokens_from(response)
79
+ mapper.map_one(response.payload, Tokens)
80
+ end
81
+
82
+ # @api private
83
+ def build_companies_from(response)
84
+ mapper.map(response.payload, Company)
85
+ end
86
+
87
+ # @api private
88
+ def build_transactions_from(response)
89
+ mapper.map(response.payload, Transaction)
90
+ end
91
+
92
+ # @api private
93
+ def build_accounts_from(response)
94
+ mapper.map(response.payload, Account)
95
+ end
96
+
97
+ # @api private
98
+ def build_error_from(response)
99
+ mapper.map_one(response.payload, Error)
100
+ end
101
+ end
102
+ end
103
+ end