unit-ruby 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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +15 -0
  5. data/.travis.yml +7 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +78 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +51 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/unit-ruby/application_form.rb +14 -0
  15. data/lib/unit-ruby/atm_location.rb +41 -0
  16. data/lib/unit-ruby/deposit_account.rb +28 -0
  17. data/lib/unit-ruby/individual_application.rb +33 -0
  18. data/lib/unit-ruby/individual_customer.rb +28 -0
  19. data/lib/unit-ruby/individual_debit_card.rb +25 -0
  20. data/lib/unit-ruby/institution.rb +19 -0
  21. data/lib/unit-ruby/types/address.rb +32 -0
  22. data/lib/unit-ruby/types/application_form_prefill.rb +61 -0
  23. data/lib/unit-ruby/types/application_form_settings_override.rb +57 -0
  24. data/lib/unit-ruby/types/array.rb +21 -0
  25. data/lib/unit-ruby/types/boolean.rb +16 -0
  26. data/lib/unit-ruby/types/coordinates.rb +23 -0
  27. data/lib/unit-ruby/types/date.rb +11 -0
  28. data/lib/unit-ruby/types/date_time.rb +11 -0
  29. data/lib/unit-ruby/types/decimal.rb +9 -0
  30. data/lib/unit-ruby/types/float.rb +9 -0
  31. data/lib/unit-ruby/types/full_name.rb +23 -0
  32. data/lib/unit-ruby/types/hash.rb +21 -0
  33. data/lib/unit-ruby/types/integer.rb +9 -0
  34. data/lib/unit-ruby/types/phone.rb +23 -0
  35. data/lib/unit-ruby/types/string.rb +9 -0
  36. data/lib/unit-ruby/util/api_resource.rb +179 -0
  37. data/lib/unit-ruby/util/connection.rb +72 -0
  38. data/lib/unit-ruby/util/error.rb +16 -0
  39. data/lib/unit-ruby/util/resource_operations.rb +82 -0
  40. data/lib/unit-ruby/util/schema.rb +16 -0
  41. data/lib/unit-ruby/version.rb +3 -0
  42. data/lib/unit-ruby.rb +41 -0
  43. data/unit-ruby.gemspec +44 -0
  44. metadata +160 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3a3f2e3572e786099dd10fd18ff168fcd0a01818584e99aebe5a4e8f7999ba5f
