Class: SemaphoreClient::Model::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/semaphore_client/model/pipeline.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/semaphore_client/model/pipeline.rb', line 4

def id
  @id
end

#terminate_requestObject

Returns the value of attribute terminate_request.



5
6
7
# File 'lib/semaphore_client/model/pipeline.rb', line 5

def terminate_request
  @terminate_request
end

Class Method Details

.create(attributes) ⇒ Object



11
12
13
# File 'lib/semaphore_client/model/pipeline.rb', line 11

def self.create(attributes)
  new.update(attributes)
end

.load(attributes) ⇒ Object



7
8
9
# File 'lib/semaphore_client/model/pipeline.rb', line 7

def self.load(attributes)
  new.load(attributes)
end

Instance Method Details

#load(attributes) ⇒ Object



15
16
17
18
19
20
21
# 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

#serializeObject



37
38
39
40
41
42
43
# 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) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# 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