class SemaphoreClient::Model::Pipeline

Attributes

id[R]
terminate_request[RW]

Public Class Methods

create(attributes) click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 11
def self.create(attributes)
  new.update(attributes)
end
load(attributes) click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 7
def self.load(attributes)
  new.load(attributes)
end

Public Instance Methods

load(attributes) click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 15
def load(attributes)
  attributes = symbolize_keys(attributes)

  @id = attributes[:id] if attributes.key?(:id)

  self
end
serialize() click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 37
def serialize
  object_hash = {
    "terminate_request" => @terminate_request,
  }

  object_hash.delete_if { |_, value| value.nil? }
end
update(attributes) click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 23
def update(attributes)
  attributes = symbolize_keys(attributes)

  updatable_keys = [:terminate_request]

  if (attributes.keys - updatable_keys).any?
    raise SemaphoreClient::Exceptions::AttributeNotAvailable
  end

  @terminate_request = attributes[:terminate_request] if attributes.key?(:terminate_request)

  self
end

Private Instance Methods

symbolize_keys(hash) click to toggle source
# File lib/semaphore_client/model/pipeline.rb, line 47
def symbolize_keys(hash)
  Hash[hash.map { |key, value| [key.to_sym, value] }]
end