lemonway_onboarding 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c2abb83ed4cc735d0df8aa74fb46e8b728a9efce7c4257002367407dd66bf9d
4
- data.tar.gz: ae93ee0a9a43f3e3f5d6ceedda68f5318bbb9e43a06c15284b47d9c64cb1d0a7
3
+ metadata.gz: 3b9e17c71438f49631f99e146b3ab66088cd54a79f8ad6f1373fb065f04ddc59
4
+ data.tar.gz: e1f853e3a32888cccba9209576a72c7d8a68cd62d47ac302a170c676a4048446
5
5
  SHA512:
6
- metadata.gz: a5ff0496a0ff4ac4e4d0d9cfd9af4701df5b994d5b8088921b9d06fa90b06797300df8b39093a629ba7f15448a7902c6bd6b221f4c81057d29a805f3275bf75b
7
- data.tar.gz: 46398d68a25ae8317b20936d905266601bc3dd4028bd8788240807d0dca6c0f23ee447c724d7b20f58eef18b09e61b47d0eb04c3f971c9cd039980004a81f1ab
6
+ metadata.gz: a59e63c36dd7f51f000c6a83523df03a22cf83048f5c3e3c6caaafe348b0a1e8e05c46d551e4ae4322b17abab3744ccba9bce89dc352404f86446e70c6292cce
7
+ data.tar.gz: 5cc543235a9f38a706cb633305ecf805e0749e28ff05917ced7a901933b48fc95b2411a6a6ae36b7616fac8428722bbe03c16c9e8761b895ff0824752bc0d010
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.2] - 2025-11-25
4
+
5
+ - Added onboarding profiles management ([#4](https://github.com/Treize37/lemonway_onboarding/issues/4))
6
+ - Added error handling ([#8](https://github.com/Treize37/lemonway_onboarding/issues/8))
7
+ - Updated dependencies ([#6](https://github.com/Treize37/lemonway_onboarding/issues/6))
8
+
3
9
  ## [0.1.0] - 2025-06-19
4
10
 
5
11
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lemonway_onboarding (0.2.1)
4
+ lemonway_onboarding (0.2.2)
5
5
  typhoeus (>= 1.4)
6
6
 
7
7
  GEM
@@ -24,7 +24,7 @@ GEM
24
24
  rainbow (3.1.1)
25
25
  rake (13.2.1)
26
26
  regexp_parser (2.10.0)
27
- rexml (3.4.1)
27
+ rexml (3.4.4)
28
28
  rspec (3.13.0)
29
29
  rspec-core (~> 3.13.0)
30
30
  rspec-expectations (~> 3.13.0)
@@ -74,6 +74,8 @@ GEM
74
74
 
75
75
  PLATFORMS
76
76
  x86_64-darwin-20
77
+ x86_64-darwin-22
78
+ x86_64-darwin-24
77
79
 
78
80
  DEPENDENCIES
79
81
  lemonway_onboarding!
@@ -82,4 +84,4 @@ DEPENDENCIES
82
84
  standard (~> 1.3)
83
85
 
84
86
  BUNDLED WITH
85
- 2.3.12
87
+ 2.6.9
data/README.md CHANGED
@@ -55,6 +55,14 @@ accounts = accounts_api.index(status: 'active')
55
55
  account = accounts_api.show(123)
56
56
  ```
57
57
 
58
+ #### Profiles
59
+
60
+ ```ruby
61
+ profiles_api = LemonwayOnboarding::Api::Profiles.new(client)
62
+ # Create a profile for an account
63
+ response = profiles_api.create('business', 123, { profile_type: 'admin', email: 'admin@company.com' })
64
+ ```
65
+
58
66
  #### Onboardings
59
67
 
60
68
  ```ruby
@@ -98,6 +106,13 @@ For more advanced usage and available methods, please refer to the [API document
98
106
 
99
107
  ## Development
100
108
 
109
+ ### Prerequisites
110
+
111
+ 1. [Install RVM](https://rvm.io/)
112
+ 2. Install Ruby with `rvm install` and create alias with `rvm alias create default`
113
+
114
+ ### Running
115
+
101
116
  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
117
 
103
118
  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).
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ module Api
5
+ # Profiles API for Lemonway Onboarding
6
+ class Profiles
7
+ # Initializes the Profiles API with a client.
8
+ #
9
+ # @param client [LemonwayOnboarding::Client] The client to use for API requests
10
+ # @return [LemonwayOnboarding::Api::Profiles] The initialized Profiles API
11
+ def initialize(client = LemonwayOnboarding::Client.new)
12
+ @client = client
13
+ end
14
+
15
+ # Creates a new profile.
16
+ #
17
+ # @param type [String] The type of account
18
+ # @param account_id [String] The ID of the account to associate the profile with
19
+ # @param body [Hash] The body of the request containing profile details
20
+ # @return [Hash] The response from the API containing the created profile details
21
+ def create(type, account_id, body)
22
+ @client.post("accounts/#{type}/#{account_id}/profiles", body)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -117,7 +117,7 @@ module LemonwayOnboarding
117
117
  log_response(response)
118
118
 
119
119
  if response.timed_out?
120
- raise 'Request timed out. Please check your network connection or increase the timeout.'
120
+ request_error('Request timed out. Please check your network connection or increase the timeout.', response)
121
121
  elsif response.success?
122
122
  # Return nil for DELETE requests with no body
123
123
  return nil if response.body.nil? || response.body.strip.empty?
@@ -125,10 +125,19 @@ module LemonwayOnboarding
125
125
  # Parse JSON for other successful responses
126
126
  JSON.parse(response.body)
127
127
  else
128
- raise "HTTP request failed: #{response.code} - #{response.body}"
128
+ request_error("HTTP request failed: #{response.code} - #{response.body}", response)
129
129
  end
130
130
  end
131
131
 
132
+ # Private: Raise RequestError when a request was not successful
133
+ #
134
+ # @param message [String] The message that will be given to the exception
135
+ # @param response [Typhoeus::Response] The response object from the HTTP request
136
+ # @return [void] Raise an error
137
+ def request_error(message, response)
138
+ raise Exceptions::RequestError.new(message, code: response.code, body: response.body)
139
+ end
140
+
132
141
  # Private: Logs the response details
133
142
  #
134
143
  # @param response [Typhoeus::Response] The response object from the HTTP request
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LemonwayOnboarding
4
+ module Exceptions
5
+ # All errors raised in LemonwayOnboarding should inherit from Error
6
+ class Error < StandardError; end
7
+
8
+ # Exception raised when a request was not successful
9
+ class RequestError < Error
10
+ attr_reader :code, :body
11
+
12
+ # Initialize a request error. Contains response details.
13
+ #
14
+ # @param message [String] The error message that is displayed
15
+ # @param code [Integer] The HTTP response status code
16
+ # @param body [String] The content of the response
17
+ # @return [LemonwayOnboarding::Exceptions::RequestError] An instance of RequestError
18
+ def initialize(message, code:, body:)
19
+ @code = code
20
+ @body = body
21
+ super(message)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LemonwayOnboarding
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -5,11 +5,12 @@ require 'json'
5
5
  require 'lemonway_onboarding/api/accounts'
6
6
  require 'lemonway_onboarding/api/documents'
7
7
  require 'lemonway_onboarding/api/onboardings'
8
+ require 'lemonway_onboarding/api/profiles'
8
9
  require 'lemonway_onboarding/client'
9
10
  require 'lemonway_onboarding/configuration'
10
11
  require 'lemonway_onboarding/version'
12
+ require 'lemonway_onboarding/exceptions'
11
13
 
12
14
  module LemonwayOnboarding
13
- class Error < StandardError; end
14
15
  # Your code goes here...
15
16
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lemonway_onboarding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabrice Carrega
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-07-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: typhoeus
@@ -49,8 +48,10 @@ files:
49
48
  - lib/lemonway_onboarding/api/accounts.rb
50
49
  - lib/lemonway_onboarding/api/documents.rb
51
50
  - lib/lemonway_onboarding/api/onboardings.rb
51
+ - lib/lemonway_onboarding/api/profiles.rb
52
52
  - lib/lemonway_onboarding/client.rb
53
53
  - lib/lemonway_onboarding/configuration.rb
54
+ - lib/lemonway_onboarding/exceptions.rb
54
55
  - lib/lemonway_onboarding/version.rb
55
56
  - log/.keep
56
57
  - sig/lemonway_onboarding.rbs
@@ -62,7 +63,6 @@ metadata:
62
63
  homepage_uri: https://github.com/treize37/lemonway_onboarding
63
64
  source_code_uri: https://github.com/treize37/lemonway_onboarding
64
65
  changelog_uri: https://github.com/Treize37/lemonway_onboarding/blob/main/CHANGELOG.md
65
- post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
68
68
  - lib
@@ -77,8 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
- rubygems_version: 3.3.12
81
- signing_key:
80
+ rubygems_version: 3.6.9
82
81
  specification_version: 4
83
82
  summary: Ruby wrapper for the Lemonway Onboarding API.
84
83
  test_files: []