-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding redeployment of existing deployments
Signed-off-by: Gary Paige <[email protected]>
- Loading branch information
1 parent
db8d38e
commit d2c5e81
Showing
10 changed files
with
140 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
class DeploymentDetailSerializer < ActiveModel::Serializer | ||
self.root = false | ||
|
||
attributes :id, :status, :name | ||
attributes :id, :status, :name, :redeployable | ||
|
||
def redeployable | ||
object.redeployable? | ||
end | ||
|
||
end |
This file contains 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,9 @@ | ||
class DeploymentSerializer < ActiveModel::Serializer | ||
self.root = false | ||
|
||
attributes :id, :name, :service_ids, :redeployable | ||
|
||
def redeployable | ||
object.redeployable? | ||
end | ||
end |
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
Rails.application.routes.draw do | ||
resources :deployments, only: [:index, :create, :show, :destroy] | ||
resources :deployments, only: [:index, :create, :show, :destroy] do | ||
member do | ||
post :redeploy | ||
end | ||
end | ||
|
||
resource :metadata, only: :show | ||
end |
This file contains 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 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 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 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,16 @@ | ||
require 'spec_helper' | ||
|
||
describe DeploymentSerializer do | ||
let(:deployment_model) { Deployment.new } | ||
|
||
it 'exposes the attributes to be jsonified' do | ||
serialized = described_class.new(deployment_model).as_json | ||
expected_keys = [ | ||
:id, | ||
:name, | ||
:service_ids, | ||
:redeployable | ||
] | ||
expect(serialized.keys).to match_array expected_keys | ||
end | ||
end |