Class: FlexmlsApi::Models::SharedListing

Inherits:
Base
  • Object
show all
Extended by:
Finders
Defined in:
lib/flexmls_api/models/shared_listing.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 included from Finders

find, first, last

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

#ListingIds=(listing_ids) ⇒ Object



7
8
9
# File 'lib/flexmls_api/models/shared_listing.rb', line 7

def ListingIds=(listing_ids)
  attributes["ListingIds"] = Array(listing_ids)
end

#ReportId=(id) ⇒ Object



13
14
15
# File 'lib/flexmls_api/models/shared_listing.rb', line 13

def ReportId=(id)
  attributes["ReportId"] = id
end

#save(arguments = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/flexmls_api/models/shared_listing.rb', line 17

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

#save!(arguments = {}) ⇒ Object



27
28
29
30
31
32
# File 'lib/flexmls_api/models/shared_listing.rb', line 27

def save!(arguments={})
  results = connection.post self.class.path, attributes, arguments
  result = results.first
  attributes['ResourceUri'] = result['ResourceUri']
  true
end

#ViewId=(id) ⇒ Object



10
11
12
# File 'lib/flexmls_api/models/shared_listing.rb', line 10

def ViewId=(id)
  attributes["ViewId"] = id
end