Class: Mackerel::Dashboard

Inherits:
Object
  • Object
show all
Defined in:
lib/mackerel/dashboard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Dashboard

Returns a new instance of Dashboard.



5
6
7
8
9
10
11
12
# File 'lib/mackerel/dashboard.rb', line 5

def initialize(args = {})
  @id                              = args["id"]
  @title                           = args["title"]
  @bodyMarkdown                    = args["bodyMarkdown"]
  @urlPath                         = args["urlPath"]
  @createdAt                       = args["createdAt"]
  @updatedAt                       = args["updatedAt"]
end

Instance Attribute Details

#bodyMarkdownObject

Returns the value of attribute bodyMarkdown.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def bodyMarkdown
  @bodyMarkdown
end

#createdAtObject

Returns the value of attribute createdAt.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def createdAt
  @createdAt
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def id
  @id
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def title
  @title
end

#updatedAtObject

Returns the value of attribute updatedAt.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def updatedAt
  @updatedAt
end

#urlPathObject

Returns the value of attribute urlPath.



4
5
6
# File 'lib/mackerel/dashboard.rb', line 4

def urlPath
  @urlPath
end

Instance Method Details

#to_hObject



14
15
16
17
18
19
20
# File 'lib/mackerel/dashboard.rb', line 14

def to_h
  instance_variables.flat_map do |name|
    respond_to?(name[1..-1]) ? [name[1..-1]] : []
  end.each_with_object({}) do |name, hash|
    hash[name] = public_send(name)
  end.delete_if { |key, val| val == nil }
end

#to_json(options = nil) ⇒ Object



22
23
24
# File 'lib/mackerel/dashboard.rb', line 22

def to_json(options = nil)
  return to_h.to_json(options)
end