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