class SemaphoreClient::Model::EnvVar
Attributes
content[RW]
created_at[R]
encrypted[R]
id[R]
name[RW]
updated_at[R]
url[R]
Public Class Methods
create(attributes)
click to toggle source
# File lib/semaphore_client/model/env_var.rb, line 11 def self.create(attributes) new.update(attributes) end
load(attributes)
click to toggle source
# File lib/semaphore_client/model/env_var.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/env_var.rb, line 15 def load(attributes) attributes = symbolize_keys(attributes) @id = attributes[:id] if attributes.key?(:id) @name = attributes[:name] if attributes.key?(:name) @url = attributes[:url] if attributes.key?(:url) @content = attributes[:content] if attributes.key?(:content) @shared = attributes[:shared] if attributes.key?(:shared) @encrypted = attributes[:encrypted] if attributes.key?(:encrypted) @created_at = attributes[:created_at] if attributes.key?(:created_at) @updated_at = attributes[:updated_at] if attributes.key?(:updated_at) self end
serialize()
click to toggle source
# File lib/semaphore_client/model/env_var.rb, line 45 def serialize object_hash = { "name" => @name, "content" => @content, } object_hash.delete_if { |_, value| value.nil? } end
update(attributes)
click to toggle source
# File lib/semaphore_client/model/env_var.rb, line 30 def update(attributes) attributes = symbolize_keys(attributes) updatable_keys = [:name, :content] if (attributes.keys - updatable_keys).any? raise SemaphoreClient::Exceptions::AttributeNotAvailable end @name = attributes[:name] if attributes.key?(:name) @content = attributes[:content] if attributes.key?(:content) self end
Private Instance Methods
symbolize_keys(hash)
click to toggle source
# File lib/semaphore_client/model/env_var.rb, line 56 def symbolize_keys(hash) Hash[hash.map { |key, value| [key.to_sym, value] }] end