-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add customer service with retrieve method #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
53c5411
Refactor util.rb to fix rubocop issues and improve maintainability
bolom 976070b
Modify customer retrieve to return Customer object directly instead o…
bolom 90d3cc5
Add missing service files to fix LoadError
bolom 46de8eb
Add dynamic method handling to all resource classes
bolom 3cb730c
Add webhook resource pattern and example scripts
bolom f60814e
Add webhook update example and fix PUT request handling
bolom c8b96ab
Fix RuboCop offenses - line length and complexity issues
bolom e1ea30e
Remove exemples directory and refactor service initializers
bolom eb884c5
Remove unnecessary require statements in wallet_service.rb
bolom 698e38e
Refactor dynamic attribute access to base resource
bolom 94c0f56
Fix require path and update webhook retrieval logic
bolom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,3 +173,5 @@ config/private.json | |
| config/keys.json | ||
| stripe-ruby/ | ||
| *.md | ||
| /exemples | ||
| /exemples | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,3 +16,5 @@ group :development do | |
| gem 'webmock', '~> 3.26' | ||
| gem 'yard', '~> 0.9.37' | ||
| end | ||
|
|
||
| gem 'dotenv', '~> 3.1' | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ def destination | |
| @values[:destination] | ||
| end | ||
|
|
||
|
|
||
| private | ||
|
|
||
| # Parse a datetime string to a Time object | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ def balances | |
| @values[:balances] || [] | ||
| end | ||
|
|
||
|
|
||
| private | ||
|
|
||
| # Parse a datetime string to a Time object | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # frozen_string_literal: true | ||
| module BridgeApi | ||
| module Services | ||
| class BaseService | ||
| def initialize(client) | ||
| @client = client | ||
| end | ||
|
|
||
| protected | ||
|
|
||
| def request(method, endpoint, params = {}, idempotency_key: nil) | ||
| if idempotency_key | ||
| @client.send(:request_with_idempotency, method, endpoint, params, idempotency_key) | ||
| else | ||
| @client.send(:request, method, endpoint, params) | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # frozen_string_literal: true | ||
| module BridgeApi | ||
| module Services | ||
| class CustomerService < BaseService | ||
| def create(params = {}, idempotency_key: nil) | ||
| request(:post, 'customers', params, idempotency_key: idempotency_key) | ||
| end | ||
|
|
||
| def retrieve(id, params = {}) | ||
| response = request(:get, "customers/#{id}", params) | ||
| return response unless response.success? | ||
|
|
||
| # Return a Customer object directly if the request was successful | ||
| BridgeApi::Resources::Customer.construct_from(response.data) | ||
| end | ||
|
|
||
| def list(params = {}) | ||
| request(:get, 'customers', params) | ||
| end | ||
|
|
||
| def update(id, params = {}, idempotency_key: nil) | ||
| request(:patch, "customers/#{id}", params, idempotency_key: idempotency_key) | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.