Class: SemaphoreClient::Model::Secret

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_files_urlObject (readonly)

Returns the value of attribute config_files_url.



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

def config_files_url
  @config_files_url
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#env_vars_urlObject (readonly)

Returns the value of attribute env_vars_url.



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

def env_vars_url
  @env_vars_url
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#projects_urlObject (readonly)

Returns the value of attribute projects_url.



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

def projects_url
  @projects_url
end

#teams_urlObject (readonly)

Returns the value of attribute teams_url.



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

def teams_url
  @teams_url
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.create(attributes) ⇒ Object



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

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

.load(attributes) ⇒ Object



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

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

Instance Method Details

#load(attributes) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/semaphore_client/model/secret.rb', line 15

def load(attributes)
  attributes = symbolize_keys(attributes)

  @name = attributes[:name] if attributes.key?(:name)
  @description = attributes[:description] if attributes.key?(:description)
  @id = attributes[:id] if attributes.key?(:id)
  @url = attributes[:url] if attributes.key?(:url)
  @projects_url = attributes[:projects_url] if attributes.key?(:projects_url)
  @teams_url = attributes[:teams_url] if attributes.key?(:teams_url)
  @env_vars_url = attributes[:env_vars_url] if attributes.key?(:env_vars_url)
  @config_files_url = attributes[:config_files_url] if attributes.key?(:config_files_url)
  @created_at = attributes[:created_at] if attributes.key?(:created_at)
  @updated_at = attributes[:updated_at] if attributes.key?(:updated_at)

  self
end

#serializeObject



47
48
49
50
51
52
53
54
# File 'lib/semaphore_client/model/secret.rb', line 47

def serialize
  object_hash = {
    "name" => @name,
    "description" => @description,
  }

  object_hash.delete_if { |_, value| value.nil? }
end

#update(attributes) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/semaphore_client/model/secret.rb', line 32

def update(attributes)
  attributes = symbolize_keys(attributes)

  updatable_keys = [:name, :description]

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

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

  self
end