Skip to content
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

Query params in status api #80

Conversation

AshishTI23
Copy link
Contributor

@AshishTI23 AshishTI23 commented Oct 22, 2024

Added query params in status api

@@ -1,8 +1,8 @@
class Lockstep::Status
Lockstep::ApiRecord.model_name_uri = 'v1/Status'

def self.ping
resp = Lockstep::ApiRecord.resource.get('')
def self.ping(query_params = {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a splat operator here rather than passing arguments?

def self.ping(**params)
  resp = Lockstep::ApiRecord.resource.get('', params: params)
end

So this can be used as Lockstep::Status.ping(useCompanyInfo: true) rather than adding passing an explicit hash.

Copy link

@Sage-Ashish Sage-Ashish Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added in this way to avoid changes here for future addition in params . In case of new addition in params we will not have to make changes here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo, I don't think there'd be much future additions other than params (as status won't ever have sorting or filtering) so it should be fine to make it into a splat argument, and if it changes, we can handle it accordingly :)

Copy link

@Sage-Ashish Sage-Ashish Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter itself was not there in the status and got added, I m trying to avoid gem changes if anything comes again.

@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LockstepRails
VERSION = '0.3.87'
VERSION = '0.3.88'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think you'd need to update the schema for the gem?

Copy link

@Sage-Ashish Sage-Ashish Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the past I have faced if we don't update it, It did not update in rubygem. This is being followed in each PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm talking about this file! But that's fine seems to not be a problem for this PR.

https://github.com/Lockstep-Network/lockstep-sdk-ruby-rails/blob/main/app/platform_api/swagger.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my bad, We are not adding any model changes so it is not required here.

Copy link
Contributor

@abhishek-sage abhishek-sage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. Just make sure, no invalid value is given to query params, it should be properly handled from the caller.

@lockstep-rakesh lockstep-rakesh merged commit 19b85a2 into Lockstep-Network:main Oct 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants