Class: The86::Client::Conversation

Inherits:
Resource
  • Object
show all
Includes:
CanBeHidden
Defined in:
lib/the86-client/conversation.rb

Instance Attribute Summary

Attributes inherited from Resource

#oauth_token, #parent

Instance Method Summary collapse

Methods included from CanBeHidden

#hide, #unhide

Methods inherited from Resource

#==, accepts_nested_attributes_for, belongs_to, collection_path, #delete!, has_many, has_one, #load, model_name, #patch, path, #persisted?, #resource_path, #save, #sendable_attributes, #to_key, #to_model, #to_param, #url_id

Instance Method Details

#mute(attributes = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/the86-client/conversation.rb', line 20

def mute(attributes={})
  unless attributes[:oauth_token]
    raise Error, "Conversations must be hidden by a user"
  end
  self.oauth_token = attributes[:oauth_token]
  connection.post(
    path: resource_path << "/mute",
    data: sendable_attributes,
    status: 200
  ).data
end

#set_metadata(attributes = {}) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/the86-client/conversation.rb', line 32

def (attributes={})
  connection.patch(
    path: resource_path << "/metadata",
    data: attributes,
    status: 204
  )
end