-
Notifications
You must be signed in to change notification settings - Fork 34
API Models
wlmcewen edited this page Nov 7, 2012
·
5 revisions
The client also provides ActiveModel-like interface for working with the api responses. Notably, the models use finder methods for searching, and similar instanciation and persistence also on supported services.
# Tip: mixin the models so you can use them without namespaces
include SparkApi::Models
listings = Listing.find(:all, :_filter => "ListPrice Gt 150000.0 And ListPrice Lt 200000.0", :_orderby => "-ListPrice")
puts "Top list price: $%.2f" % listings.first.ListPrice
# Top list price: $199999.99
puts Account.find(:first, :_filter => "UserType Eq 'Member' And Name Eq 'John*'").Name
# John Doe