Class: Pushnote::Note

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pushnote/note.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNote

Returns a new instance of Note.



12
13
14
# File 'lib/pushnote/note.rb', line 12

def initialize
  set_server_host(configuration.server)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



9
10
11
# File 'lib/pushnote/note.rb', line 9

def body
  @body
end

#df_reportObject (readonly)

Returns the value of attribute df_report.



10
11
12
# File 'lib/pushnote/note.rb', line 10

def df_report
  @df_report
end

#titleObject

Returns the value of attribute title.



9
10
11
# File 'lib/pushnote/note.rb', line 9

def title
  @title
end

#top_reportObject (readonly)

Returns the value of attribute top_report.



10
11
12
# File 'lib/pushnote/note.rb', line 10

def top_report
  @top_report
end

Instance Method Details

#collect_system_infoObject



24
25
26
27
28
29
# File 'lib/pushnote/note.rb', line 24

def collect_system_info
  [
    Thread.new { create_top_report },
    Thread.new { create_df_report }
  ].each(&:join)
end

#saveObject



16
17
18
# File 'lib/pushnote/note.rb', line 16

def save
  self.class.post('/', { body: serialize.to_json })
end

#set_server_host(host) ⇒ Object



20
21
22
# File 'lib/pushnote/note.rb', line 20

def set_server_host(host)
  self.class.base_uri(host)
end