-
Notifications
You must be signed in to change notification settings - Fork 13
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
Query params in status api #80
Conversation
@@ -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 = {}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Added query params in status api