you_got_listed 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/you_got_listed/accounts.rb +2 -2
- data/lib/you_got_listed/agent.rb +6 -6
- data/lib/you_got_listed/client.rb +5 -5
- data/lib/you_got_listed/complex.rb +6 -6
- data/lib/you_got_listed/complexes.rb +8 -8
- data/lib/you_got_listed/error.rb +4 -4
- data/lib/you_got_listed/lead.rb +3 -3
- data/lib/you_got_listed/listing.rb +15 -14
- data/lib/you_got_listed/listings.rb +13 -13
- data/lib/you_got_listed/resource.rb +5 -5
- data/lib/you_got_listed/response.rb +19 -8
- data/lib/you_got_listed/version.rb +1 -1
- data/lib/you_got_listed.rb +0 -1
- data/spec/fixtures/responses/blank.xml +0 -0
- data/spec/fixtures/responses/empty.xml +2 -0
- data/spec/you_got_listed/accounts_spec.rb +5 -5
- data/spec/you_got_listed/agent_spec.rb +14 -14
- data/spec/you_got_listed/client_spec.rb +4 -4
- data/spec/you_got_listed/complex_spec.rb +5 -5
- data/spec/you_got_listed/complexes_spec.rb +13 -13
- data/spec/you_got_listed/error_spec.rb +2 -2
- data/spec/you_got_listed/lead_spec.rb +6 -6
- data/spec/you_got_listed/listing_spec.rb +82 -20
- data/spec/you_got_listed/listings_spec.rb +69 -33
- data/spec/you_got_listed/resource_spec.rb +3 -3
- data/spec/you_got_listed/response_spec.rb +52 -24
- data/you_got_listed.gemspec +1 -2
- metadata +20 -32
data/lib/you_got_listed/agent.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Agent < Resource
|
3
|
-
|
3
|
+
|
4
4
|
def find_all
|
5
5
|
process_get("/agents/search.php")
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def find_by_id(agent_id)
|
9
9
|
get_agent(agent_id)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def find(agent_id)
|
13
13
|
get_agent(agent_id, true)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
private
|
17
|
-
|
17
|
+
|
18
18
|
def get_agent(agent_id, raise_error = false)
|
19
19
|
params = {:id => agent_id}
|
20
20
|
process_get("/agents/search.php", params, raise_error)
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
end
|
24
24
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Client
|
3
|
-
|
3
|
+
|
4
4
|
include HTTParty
|
5
5
|
format :xml
|
6
6
|
base_uri "https://www.yougotlistings.com/api"
|
7
|
-
|
7
|
+
|
8
8
|
attr_accessor :api_key
|
9
|
-
|
9
|
+
|
10
10
|
def initialize(api_key)
|
11
11
|
self.class.default_params :key => api_key
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def perform_request(http_method, path, params = {})
|
15
15
|
begin
|
16
16
|
self.class.send(http_method, path, :query => params)
|
@@ -20,6 +20,6 @@ module YouGotListed
|
|
20
20
|
{"YGLResponse" => {"responseCode" => "999", "Error" => "Unknown Error"}}
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
end
|
25
25
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Complex
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :client
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(listing, client)
|
7
7
|
listing.each do |key, value|
|
8
8
|
self.instance_variable_set('@'+key, value)
|
@@ -10,7 +10,7 @@ module YouGotListed
|
|
10
10
|
end
|
11
11
|
self.client = client
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def properties
|
15
15
|
return [] if self.listings.blank?
|
16
16
|
props = []
|
@@ -25,11 +25,11 @@ module YouGotListed
|
|
25
25
|
end
|
26
26
|
props
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def pictures
|
30
30
|
self.photos.photo unless self.photos.blank? || self.photos.photo.blank?
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def find_address(address_id)
|
34
34
|
if addresses.address.is_a?(Array)
|
35
35
|
addresses.address.find{|address| address.id == address_id}
|
@@ -37,6 +37,6 @@ module YouGotListed
|
|
37
37
|
addresses.address
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
end
|
42
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Complexes < Resource
|
3
|
-
|
3
|
+
|
4
4
|
def search(params = {})
|
5
5
|
params[:page_count] ||= 20
|
6
6
|
params[:page_index] ||= 1
|
@@ -9,22 +9,22 @@ module YouGotListed
|
|
9
9
|
params[:detail_level] ||= 2
|
10
10
|
SearchResponse.new(self.client.perform_request(:get, '/complexes/search.php', params), self.client, params[:page_count])
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def find_by_id(complex_id)
|
14
14
|
response = SearchResponse.new(self.client.perform_request(:get, '/complexes/search.php', {:complex_id => complex_id}), self.client, 20)
|
15
15
|
(response.success? && response.property_complexes.size > 0) ? response.property_complexes.first : nil
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
class SearchResponse < YouGotListed::Response
|
19
|
-
|
19
|
+
|
20
20
|
attr_accessor :limit, :paginator_cache, :client
|
21
|
-
|
21
|
+
|
22
22
|
def initialize(response, client, limit = 20, raise_error = false)
|
23
23
|
super(response, raise_error)
|
24
24
|
self.limit = limit
|
25
25
|
self.client = client
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def property_complexes
|
29
29
|
return [] if self.ygl_response.complexes.blank?
|
30
30
|
props = []
|
@@ -37,7 +37,7 @@ module YouGotListed
|
|
37
37
|
end
|
38
38
|
props
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def paginator
|
42
42
|
paginator_cache if paginator_cache
|
43
43
|
self.paginator_cache = WillPaginate::Collection.create(
|
@@ -48,6 +48,6 @@ module YouGotListed
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
end
|
53
53
|
end
|
data/lib/you_got_listed/error.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Error < Exception
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :code, :error
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(code, error)
|
7
7
|
@code = code
|
8
8
|
@error = error
|
9
9
|
super(message)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def message
|
13
13
|
"YouGotListed Error: #{@error} (code: #{@code})"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
end
|
17
17
|
end
|
data/lib/you_got_listed/lead.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Lead < Resource
|
3
|
-
|
3
|
+
|
4
4
|
def create(lead_params = {}, raise_error = false)
|
5
5
|
process_post("/leads/insert.php", lead_params, raise_error)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def create!(lead_params = {})
|
9
9
|
create(lead_params, true)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
end
|
13
13
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Listing
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :client
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(listing, client)
|
7
7
|
listing.each do |key, value|
|
8
8
|
self.instance_variable_set('@'+key, value)
|
@@ -12,22 +12,23 @@ module YouGotListed
|
|
12
12
|
end
|
13
13
|
self.client = client
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def similar_listings(limit = 6)
|
17
17
|
min_baths = ((self.baths.to_i - 1) <= 0 ? 0 : (self.baths.to_i - 1))
|
18
18
|
max_baths = self.baths.to_i + 1
|
19
19
|
min_rent = (self.price.to_i * 0.9).to_i
|
20
20
|
max_rent = (self.price.to_i * 1.1).to_i
|
21
|
+
min_beds = ((self.beds.to_i - 1) <= 0 ? 0 : (self.beds.to_i - 1))
|
22
|
+
max_beds = self.beds.to_i + 1
|
21
23
|
search_params = {
|
22
24
|
:limit => limit + 1,
|
23
25
|
:min_rent => min_rent,
|
24
26
|
:max_rent => max_rent,
|
25
|
-
:min_bed =>
|
26
|
-
:max_bed =>
|
27
|
+
:min_bed => min_beds,
|
28
|
+
:max_bed => max_beds,
|
27
29
|
:baths => [min_baths, self.baths, max_baths].join(','),
|
28
30
|
:city_neighborhood => self.city_neighborhood
|
29
31
|
}
|
30
|
-
|
31
32
|
similar = []
|
32
33
|
listings = YouGotListed::Listings.new(self.client)
|
33
34
|
listings.search(search_params).properties.each do |prop|
|
@@ -36,38 +37,38 @@ module YouGotListed
|
|
36
37
|
end
|
37
38
|
similar
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
def town_neighborhood
|
41
42
|
str = self.city
|
42
43
|
str += " - #{neighborhood}" unless self.neighborhood.blank?
|
43
44
|
str
|
44
45
|
end
|
45
|
-
|
46
|
+
|
46
47
|
def city_neighborhood
|
47
48
|
str = self.city
|
48
49
|
str += ":#{neighborhood}" unless self.neighborhood.blank?
|
49
50
|
str
|
50
51
|
end
|
51
|
-
|
52
|
+
|
52
53
|
def pictures
|
53
54
|
(self.photos.photo.is_a?(Array) ? self.photos.photo : [self.photos.photo]) unless self.photos.blank? || self.photos.photo.blank?
|
54
55
|
end
|
55
|
-
|
56
|
+
|
56
57
|
def main_picture
|
57
58
|
pictures.first if pictures
|
58
59
|
end
|
59
|
-
|
60
|
+
|
60
61
|
def mls_listing?
|
61
62
|
source && source == "MLS"
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
def latitude
|
65
66
|
@latitude.to_f unless @latitude.blank?
|
66
67
|
end
|
67
|
-
|
68
|
+
|
68
69
|
def longitude
|
69
70
|
@longitude.to_f unless @longitude.blank?
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
end
|
73
74
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Listings < Resource
|
3
|
-
|
3
|
+
|
4
4
|
def search(params = {})
|
5
5
|
params[:page_count] ||= 20
|
6
6
|
params[:page_index] ||= 1
|
@@ -9,7 +9,7 @@ module YouGotListed
|
|
9
9
|
params[:detail_level] ||= 2
|
10
10
|
SearchResponse.new(self.client.perform_request(:get, '/rentals/search.php', params), self.client, params[:page_count])
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def featured(params = {}, featured_tag = 'Featured Rentals')
|
14
14
|
if params[:tags].blank?
|
15
15
|
params[:tags] = featured_tag
|
@@ -18,13 +18,13 @@ module YouGotListed
|
|
18
18
|
end
|
19
19
|
search(params)
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def find_by_id(listing_id)
|
23
23
|
params = {:listing_id => listing_id, :detail_level => 2}
|
24
24
|
response = SearchResponse.new(self.client.perform_request(:get, '/rentals/search.php', params), self.client, 20)
|
25
25
|
(response.success? && response.properties.size > 0) ? response.properties.first : nil
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def find_all(params = {})
|
29
29
|
params[:page_count] ||= 20
|
30
30
|
all_listings = []
|
@@ -43,7 +43,7 @@ module YouGotListed
|
|
43
43
|
end
|
44
44
|
all_listings.flatten
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def find_all_by_ids(listing_ids, include_off_market = true)
|
48
48
|
listing_ids = listing_ids.split(',') if listing_ids.is_a?(String)
|
49
49
|
all_listings = []
|
@@ -61,19 +61,19 @@ module YouGotListed
|
|
61
61
|
end
|
62
62
|
all_listings.compact.flatten
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
class SearchResponse < YouGotListed::Response
|
66
|
-
|
66
|
+
|
67
67
|
attr_accessor :limit, :paginator_cache, :client
|
68
|
-
|
68
|
+
|
69
69
|
def initialize(response, client, limit = 20, raise_error = false)
|
70
70
|
super(response, raise_error)
|
71
71
|
self.limit = limit
|
72
72
|
self.client = client
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def properties
|
76
|
-
return [] if self.ygl_response.listings.blank?
|
76
|
+
return [] if !self.success? || self.ygl_response.listings.blank?
|
77
77
|
props = []
|
78
78
|
if self.ygl_response.listings.listing.is_a?(Array)
|
79
79
|
self.ygl_response.listings.listing.each do |listing|
|
@@ -84,11 +84,11 @@ module YouGotListed
|
|
84
84
|
end
|
85
85
|
props
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def mls_results?
|
89
89
|
@has_mls_properties ||= properties.any?{|property| property.mls_listing?}
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def paginator
|
93
93
|
paginator_cache if paginator_cache
|
94
94
|
self.paginator_cache = WillPaginate::Collection.create(
|
@@ -99,6 +99,6 @@ module YouGotListed
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
end
|
104
104
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Resource
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :client
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(client)
|
7
7
|
self.client = client
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def process_get(path, params = {}, raise_error = false)
|
11
11
|
Response.new(self.client.perform_request(:get, path, params), raise_error)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def process_post(path, params = {}, raise_error = false)
|
15
15
|
Response.new(self.client.perform_request(:post, path, params), raise_error)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
end
|
19
19
|
end
|
@@ -1,18 +1,29 @@
|
|
1
1
|
module YouGotListed
|
2
2
|
class Response
|
3
|
-
|
3
|
+
|
4
4
|
attr_accessor :ygl_response
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(response, raise_error = true)
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
if !response.respond_to?(:each_pair)
|
8
|
+
self.ygl_response = nil
|
9
|
+
raise Error.new('empty_response', 'Empty Response') if raise_error
|
10
|
+
else
|
11
|
+
rash = Hashie::Rash.new(response)
|
12
|
+
self.ygl_response = rash.ygl_response
|
13
|
+
if !success? && raise_error
|
14
|
+
if self.ygl_response.respond_to?(:response_code)
|
15
|
+
raise Error.new(self.ygl_response.response_code, self.ygl_response.error)
|
16
|
+
else
|
17
|
+
raise Error.new('empty_response', 'Empty Response')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
10
21
|
end
|
11
|
-
|
22
|
+
|
12
23
|
def success?
|
13
24
|
self.ygl_response && self.ygl_response.respond_to?(:response_code) && self.ygl_response.response_code.to_i < 300
|
14
25
|
end
|
15
|
-
|
26
|
+
|
16
27
|
def method_missing(method_name, *args)
|
17
28
|
if self.ygl_response.respond_to?(method_name)
|
18
29
|
self.ygl_response.send(method_name)
|
@@ -20,6 +31,6 @@ module YouGotListed
|
|
20
31
|
super
|
21
32
|
end
|
22
33
|
end
|
23
|
-
|
34
|
+
|
24
35
|
end
|
25
36
|
end
|
data/lib/you_got_listed.rb
CHANGED
File without changes
|
@@ -1,26 +1,26 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe YouGotListed::Accounts do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
@ygl = new_ygl
|
7
7
|
@accounts = YouGotListed::Accounts.new(@ygl)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
context "search" do
|
11
11
|
before do
|
12
12
|
VCR.use_cassette('accounts.search') do
|
13
13
|
@response = @accounts.search
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should be a success" do
|
18
18
|
@response.success?.should be_true
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should set accounts on the response" do
|
22
22
|
@response.ygl_response.accounts.should be_kind_of(Hashie::Rash)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
end
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe YouGotListed::Agent do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
@ygl = new_ygl
|
7
7
|
@agent = YouGotListed::Agent.new(@ygl)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
context "find_all" do
|
11
11
|
before do
|
12
12
|
VCR.use_cassette('agent.find_all') do
|
13
13
|
@response = @agent.find_all
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should be a success" do
|
18
18
|
@response.success?.should be_true
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should return an array of agents" do
|
22
22
|
@response.agents.agent.should_not be_nil
|
23
23
|
@response.agents.agent.should be_kind_of(Array)
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
context "successful find" do
|
28
28
|
before do
|
29
29
|
VCR.use_cassette('agent.find_all') do
|
@@ -33,17 +33,17 @@ describe YouGotListed::Agent do
|
|
33
33
|
@response = @agent.find(@valid_agent_id)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
it "should be a success" do
|
38
38
|
@response.success?.should be_true
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "should return an array of agents" do
|
42
42
|
@response.agents.agent.should_not be_nil
|
43
43
|
@response.agents.agent.should be_kind_of(Hashie::Rash)
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
context "unsuccessful find" do
|
48
48
|
it "should raise an exception" do
|
49
49
|
lambda {
|
@@ -53,7 +53,7 @@ describe YouGotListed::Agent do
|
|
53
53
|
}.should raise_exception(YouGotListed::Error, "YouGotListed Error: Invalid user id. (code: 301)")
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
context "successful find_by_id" do
|
58
58
|
before do
|
59
59
|
VCR.use_cassette('agent.find_all') do
|
@@ -63,17 +63,17 @@ describe YouGotListed::Agent do
|
|
63
63
|
@response = @agent.find_by_id(@valid_agent_id)
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
it "should be a success" do
|
68
68
|
@response.success?.should be_true
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
it "should return an array of agents" do
|
72
72
|
@response.agents.agent.should_not be_nil
|
73
73
|
@response.agents.agent.should be_kind_of(Hashie::Rash)
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
context "unsuccessful find_by_id" do
|
78
78
|
it "should raise an exception" do
|
79
79
|
lambda {
|
@@ -82,7 +82,7 @@ describe YouGotListed::Agent do
|
|
82
82
|
end
|
83
83
|
}.should_not raise_exception
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
it "should not be a success" do
|
87
87
|
VCR.use_cassette('agent.find.error') do
|
88
88
|
@response = @agent.find_by_id('AG-001-0499957')
|
@@ -90,5 +90,5 @@ describe YouGotListed::Agent do
|
|
90
90
|
@response.success?.should be_false
|
91
91
|
end
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe YouGotListed::Client do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
@ygl = new_ygl
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
it "should set the api_key" do
|
10
10
|
@ygl.class.default_params.should == {:key => YGL_API_KEY}
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "should set the base uri" do
|
14
14
|
@ygl.class.base_uri.should == "https://www.yougotlistings.com/api"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe YouGotListed::Complex do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
6
|
@ygl = new_ygl
|
7
7
|
@complex = YouGotListed::Complex.new(valid_complex_rash, @ygl)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
it "should return photos for pictures" do
|
11
11
|
@complex.pictures.should == @complex.photos.photo
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
it "should create methods from all hash keys" do
|
15
15
|
@complex.should respond_to("id", "name", "addresses", "public_notes", "photos", "listings")
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should return an array of properties" do
|
19
19
|
@complex.properties.should be_kind_of(Array)
|
20
20
|
@complex.properties.each do |property|
|
@@ -22,5 +22,5 @@ describe YouGotListed::Complex do
|
|
22
22
|
end
|
23
23
|
@complex.properties.size.should == 2
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
end
|