Class: FlexmlsApi::Models::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/flexmls_api/models/message.rb

Constant Summary

Constants included from Paginate

Paginate::DEFAULT_PAGE_SIZE

Instance Attribute Summary

Attributes inherited from Base

#attributes, #changed, #errors

Instance Method Summary collapse

Methods inherited from Base

#connection, connection, count, element_name, element_name=, first, get, #initialize, #load, #method_missing, #parse_id, path, prefix, prefix=, #respond_to?

Methods included from Paginate

#collect, #paginate, #per_page

Constructor Details

This class inherits a constructor from FlexmlsApi::Models::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FlexmlsApi::Models::Base

Instance Method Details

#save(arguments = {}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/flexmls_api/models/message.rb', line 6

def save(arguments={})
  begin
    return save!(arguments)
  rescue NotFound, BadResourceRequest => e
    FlexmlsApi.logger.error("Failed to save resource #{self}: #{e.message}")
  end
  false
end

#save!(arguments = {}) ⇒ Object



14
15
16
17
# File 'lib/flexmls_api/models/message.rb', line 14

def save!(arguments={})
  results = connection.post self.class.path, {"Messages" => [ attributes ]}, arguments
  true
end