4
+ data.tar.gz: f121f0016bcba17e49250155b5f6f9fb396197e19f36e90cee35b8c527fc7439
5
+ SHA512:
6
+ metadata.gz: d87105ca7f84244f906a1c2d88f10fd93224e7f0e59a714eeadc24cee4f0c10070ec22974597ad689a948debf2860699e68c777a758baef2767a3e12ef7a6027
7
+ data.tar.gz: 75cf35de299db78b476823befd47efaf5c442c48ef550f39593b91ef46e14b4bfe6288508333dbd7f65a20bb4ab207b1c048ca0ed2b835e3baa5011dcd08a92b
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ AllCops:
2
+ NewCops: enable
3
+
4
+ Style/FrozenStringLiteralComment:
5
+ Enabled: false
6
+
7
+ Style/MutableConstant:
8
+ Enabled: false
9
+
10
+ Layout/LineLength:
11
+ Max: 100
12
+ IgnoredPatterns: ['(\A|\s)#']
13
+
14
+ Style/Documentation:
15
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
@@ -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 chloe.isacke@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 unit-ruby.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ unit-ruby (0.1.0)
5
+ faraday (~> 1.8.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ diff-lcs (1.5.0)
12
+ faraday (1.8.0)
13
+ faraday-em_http (~> 1.0)
14
+ faraday-em_synchrony (~> 1.0)
15
+ faraday-excon (~> 1.1)
16
+ faraday-httpclient (~> 1.0.1)
17
+ faraday-net_http (~> 1.0)
18
+ faraday-net_http_persistent (~> 1.1)
19
+ faraday-patron (~> 1.0)
20
+ faraday-rack (~> 1.0)
21
+ multipart-post (>= 1.2, < 3)
22
+ ruby2_keywords (>= 0.0.4)
23
+ faraday-em_http (1.0.0)
24
+ faraday-em_synchrony (1.0.0)
25
+ faraday-excon (1.1.0)
26
+ faraday-httpclient (1.0.1)
27
+ faraday-net_http (1.0.1)
28
+ faraday-net_http_persistent (1.2.0)
29
+ faraday-patron (1.0.0)
30
+ faraday-rack (1.0.0)
31
+ multipart-post (2.1.1)
32
+ parallel (1.21.0)
33
+ parser (3.1.0.0)
34
+ ast (~> 2.4.1)
35
+ rainbow (3.1.1)
36
+ rake (13.0.6)
37
+ regexp_parser (2.2.0)
38
+ rexml (3.2.5)
39
+ rspec (3.10.0)
40
+ rspec-core (~> 3.10.0)
41
+ rspec-expectations (~> 3.10.0)
42
+ rspec-mocks (~> 3.10.0)
43
+ rspec-core (3.10.1)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-expectations (3.10.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-mocks (3.10.2)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-support (3.10.3)
52
+ rubocop (1.24.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 3.0.0.0)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml
58
+ rubocop-ast (>= 1.15.1, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 3.0)
61
+ rubocop-ast (1.15.1)
62
+ parser (>= 3.0.1.1)
63
+ ruby-progressbar (1.11.0)
64
+ ruby2_keywords (0.0.5)
65
+ unicode-display_width (2.1.0)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ bundler (~> 1.17)
72
+ rake (~> 13.0)
73
+ rspec (~> 3.0)
74
+ rubocop (~> 1.24.1)
75
+ unit-ruby!
76
+
77
+ BUNDLED WITH
78
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Chloe Isacke
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,51 @@
1
+ # Documentation
2
+
3
+ The documentation for the Unit API can be found [here](https://docs.unit.co/).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'unit-ruby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install unit-ruby
20
+
21
+ ## Usage
22
+
23
+ To get started, add an initializer file for the `unit-ruby` gem e.g. in `config/initializers/unit.rb`.
24
+
25
+ ```Ruby
26
+ require 'unit-ruby'
27
+
28
+ Unit.configure do |config|
29
+ config.api_key = ENV['UNIT_API_KEY']
30
+ config.base_url = ENV['UNIT_BASE_URL']
31
+ end
32
+
33
+ ```
34
+
35
+ ## Development
36
+
37
+ 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.
38
+
39
+ 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).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/retirable/unit-ruby. 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.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the Unit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/retirable/unit-ruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'unit/ruby'
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ module Unit
2
+ class ApplicationForm < Util::APIResource
3
+ path '/application-forms'
4
+
5
+ attribute :tags, Types::Hash # Optional
6
+ attribute :allowed_application_types, Types::Array # Optional. Array of Individual, Business or SoleProprietorship.
7
+ attribute :applicant_details, Types::ApplicationFormPrefill # Optional. Add data that is already known about the end-customer to be auto populated on the form.
8
+ attribute :settings_override, Types::ApplicationFormSettingsOverride # Optional. Override disclosure URLs that were defined in the application form settings.
9
+ attribute :stage, Types::String
10
+ attribute :url, Types::String
11
+
12
+ include Util::ResourceOperations::Create
13
+ end
14
+ end
@@ -0,0 +1,41 @@
1
+ module Unit
2
+ class AtmLocation < Util::APIResource
3
+ path '/atm-locations'
4
+ attribute :network, Types::String
5
+ attribute :address, Types::Address
6
+ attribute :coordinates, Types::Coordinates
7
+ attribute :distance, Types::Float
8
+ attribute :location_name, Types::String
9
+ attribute :accept_deposits, Types::Boolean
10
+ attribute :surcharge_free, Types::Boolean
11
+
12
+ include Util::ResourceOperations::List
13
+
14
+ def self.list_by_coordinates(latitude:, longitude:, search_radius:)
15
+ list(
16
+ where: {
17
+ coordinates: { longitude: longitude, latitude: latitude }.to_json,
18
+ searchRadius: search_radius
19
+ }
20
+ )
21
+ end
22
+
23
+ def self.list_by_postal_code(postal_code:, search_radius:)
24
+ list(
25
+ where: {
26
+ postal_code: postal_code,
27
+ searchRadius: search_radius
28
+ }
29
+ )
30
+ end
31
+
32
+ def self.list_by_address(address:, search_radius:)
33
+ list(
34
+ where: {
35
+ postal_code: address,
36
+ searchRadius: search_radius
37
+ }
38
+ )
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,28 @@
1
+ module Unit
2
+ class DepositAccount < Util::APIResource
3
+ path '/accounts'
4
+
5
+ attribute :deposit_product, Types::String # The name of the deposit product
6
+ attribute :idempotency_key, Types::String # Optional
7
+ attribute :tags, Types::Hash # Optional
8
+
9
+ attribute :created_at, Types::DateTime, readonly: true
10
+ attribute :name, Types::String, readonly: true # Name of the account holder
11
+ attribute :routing_number, Types::String, readonly: true # Routing number of account.
12
+ attribute :account_number, Types::String, readonly: true # Account number, together with the routingNumber forms the identifier of the account on the ACH network.
13
+ attribute :currency, Types::String, readonly: true # Currency of the account.
14
+ attribute :balance, Types::Integer, readonly: true # The balance amount (in cents). The balance represents the funds that are are currently in the account (not taking into account future commitments). The balance equals the sum of 'available' and 'hold'.
15
+ attribute :hold, Types::Integer, readonly: true # The hold amount (in cents). The hold represents funds that are not available for spending, typically due to an outstanding card authorization.
16
+ attribute :available, Types::Integer, readonly: true # The available balance for spending (in cents). Equals the balance minus the hold amount.
17
+ attribute :status, Types::String, readonly: true # Status of the account, either Open, Frozen, or Closed.
18
+ attribute :freeze_reason, Types::String, readonly: true # Optional. The reason the account was frozen, either Fraud or free-text description.
19
+ attribute :close_reason, Types::String, readonly: true # Optional. The reason the account was closed, either ByCustomer or Fraud.
20
+
21
+ belongs_to :customer, class_name: 'Unit::IndividualCustomer'
22
+
23
+ include Util::ResourceOperations::List
24
+ include Util::ResourceOperations::Create
25
+ include Util::ResourceOperations::Save
26
+ include Util::ResourceOperations::Find
27
+ end
28
+ end
@@ -0,0 +1,33 @@
1
+ module Unit
2
+ class IndividualApplication < Util::APIResource
3
+ path '/applications'
4
+
5
+ attribute :ssn, Types::String # SSN (or ITIN) of the individual (numbers only). Either an SSN or a passport number is required.
6
+ attribute :passport, Types::String # Passport number of the individual. Either an SSN or a passport number is required.
7
+ attribute :nationality, Types::String # Required on if a passport is used as the main ID. Two letters representing the individual nationality. (e.g. "US").
8
+ attribute :full_name, Types::FullName # Full name of the individual.
9
+ attribute :date_of_birth, Types::Date # RFC3339 Date only (e.g. "2001-08-15").
10
+ attribute :address, Types::Address # Address of the individual.
11
+ attribute :phone, Types::Phone # Phone number of the individual.
12
+ attribute :email, Types::String # Email address of the individual.
13
+ attribute :ip, Types::String # Optional. IP address of the end-customer creating the application. Both IPv4 and IPv6 formats are supported. Highly recommended as a fraud prevention measure, if the information is available when submitting the application.
14
+ attribute :sole_proprietorship, Types::Boolean # Optional. Default: false. Indicates whether the individual is a sole proprietor.
15
+ attribute :ein, Types::String # Optional. If the individual is a sole proprietor who has an Employer Identification Number, specify it here. Not all sole proprietors have an EIN, so this attribute is optional, even when soleProprietorship is set to true.
16
+ attribute :dba, Types::String # Optional. If the individual is a sole proprietor who is doing business under a different name, specify it here. This attribute is optional, even when soleProprietorship is set to true.
17
+ attribute :tags, Types::Hash # Optional. Tags that will be copied to the customer that this application creates
18
+ attribute :idempotency_key, Types::String # Optional
19
+ attribute :device_fingerprints, Types::Array # array of Device Fingerprint Optional. A list of device fingerprints for fraud and risk prevention
20
+
21
+ attribute :created_at, Types::DateTime, readonly: true
22
+ attribute :status, Types::String, readonly: true
23
+ attribute :message, Types::String, readonly: true
24
+ attribute :evaluation_id, Types::String, readonly: true
25
+ attribute :authorized_users, Types::Array, readonly: true
26
+
27
+ belongs_to :customer, class_name: 'Unit::IndividualCustomer'
28
+
29
+ include Util::ResourceOperations::Find
30
+ include Util::ResourceOperations::List
31
+ include Util::ResourceOperations::Create
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+ module Unit
2
+ class IndividualCustomer < Util::APIResource
3
+ path '/customers'
4
+
5
+ attribute :ssn, Types::String # SSN (or ITIN) of the individual (numbers only). Either an SSN or a passport number is required.
6
+ attribute :passport, Types::String # Passport number of the individual. Either an SSN or a passport number is required.
7
+ attribute :nationality, Types::String # Required on if a passport is used as the main ID. Two letters representing the individual nationality. (e.g. "US").
8
+ attribute :full_name, Types::FullName # Full name of the individual.
9
+ attribute :date_of_birth, Types::Date # RFC3339 Date only (e.g. "2001-08-15").
10
+ attribute :address, Types::Address # Address of the individual.
11
+ attribute :phone, Types::Phone # Phone number of the individual.
12
+ attribute :email, Types::String # Email address of the individual
13
+ attribute :dba, Types::String # Optional. If the individual is a sole proprietor who is doing business under a different name.
14
+ attribute :sole_proprietorship, Types::Boolean
15
+ attribute :tags, Types::Hash # Optional. Tags that will be copied to the customer that this application creates
16
+ attribute :idempotency_key, Types::String # Optional
17
+ attribute :risk_rate, Types::String, readonly: true
18
+ attribute :authorized_users, Types::Array, readonly: true
19
+ attribute :created_at, Types::DateTime, readonly: true
20
+
21
+ belongs_to :application, class_name: 'Unit::IndividualApplication'
22
+
23
+ include Util::ResourceOperations::List
24
+ include Util::ResourceOperations::Create
25
+ include Util::ResourceOperations::Save
26
+ include Util::ResourceOperations::Find
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ module Unit
2
+ class IndividualDebitCard < Util::APIResource
3
+ path '/cards'
4
+
5
+ attribute :shipping_address, Types::Address # Optional. Address to ship the card to. If not specified, the individual address is used.
6
+ attribute :design, Types::String # Optional. You may omit if you only have one card design. Please contact Unit if you need multiple card designs.
7
+ attribute :additional_embossed_text, Types::String # Optional, up to 21 characters. Use for a second cardholder name, company name, or other data to be embossed on a card.
8
+ attribute :idempotency_key, Types::String # Optional
9
+ attribute :tags, Types::Hash # Optional
10
+ attribute :limits, Types::Hash # Optional
11
+
12
+ attribute :created_at, Types::DateTime, readonly: true
13
+ attribute :last4_digits, Types::String
14
+ attribute :expiration_date, Types::String, readonly: true
15
+ attribute :status, Types::String, readonly: true
16
+
17
+ belongs_to :customer, class_name: 'Unit::IndividualCustomer'
18
+ belongs_to :account, class_name: 'Unit::DepositAccount'
19
+
20
+ include Util::ResourceOperations::List
21
+ include Util::ResourceOperations::Create
22
+ include Util::ResourceOperations::Save
23
+ include Util::ResourceOperations::Find
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ module Unit
2
+ class Institution < Util::APIResource
3
+ attribute :routing_number, Types::String # Routing number of the institution. Valid 9-digit ABA routing transit number.
4
+ attribute :name, Types::String # Name of the institution.
5
+ attribute :address, Types::String # Optional. Address of the institution.
6
+ attribute :is_ach_supported, Types::Boolean # Is FedACH participant.
7
+ attribute :is_wire_supported, Types::Boolean # Is Fedwire participant.
8
+
9
+ path '/institutions'
10
+
11
+ include Util::ResourceOperations::Find
12
+
13
+ def self.find_by(routing_number:)
14
+ find(routing_number)
15
+ end
16
+
17
+ # Unit::Institution.find_by_routing_number('021000021')
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ module Unit
2
+ module Types
3
+ class Address
4
+ attr_reader :street, :city, :state, :postal_code, :country
5
+
6
+ def initialize(street:, city:, state:, postal_code:, country:)
7
+ @street = street
8
+ @city = city
9
+ @state = state
10
+ @postal_code = postal_code
11
+ @country = country
12
+ end
13
+
14
+ def self.cast(val)
15
+ return val if val.is_a? self
16
+ return nil if val.nil?
17
+
18
+ new(
19
+ street: val[:street],
20
+ city: val[:city],
21
+ state: val[:state],
22
+ postal_code: val[:postal_code],
23
+ country: val[:country]
24
+ )
25
+ end
26
+
27
+ def as_json_api
28
+ { street: street, city: city, state: state, postal_code: postal_code, country: country }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,61 @@
1
+ module Unit
2
+ module Types
3
+ class ApplicationFormPrefill
4
+ attr_reader :application_type, :full_name, :ssn, :passport, :nationality, :date_of_birth,
5
+ :email, :address, :phone
6
+
7
+ def initialize(
8
+ application_type: nil,
9
+ full_name: nil,
10
+ ssn: nil,
11
+ passport: nil,
12
+ nationality: nil,
13
+ date_of_birth: nil,
14
+ email: nil,
15
+ address: nil,
16
+ phone: nil
17
+ )
18
+ @application_type = application_type
19
+ @full_name = full_name
20
+ @ssn = ssn
21
+ @passport = passport
22
+ @nationality = nationality
23
+ @date_of_birth = date_of_birth
24
+ @email = email
25
+ @address = address
26
+ @phone = phone
27
+ end
28
+
29
+ def self.cast(val)
30
+ return val if val.is_a? self
31
+ return nil if val.nil?
32
+
33
+ new(
34
+ application_type: val[:application_type],
35
+ full_name: val[:full_name],
36
+ ssn: val[:ssn],
37
+ passport: val[:passport],
38
+ nationality: val[:nationality],
39
+ date_of_birth: val[:date_of_birth],
40
+ email: val[:email],
41
+ address: val[:address],
42
+ phone: val[:phone]
43
+ )
44
+ end
45
+
46
+ def as_json_api
47
+ {
48
+ application_type: application_type,
49
+ full_name: full_name&.as_json_api,
50
+ ssn: ssn,
51
+ passport: passport,
52
+ nationality: nationality,
53
+ date_of_birth: date_of_birth,
54
+ email: email,
55
+ address: address&.as_json_api,
56
+ phone: phone&.as_json_api
57
+ }.compact
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,57 @@
1
+ module Unit
2
+ module Types
3
+ class ApplicationFormSettingsOverride
4
+ attr_reader :redirect_url, :privacy_policy_url, :electronic_disclosures_url,
5
+ :deposit_terms_url, :client_terms_url, :cardholder_terms_url, :cash_advanced_terms_url, :additional_disclosures
6
+
7
+ def initialize(
8
+ redirect_url: nil,
9
+ privacy_policy_url: nil,
10
+ electronic_disclosures_url: nil,
11
+ deposit_terms_url: nil,
12
+ client_terms_url: nil,
13
+ cardholder_terms_url: nil,
14
+ cash_advanced_terms_url: nil,
15
+ additional_disclosures: nil
16
+ )
17
+ @redirect_url = redirect_url
18
+ @privacy_policy_url = privacy_policy_url
19
+ @electronic_disclosures_url = electronic_disclosures_url
20
+ @deposit_terms_url = deposit_terms_url
21
+ @client_terms_url = client_terms_url
22
+ @cardholder_terms_url = cardholder_terms_url
23
+ @cash_advanced_terms_url = cash_advanced_terms_url
24
+ @additional_disclosures = additional_disclosures
25
+ end
26
+
27
+ def self.cast(val)
28
+ return val if val.is_a? self
29
+ return nil if val.nil?
30
+
31
+ new(
32
+ redirect_url: val[:redirect_url],
33
+ privacy_policy_url: val[:privacy_policy_url],
34
+ electronic_disclosures_url: val[:electronic_disclosures_url],
35
+ deposit_terms_url: val[:deposit_terms_url],
36
+ client_terms_url: val[:client_terms_url],
37
+ cardholder_terms_url: val[:cardholder_terms_url],
38
+ cash_advanced_terms_url: val[:cash_advanced_terms_url],
39
+ additional_disclosures: val[:additional_disclosures]
40
+ )
41
+ end
42
+
43
+ def as_json_api
44
+ {
45
+ redirect_url: redirect_url,
46
+ privacy_policy_url: privacy_policy_url,
47
+ electronic_disclosures_url: electronic_disclosures_url,
48
+ deposit_terms_url: deposit_terms_url,
49
+ client_terms_url: client_terms_url,
50
+ cardholder_terms_url: cardholder_terms_url,
51
+ cash_advanced_terms_url: cash_advanced_terms_url,
52
+ additional_disclosures: additional_disclosures
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end