Skip to content

Commit 0d01116

Browse files
committed
Merge pull request #104 from ryanhertz/portal-listing-cart
added PortalListingCart model
2 parents 0826614 + 2aac86b commit 0d01116

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/spark_api/models.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
require 'spark_api/models/open_house'
2525
require 'spark_api/models/photo'
2626
require 'spark_api/models/portal'
27+
require 'spark_api/models/portal_listing_cart'
2728
require 'spark_api/models/property_types'
2829
require 'spark_api/models/rental_calendar'
2930
require 'spark_api/models/saved_search'

lib/spark_api/models/listing_cart.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def Name=(name)
2020
write_attribute("Name", name)
2121
end
2222

23-
def path
23+
def self.path
2424
if @contact_id
2525
"/contacts/#{@contact_id}/listingcarts"
2626
else
@@ -35,7 +35,7 @@ def filter
3535
def listings(args = {})
3636
return [] if attributes["ListingIds"].nil?
3737
arguments = {:_filter => self.filter}.merge(args)
38-
Listing.collect(connection.get("/listingcarts/#{self.Id}/listings", arguments))
38+
Listing.collect(connection.get("#{self.path}/#{self.Id}/listings", arguments))
3939
end
4040

4141
def add_listing(listing)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module SparkApi
2+
module Models
3+
4+
class PortalListingCart < ListingCart
5+
6+
def self.find(contact_id, *arguments)
7+
@contact_id = contact_id
8+
super(*arguments)
9+
end
10+
11+
end
12+
end
13+
end

0 commit comments

Comments
 (0)