lemonway_onboarding 0.2.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c2abb83ed4cc735d0df8aa74fb46e8b728a9efce7c4257002367407dd66bf9d
4
+ data.tar.gz: ae93ee0a9a43f3e3f5d6ceedda68f5318bbb9e43a06c15284b47d9c64cb1d0a7
5
+ SHA512:
6
+ metadata.gz: a5ff0496a0ff4ac4e4d0d9cfd9af4701df5b994d5b8088921b9d06fa90b06797300df8b39093a629ba7f15448a7902c6bd6b221f4c81057d29a805f3275bf75b
7
+ data.tar.gz: 46398d68a25ae8317b20936d905266601bc3dd4028bd8788240807d0dca6c0f23ee447c724d7b20f58eef18b09e61b47d0eb04c3f971c9cd039980004a81f1ab
data/.qlty/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ *
2
+ !configs
3
+ !configs/**
4
+ !hooks
5
+ !hooks/**
6
+ !qlty.toml
7
+ !.gitignore
@@ -0,0 +1,5 @@
1
+ ignore:
2
+ - "**/*":
3
+ - Style/StringLiterals # Use single quotes for strings
4
+ - Layout/MultilineMethodCallIndentation # Indentation of multiline method calls
5
+ - Layout/SpaceInsideHashLiteralBraces # Allow space inside hash literal braces
@@ -0,0 +1,8 @@
1
+ rules:
2
+ document-start: disable
3
+ quoted-strings:
4
+ required: only-when-needed
5
+ extra-allowed: ["{|}"]
6
+ key-duplicates: {}
7
+ octal-values:
8
+ forbid-implicit-octal: true
data/.qlty/qlty.toml ADDED
@@ -0,0 +1,101 @@
1
+ # This file was automatically generated by `qlty init`.
2
+ # You can modify it to suit your needs.
3
+ # We recommend you to commit this file to your repository.
4
+ #
5
+ # This configuration is used by both Qlty CLI and Qlty Cloud.
6
+ #
7
+ # Qlty CLI -- Code quality toolkit for developers
8
+ # Qlty Cloud -- Fully automated Code Health Platform
9
+ #
10
+ # Try Qlty Cloud: https://qlty.sh
11
+ #
12
+ # For a guide to configuration, visit https://qlty.sh/d/config
13
+ # Or for a full reference, visit https://qlty.sh/d/qlty-toml
14
+ config_version = "0"
15
+
16
+ exclude_patterns = [
17
+ "*_min.*",
18
+ "*-min.*",
19
+ "*.min.*",
20
+ "**/.yarn/**",
21
+ "**/*.d.ts",
22
+ "**/assets/**",
23
+ "**/bower_components/**",
24
+ "**/build/**",
25
+ "**/cache/**",
26
+ "**/config/**",
27
+ "**/db/**",
28
+ "**/deps/**",
29
+ "**/dist/**",
30
+ "**/extern/**",
31
+ "**/external/**",
32
+ "**/generated/**",
33
+ "**/Godeps/**",
34
+ "**/gradlew/**",
35
+ "**/mvnw/**",
36
+ "**/node_modules/**",
37
+ "**/protos/**",
38
+ "**/seed/**",
39
+ "**/target/**",
40
+ "**/templates/**",
41
+ "**/testdata/**",
42
+ "**/vendor/**",
43
+ ]
44
+
45
+ test_patterns = [
46
+ "**/test/**",
47
+ "**/spec/**",
48
+ "**/*.test.*",
49
+ "**/*.spec.*",
50
+ "**/*_test.*",
51
+ "**/*_spec.*",
52
+ "**/test_*.*",
53
+ "**/spec_*.*",
54
+ ]
55
+
56
+ [smells]
57
+ mode = "comment"
58
+
59
+ [[source]]
60
+ name = "default"
61
+ default = true
62
+
63
+
64
+ [[plugin]]
65
+ name = "actionlint"
66
+
67
+ [[plugin]]
68
+ name = "checkov"
69
+
70
+ [[plugin]]
71
+ name = "markdownlint"
72
+ mode = "comment"
73
+
74
+ [[plugin]]
75
+ name = "osv-scanner"
76
+
77
+ [[plugin]]
78
+ name = "prettier"
79
+
80
+ [[plugin]]
81
+ name = "ripgrep"
82
+ mode = "comment"
83
+
84
+ [[plugin]]
85
+ name = "rubocop"
86
+
87
+ [[plugin]]
88
+ name = "standardrb"
89
+
90
+ [[plugin]]
91
+ name = "trivy"
92
+ drivers = [
93
+ "config",
94
+ "fs-vuln",
95
+ ]
96
+
97
+ [[plugin]]
98
+ name = "trufflehog"
99
+
100
+ [[plugin]]
101
+ name = "yamllint"
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-06-19
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at fabrice.carrega@treize37.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in lemonway_onboarding.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'standard', '~> 1.3'
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lemonway_onboarding (0.2.1)
5
+ typhoeus (>= 1.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.3)
11
+ diff-lcs (1.6.1)
12
+ ethon (0.16.0)
13
+ ffi (>= 1.15.0)
14
+ ffi (1.15.5)
15
+ json (2.10.2)
16
+ language_server-protocol (3.17.0.4)
17
+ lint_roller (1.1.0)
18
+ parallel (1.26.3)
19
+ parser (3.3.7.4)
20
+ ast (~> 2.4.1)
21
+ racc
22
+ prism (1.4.0)
23
+ racc (1.8.1)
24
+ rainbow (3.1.1)
25
+ rake (13.2.1)
26
+ regexp_parser (2.10.0)
27
+ rexml (3.4.1)
28
+ rspec (3.13.0)
29
+ rspec-core (~> 3.13.0)
30
+ rspec-expectations (~> 3.13.0)
31
+ rspec-mocks (~> 3.13.0)
32
+ rspec-core (3.13.3)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-expectations (3.13.3)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-mocks (3.13.2)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.13.0)
40
+ rspec-support (3.13.2)
41
+ rubocop (1.64.1)
42
+ json (~> 2.3)
43
+ language_server-protocol (>= 3.17.0)
44
+ parallel (~> 1.10)
45
+ parser (>= 3.3.0.2)
46
+ rainbow (>= 2.2.2, < 4.0)
47
+ regexp_parser (>= 1.8, < 3.0)
48
+ rexml (>= 3.2.5, < 4.0)
49
+ rubocop-ast (>= 1.31.1, < 2.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (>= 2.4.0, < 3.0)
52
+ rubocop-ast (1.44.0)
53
+ parser (>= 3.3.7.2)
54
+ prism (~> 1.4)
55
+ rubocop-performance (1.21.1)
56
+ rubocop (>= 1.48.1, < 2.0)
57
+ rubocop-ast (>= 1.31.1, < 2.0)
58
+ ruby-progressbar (1.13.0)
59
+ standard (1.37.0)
60
+ language_server-protocol (~> 3.17.0.2)
61
+ lint_roller (~> 1.0)
62
+ rubocop (~> 1.64.0)
63
+ standard-custom (~> 1.0.0)
64
+ standard-performance (~> 1.4)
65
+ standard-custom (1.0.2)
66
+ lint_roller (~> 1.0)
67
+ rubocop (~> 1.50)
68
+ standard-performance (1.4.0)
69
+ lint_roller (~> 1.1)
70
+ rubocop-performance (~> 1.21.0)
71
+ typhoeus (1.4.0)
72
+ ethon (>= 0.9.0)
73
+ unicode-display_width (2.6.0)
74
+
75
+ PLATFORMS
76
+ x86_64-darwin-20
77
+
78
+ DEPENDENCIES
79
+ lemonway_onboarding!
80
+ rake (~> 13.0)
81
+ rspec (~> 3.0)
82
+ standard (~> 1.3)
83
+
84
+ BUNDLED WITH
85
+ 2.3.12
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Fabrice Carrega
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,115 @@
1
+ # LemonwayOnboarding
2
+
3
+ This gem provides access points to the new Lemonway onboarding API, making it easier to integrate and use the features offered by the Lemonway platform in your Ruby applications.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ bundle add lemonway_onboarding
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ gem install lemonway_onboarding
14
+
15
+ ## Usage
16
+
17
+ To use the LemonwayOnboarding gem, first require it in your Ruby application:
18
+
19
+ ```ruby
20
+ require 'lemonway_onboarding'
21
+ ```
22
+
23
+ ### Configuration
24
+
25
+ You can configure the gem globally, or pass a configuration to the client:
26
+
27
+ ```ruby
28
+ config = LemonwayOnboarding::Configuration.new do |c|
29
+ c.token = 'your_api_token'
30
+ c.environment = 'sandbox' # or 'production'
31
+ # c.proxy = 'http://proxy.example.com:8080' # Optional
32
+ # c.logger = Logger.new('lemonway.log') # Optional
33
+ end
34
+ ```
35
+
36
+ ### Creating a Client
37
+
38
+ Initialize a client with your Lemonway API credentials:
39
+
40
+ ```ruby
41
+ client = LemonwayOnboarding::Client.new(config)
42
+ ```
43
+
44
+ ### Using the API
45
+
46
+ #### Accounts
47
+
48
+ ```ruby
49
+ accounts_api = LemonwayOnboarding::Api::Accounts.new(client)
50
+ # Create a business account
51
+ response = accounts_api.create('business', { name: 'My Company' })
52
+ # List accounts
53
+ accounts = accounts_api.index(status: 'active')
54
+ # Show a specific account
55
+ account = accounts_api.show(123)
56
+ ```
57
+
58
+ #### Onboardings
59
+
60
+ ```ruby
61
+ onboardings_api = LemonwayOnboarding::Api::Onboardings.new(client)
62
+ # Create an onboarding
63
+ response = onboardings_api.create('individual', { first_name: 'John', last_name: 'Doe' })
64
+ # Resume an onboarding
65
+ resume = onboardings_api.update(456)
66
+ ```
67
+
68
+ #### Documents
69
+
70
+ ```ruby
71
+ documents_api = LemonwayOnboarding::Api::Documents.new(client)
72
+ # Get a document for an account
73
+ doc = documents_api.get(789, 'identity')
74
+ # Update a document for an onboarding
75
+ updated = documents_api.update(321, { file: '...' })
76
+ ```
77
+
78
+ ### Error Handling
79
+
80
+ All API calls will raise an exception if the request fails or times out. You can handle errors as follows:
81
+
82
+ ```ruby
83
+ begin
84
+ response = accounts_api.create('business', { name: 'My Company' })
85
+ puts response
86
+ rescue => e
87
+ puts "Error: #{e.message}"
88
+ end
89
+ ```
90
+
91
+ ### Logging
92
+
93
+ You can provide your own logger via the configuration. By default, logs are output to STDOUT.
94
+
95
+ ---
96
+
97
+ For more advanced usage and available methods, please refer to the [API documentation](https://docs.lemonway.com/).
98
+
99
+ ## Development
100
+
101
+ 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.
102
+
103
+ 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).
104
+
105
+ ## Contributing
106
+
107
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/Treize37/lemonway_onboarding>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Treize37/lemonway_onboarding/blob/main/CODE_OF_CONDUCT.md).
108
+
109
+ ## License
110
+
111
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
112
+
113
+ ## Code of Conduct
114
+
115
+ Everyone interacting in the LemonwayOnboarding project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Treize37/lemonway_onboarding/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'standard/rake'
9
+
10
+ task default: %i[spec standard]
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/lemonway_onboarding/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lemonway_onboarding'
7
+ spec.version = LemonwayOnboarding::VERSION
8
+ spec.authors = ['Fabrice Carrega']
9
+ spec.email = ['contact@treize37.com']
10
+
11
+ spec.summary = 'Ruby wrapper for the Lemonway Onboarding API.'
12
+ spec.description = 'A Ruby client for the Lemonway Onboarding API, ' \
13
+ 'providing an easy way to interact with the API for onboarding users and managing their accounts.'
14
+ spec.homepage = 'https://github.com/treize37/lemonway_onboarding'
15
+ spec.license = 'MIT'
16
+ spec.required_ruby_version = '>= 2.7.0'
17
+
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = spec.homepage
22
+ spec.metadata['changelog_uri'] = 'https://github.com/Treize37/lemonway_onboarding/blob/main/CHANGELOG.md'
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
29
+ end
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_dependency 'typhoeus', '>= 1.4'
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ module Api
5
+ # Accounts API for Lemonway Onboarding
6
+ class Accounts
7
+ # Initializes the Accounts API with a client.
8
+ #
9
+ # @param client [LemonwayOnboarding::Client] The client to use for API requests
10
+ # @return [LemonwayOnboarding::Api::Accounts] The initialized Accounts API
11
+ def initialize(client = LemonwayOnboarding::Client.new)
12
+ @client = client
13
+ end
14
+
15
+ # Creates a new account.
16
+ #
17
+ # @param type [String] The type of account to create
18
+ # @param body [Hash] The body of the request containing account details
19
+ # @return [Hash] The response from the API containing the created account details
20
+ def create(type, body)
21
+ @client.post("accounts/#{type}", body)
22
+ end
23
+
24
+ # Lists all accounts.
25
+ #
26
+ # @param params [Hash] Optional parameters to filter the accounts
27
+ # @return [Array<Hash>] The list of accounts
28
+ def index(params = {})
29
+ @client.get('accounts', params)
30
+ end
31
+
32
+ # Retrieves a specific account by its ID.
33
+ #
34
+ # @param id [String] The ID of the account to retrieve
35
+ # @return [Hash] The details of the specified account
36
+ def show(id)
37
+ @client.get("accounts/#{id}")
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ module Api
5
+ # Documents API for Lemonway Onboarding
6
+ class Documents
7
+ # Initializes the Documents API with a client.
8
+ #
9
+ # @param client [LemonwayOnboarding::Client] The client to use for API requests
10
+ # @return [LemonwayOnboarding::Api::Documents] The initialized Documents API
11
+ def initialize(client = LemonwayOnboarding::Client.new)
12
+ @client = client
13
+ end
14
+
15
+ # Retrieves a document for a specific account.
16
+ #
17
+ # @param account_id [String] The ID of the account to retrieve the document for
18
+ # @param document_name [String] The name of the document to retrieve
19
+ # @return [Hash] The response from the API containing the document details
20
+ def get(account_id, document_name)
21
+ @client.get("accounts/#{account_id}/documents/#{document_name}")
22
+ end
23
+
24
+ # Updates a document for a specific onboarding process.
25
+ #
26
+ # @param onboarding_id [String] The ID of the onboarding process
27
+ # @param body [Hash] The body of the request containing document details
28
+ # @return [Hash] The response from the API containing the updated document details
29
+ def update(onboarding_id, body)
30
+ @client.post("legal_entity_onboarding/#{onboarding_id}/document", body)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ module Api
5
+ # Onboardings API for Lemonway Onboarding
6
+ class Onboardings
7
+ # Initializes the Onboardings API with a client.
8
+ #
9
+ # @param client [LemonwayOnboarding::Client] The client to use for API requests
10
+ # @return [LemonwayOnboarding::Api::Onboardings] The initialized
11
+ def initialize(client = LemonwayOnboarding::Client.new)
12
+ @client = client
13
+ end
14
+
15
+ # Creates a new onboarding process.
16
+ #
17
+ # @param type [String] The type of onboarding to create
18
+ # @param body [Hash] The body of the request containing onboarding details
19
+ def create(type, body)
20
+ @client.post("onboardings/#{type}", body)
21
+ end
22
+
23
+ # Resumes an existing onboarding process.
24
+ #
25
+ # @param id [String] The ID of the onboarding process to resume
26
+ # @return [Array<Hash>] The list of onboardings
27
+ def update(id)
28
+ @client.get("onboardings/#{id}/resume")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'typhoeus'
4
+ require_relative 'configuration'
5
+
6
+ module LemonwayOnboarding
7
+ # Client for interacting with the Ohme API
8
+ class Client
9
+ # Initializes the client with the configuration
10
+ #
11
+ # @param configuration [LemonwayOnboarding::Configuration] The configuration object
12
+ def initialize(configuration = LemonwayOnboarding::Configuration.new)
13
+ @configuration = configuration
14
+ @configuration.validate!
15
+ end
16
+
17
+ # Performs a GET request
18
+ #
19
+ # @param endpoint [String] The API endpoint to access
20
+ # @param params [Hash] Optional parameters to include in the request
21
+ # @return [Hash, nil] The parsed JSON response or nil for DELETE requests with
22
+ def get(endpoint, params = {})
23
+ request(:get, endpoint, params: params)
24
+ end
25
+
26
+ # Performs a POST request
27
+ #
28
+ # @param endpoint [String] The API endpoint to access
29
+ # @param body [Hash] The body of the POST request
30
+ # @return [Hash] The parsed JSON response
31
+ def post(endpoint, body = {})
32
+ request(:post, endpoint, body: body)
33
+ end
34
+
35
+ # Performs a PUT request
36
+ #
37
+ # @param endpoint [String] The API endpoint to access
38
+ # @param body [Hash] The body of the PUT request
39
+ # @return [Hash] The parsed JSON response
40
+ def put(endpoint, body = {})
41
+ request(:put, endpoint, body: body)
42
+ end
43
+
44
+ # Performs a DELETE request
45
+ #
46
+ # @param endpoint [String] The API endpoint to access
47
+ # @param params [Hash] Optional parameters to include in the request
48
+ # @return [Hash, nil] The parsed JSON response or nil for DELETE requests with
49
+ # no body
50
+ def delete(endpoint, params = {})
51
+ request(:delete, endpoint, params: params)
52
+ end
53
+
54
+ private
55
+
56
+ # Private: Performs an HTTP request
57
+ #
58
+ # @param method [Symbol] The HTTP method (e.g., :get, :post, :put, :delete)
59
+ # @param endpoint [String] The API endpoint to access
60
+ # @param options [Hash] Additional options for the request (e.g., params,
61
+ # body)
62
+ # @return [Hash, nil] The parsed JSON response or nil for DELETE requests with no body
63
+ def request(method, endpoint, options = {})
64
+ log_request(method, endpoint, options)
65
+
66
+ response = Typhoeus::Request.new(
67
+ build_url(endpoint),
68
+ method: method,
69
+ headers: build_headers,
70
+ params: options[:params],
71
+ body: options[:body]&.to_json,
72
+ timeout: @configuration.timeout,
73
+ proxy: @configuration.proxy
74
+ ).run
75
+
76
+ handle_response(response)
77
+ end
78
+
79
+ # Private: Logs the request details
80
+ #
81
+ # @param method [Symbol] The HTTP method (e.g., :get, :post)
82
+ # @param endpoint [String] The API endpoint being accessed
83
+ # @param options [Hash] Additional options for the request (e.g., params,
84
+ # body)
85
+ # # @return [void]
86
+ def log_request(method, endpoint, options)
87
+ @configuration.logger.info("Request: #{method.upcase} #{build_url(endpoint)}")
88
+ @configuration.logger.debug("Headers: #{build_headers}")
89
+ @configuration.logger.debug("Params: #{options[:params]}") if options[:params]
90
+ @configuration.logger.debug("Body: #{options[:body]}") if options[:body]
91
+ end
92
+
93
+ # Private: Builds the full URL for the API endpoint
94
+ #
95
+ # @param endpoint [String] The API endpoint to build the URL for
96
+ # @return [String] The full URL for the API endpoint
97
+ def build_url(endpoint)
98
+ "#{@configuration.base_url}/#{endpoint}"
99
+ end
100
+
101
+ # Private: Builds the headers for the request
102
+ #
103
+ # @return [Hash] The headers for the request
104
+ def build_headers
105
+ {
106
+ 'Authorization' => "Bearer #{@configuration.token}",
107
+ 'Content-Type' => 'application/json',
108
+ 'Accept' => 'application/json'
109
+ }
110
+ end
111
+
112
+ # Private: Handle the API response
113
+ #
114
+ # @param response [Typhoeus::Response] The response object from the HTTP request
115
+ # @return [Hash, nil] The parsed JSON response or nil for DELETE requests with no body
116
+ def handle_response(response)
117
+ log_response(response)
118
+
119
+ if response.timed_out?
120
+ raise 'Request timed out. Please check your network connection or increase the timeout.'
121
+ elsif response.success?
122
+ # Return nil for DELETE requests with no body
123
+ return nil if response.body.nil? || response.body.strip.empty?
124
+
125
+ # Parse JSON for other successful responses
126
+ JSON.parse(response.body)
127
+ else
128
+ raise "HTTP request failed: #{response.code} - #{response.body}"
129
+ end
130
+ end
131
+
132
+ # Private: Logs the response details
133
+ #
134
+ # @param response [Typhoeus::Response] The response object from the HTTP request
135
+ # @return [void]
136
+ def log_response(response)
137
+ @configuration.logger.info("Response code: #{response.code}")
138
+ @configuration.logger.debug("Response body: #{response.body}")
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ # Configuration of the LemonwayOnboarding API client gem.
5
+ class Configuration
6
+ attr_accessor :base_url, :environment, :logger, :proxy, :timeout, :token, :version
7
+
8
+ # Initializes the configuration with default values.
9
+ # You can pass a block to configure the instance.
10
+ #
11
+ # @yield [self] Optional block to configure the instance
12
+ # @return [LemonwayOnboarding::Configuration] The configured instance
13
+ def initialize
14
+ @environment = ENV['LEMONWAY_ONBOARDING_ENV'] || 'production'
15
+ @version = 'v1'
16
+ @timeout = 30
17
+ @token = nil
18
+ @proxy = nil
19
+ @logger = Logger.new($stdout)
20
+
21
+ yield self if block_given?
22
+
23
+ base_url_from_env
24
+ end
25
+
26
+ # Configures the instance with a block.
27
+ #
28
+ # @yield [self] Block to configure the instance
29
+ # @return [void]
30
+ def configure
31
+ yield(self) if block_given?
32
+ end
33
+
34
+ # Validates the configuration values.
35
+ #
36
+ # @return [void]
37
+ # @raise [RuntimeError] If required attributes are missing or invalid
38
+ def validate!
39
+ error_on('token') unless @token
40
+ error_on('environment') unless %(sandbox production).include?(@environment)
41
+ end
42
+
43
+ private
44
+
45
+ # Private: Sets the base URL based on the environment.
46
+ #
47
+ # @return [void]
48
+ def base_url_from_env
49
+ @base_url = case @environment
50
+ when 'production'
51
+ 'https://onboarding-api.lemonway.com'
52
+ when 'sandbox'
53
+ 'https://onboarding-api.sandbox.lemonway.com'
54
+ end
55
+ end
56
+
57
+ # Private: Raises an error if a required attribute is missing.
58
+ #
59
+ # @param attribute [String] The name of the missing attribute
60
+ # @raise [RuntimeError] If the attribute is missing
61
+ def error_on(attribute)
62
+ raise(
63
+ "#{attribute} is missing. " \
64
+ "Please configure LemonwayOnboarding::Configuration.#{attribute}."
65
+ )
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ VERSION = '0.2.1'
5
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ require 'lemonway_onboarding/api/accounts'
6
+ require 'lemonway_onboarding/api/documents'
7
+ require 'lemonway_onboarding/api/onboardings'
8
+ require 'lemonway_onboarding/client'
9
+ require 'lemonway_onboarding/configuration'
10
+ require 'lemonway_onboarding/version'
11
+
12
+ module LemonwayOnboarding
13
+ class Error < StandardError; end
14
+ # Your code goes here...
15
+ end
data/log/.keep ADDED
File without changes
@@ -0,0 +1,4 @@
1
+ module LemonwayOnboarding
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lemonway_onboarding
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Fabrice Carrega
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-07-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ description: A Ruby client for the Lemonway Onboarding API, providing an easy way
28
+ to interact with the API for onboarding users and managing their accounts.
29
+ email:
30
+ - contact@treize37.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".qlty/.gitignore"
36
+ - ".qlty/configs/.standard.yml"
37
+ - ".qlty/configs/.yamllint.yaml"
38
+ - ".qlty/qlty.toml"
39
+ - ".rspec"
40
+ - CHANGELOG.md
41
+ - CODE_OF_CONDUCT.md
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE.txt
45
+ - README.md
46
+ - Rakefile
47
+ - lemonway_onboarding.gemspec
48
+ - lib/lemonway_onboarding.rb
49
+ - lib/lemonway_onboarding/api/accounts.rb
50
+ - lib/lemonway_onboarding/api/documents.rb
51
+ - lib/lemonway_onboarding/api/onboardings.rb
52
+ - lib/lemonway_onboarding/client.rb
53
+ - lib/lemonway_onboarding/configuration.rb
54
+ - lib/lemonway_onboarding/version.rb
55
+ - log/.keep
56
+ - sig/lemonway_onboarding.rbs
57
+ homepage: https://github.com/treize37/lemonway_onboarding
58
+ licenses:
59
+ - MIT
60
+ metadata:
61
+ allowed_push_host: https://rubygems.org
62
+ homepage_uri: https://github.com/treize37/lemonway_onboarding
63
+ source_code_uri: https://github.com/treize37/lemonway_onboarding
64
+ changelog_uri: https://github.com/Treize37/lemonway_onboarding/blob/main/CHANGELOG.md
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.7.0
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.3.12
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Ruby wrapper for the Lemonway Onboarding API.
84
+ test_files: []