Class: Cadenya::Types::ToolSetInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool_count: nil, agent_count: nil, last_sync: nil, created_by: nil, available_tools: nil, omitted_tools: nil) ⇒ ToolSetInfo

Returns a new instance of ToolSetInfo.



6239
6240
6241
6242
6243
6244
6245
6246
# File 'lib/cadenya/types.rb', line 6239

def initialize(tool_count: nil, agent_count: nil, last_sync: nil, created_by: nil, available_tools: nil, omitted_tools: nil)
  @tool_count = tool_count
  @agent_count = agent_count
  @last_sync = last_sync
  @created_by = created_by
  @available_tools = available_tools
  @omitted_tools = omitted_tools
end

Instance Attribute Details

#agent_countObject (readonly)

Returns the value of attribute agent_count.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def agent_count
  @agent_count
end

#available_toolsObject (readonly)

Returns the value of attribute available_tools.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def available_tools
  @available_tools
end

#created_byObject (readonly)

Returns the value of attribute created_by.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def created_by
  @created_by
end

#last_syncObject (readonly)

Returns the value of attribute last_sync.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def last_sync
  @last_sync
end

#omitted_toolsObject (readonly)

Returns the value of attribute omitted_tools.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def omitted_tools
  @omitted_tools
end

#tool_countObject (readonly)

Returns the value of attribute tool_count.



6237
6238
6239
# File 'lib/cadenya/types.rb', line 6237

def tool_count
  @tool_count
end

Class Method Details

.from_json(data) ⇒ Object



6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
# File 'lib/cadenya/types.rb', line 6248

def self.from_json(data)
  new(
    tool_count: data["toolCount"],
    agent_count: data["agentCount"],
    last_sync: data["lastSync"].nil? ? nil : Time.iso8601(data["lastSync"]),
    created_by: data["createdBy"].nil? ? nil : Types::Profile.from_json(data["createdBy"]),
    available_tools: data["availableTools"],
    omitted_tools: data["omittedTools"],
  )
end

Instance Method Details

#to_hObject



6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
# File 'lib/cadenya/types.rb', line 6259

def to_h
  {
    tool_count: Util.plain(@tool_count),
    agent_count: Util.plain(@agent_count),
    last_sync: Util.plain(@last_sync),
    created_by: Util.plain(@created_by),
    available_tools: Util.plain(@available_tools),
    omitted_tools: Util.plain(@omitted_tools),
  }.reject { |_k, v| v.nil? }
end