Class: Hashblue::Message

Inherits:
Model
  • Object
show all
Defined in:
lib/hashblue/message.rb

Instance Attribute Summary

Attributes inherited from Model

#client

Instance Method Summary collapse

Methods inherited from Model

attribute_methods, #attributes, build, #eql?, #initialize

Constructor Details

This class inherits a constructor from Hashblue::Model

Instance Method Details

#contactObject



5
6
7
# File 'lib/hashblue/message.rb', line 5

def contact
  @contact ||= Contact.build(client, @attributes["contact"])
end

#delete!Object



17
18
19
# File 'lib/hashblue/message.rb', line 17

def delete!
  client.delete(uri)
end

#favourite!Object



21
22
23
24
25
# File 'lib/hashblue/message.rb', line 21

def favourite!
  client.put(uri + '/favourite', {}, {})
  @attributes['favourite'] = true
  true
end

#favourite?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/hashblue/message.rb', line 13

def favourite?
  @attributes["favourite"]
end

#sent?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/hashblue/message.rb', line 9

def sent?
  @attributes["sent"]
end

#unfavourite!Object



27
28
29
30
31
# File 'lib/hashblue/message.rb', line 27

def unfavourite!
  client.delete(uri + '/favourite')
  @attributes['favourite'] = false
  true
end