Skip to content

Commit e7179f7

Browse files
committed
Merge pull request #111 from ryanhertz/idx-link-finders
removed duplicate finders from IdxLink
2 parents 955e0a4 + 3d47d80 commit e7179f7

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

lib/spark_api/models/idx_link.rb

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,15 @@ class IdxLink < Base
44

55
extend Finders
66

7-
self.element_name="idxlinks"
7+
self.element_name = "idxlinks"
88

99
LINK_TYPES = ["QuickSearch", "SavedSearch", "MyListings", "Roster"]
1010

11-
#TODO Work all below into common base class
12-
def self.find(*arguments)
13-
scope = arguments.slice!(0)
14-
options = arguments.slice!(0) || {}
15-
16-
case scope
17-
when :all then find_every(options)
18-
when :first then find_every(options).first
19-
when :last then find_every(options).last
20-
when :one then find_one(options)
21-
else find_single(scope, options)
22-
end
23-
end
24-
25-
def self.first(*arguments)
26-
find(:first, *arguments)
27-
end
28-
29-
def self.last(*arguments)
30-
find(:last, *arguments)
31-
end
32-
3311
def self.default(options = {})
3412
response = connection.get("/#{self.element_name}/default", options).first
3513
response.nil? ? nil : new(response)
3614
end
3715

38-
private
39-
40-
def self.find_single(scope, options)
41-
resp = SparkApi.client.get("/idxlinks/#{scope}", options)
42-
new(resp.first)
43-
end
44-
4516
end
4617
end
4718
end

0 commit comments

Comments
 (0)