Skip to content

Commit

Permalink
Merge pull request #77 from abhishek-sage/feature/workflow-status
Browse files Browse the repository at this point in the history
added new method into workflow_status to include children of workflow statuses
  • Loading branch information
lockstep-rakesh authored May 29, 2024
2 parents 926ef14 + c659047 commit fc5bef8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
lockstep_rails (0.3.84)
lockstep_rails (0.3.85)
rails

GEM
Expand Down
18 changes: 18 additions & 0 deletions app/models/lockstep/workflow_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,22 @@ class Lockstep::WorkflowStatus < Lockstep::ApiRecord
self.id_ref = 'id'

load_schema(Schema::WorkflowStatus)

def self.retrieve_by_id_with_children(id)
resp = resource.get("#{id}", params: { include: :children })
parsed_response = JSON.parse(resp.body)

case resp.code.to_s
when '401'
raise Lockstep::Exceptions::UnauthorizedError, parsed_response['title']
when '400'
raise Lockstep::Exceptions::BadRequestError, parsed_response['title']
when '404'
raise Lockstep::Exceptions::RecordNotFound, parsed_response['title']
when '200'
parsed_response.deep_transform_keys(&:underscore)
else
raise Lockstep::Exceptions::BadRequestError, parsed_response
end
end
end
2 changes: 1 addition & 1 deletion lib/lockstep_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LockstepRails
VERSION = '0.3.84'
VERSION = '0.3.85'
end

0 comments on commit fc5bef8

Please sign in to comment.