Class: SBF::Client::MessageEndpoint

Inherits:
EntityEndpoint show all
Defined in:
lib/stbaldricks/endpoints/message.rb

Instance Attribute Summary

Attributes inherited from EntityEndpoint

#orig_target_class

Instance Method Summary collapse

Methods inherited from EntityEndpoint

#aggregate, #create, #delete, #find, #find_first, #get, #initialize, #save, #update

Constructor Details

This class inherits a constructor from SBF::Client::EntityEndpoint

Instance Method Details

#mark_as_read(message_id) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
# File 'lib/stbaldricks/endpoints/message.rb', line 6

def mark_as_read(message_id)
  raise SBF::Client::Error, 'Message Id must be an Integer' unless message_id.is_a?(Integer)

  response = SBF::Client::Api::Request.post_request("#{base_uri}/mark_as_read/#{message_id}")

  error = SBF::Client::ErrorEntity.new(response) unless ok?(response)

  SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
end

#mark_as_unread(message_id) ⇒ Object

Raises:



16
17
18
19
20
21
22
23
24
# File 'lib/stbaldricks/endpoints/message.rb', line 16

def mark_as_unread(message_id)
  raise SBF::Client::Error, 'Message Id must be an Integer' unless message_id.is_a?(Integer)

  response = SBF::Client::Api::Request.post_request("#{base_uri}/mark_as_unread/#{message_id}")

  error = SBF::Client::ErrorEntity.new(response) unless ok?(response)

  SBF::Client::Api::Response.new(http_code: response.code, data: response, error: error)
end