you_got_listed 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -13,9 +13,9 @@ YouGotListings API documentation can be found here: http://www.yougotlistings.co
13
13
 
14
14
  gem install you_got_listed
15
15
 
16
- In a rails 3 app (0.2.x only)
16
+ In a rails 3 app
17
17
 
18
- gem 'you_got_listed', '~> 0.3.0'
18
+ gem 'you_got_listed', '~> 0.4.0'
19
19
 
20
20
  In a rails 2.3.x app (0.2.x only)
21
21
 
@@ -5,8 +5,8 @@ module YouGotListed
5
5
 
6
6
  def initialize(listing, client)
7
7
  listing.each do |key, value|
8
- self.instance_variable_set('@'+key, value)
9
- self.class.send(:define_method, key, proc{self.instance_variable_get("@#{key}")})
8
+ self.instance_variable_set("@#{key}", value)
9
+ self.class.send(:attr_reader, key)
10
10
  end
11
11
  self.client = client
12
12
  end
@@ -17,7 +17,7 @@ module YouGotListed
17
17
 
18
18
  class SearchResponse < YouGotListed::Response
19
19
 
20
- attr_accessor :limit, :paginator_cache, :client
20
+ attr_accessor :limit, :client
21
21
 
22
22
  def initialize(response, client, limit = 20, raise_error = false)
23
23
  super(response, raise_error)
@@ -42,10 +42,9 @@ module YouGotListed
42
42
  end
43
43
 
44
44
  def paginator
45
- paginator_cache if paginator_cache
46
- self.paginator_cache = WillPaginate::Collection.create(
47
- (self.ygl_response.page_index ? self.ygl_response.page_index : 1),
48
- self.limit,
45
+ @paginator_cache ||= WillPaginate::Collection.create(
46
+ (self.ygl_response.page_index ? self.ygl_response.page_index : 1),
47
+ self.limit,
49
48
  (self.ygl_response.total ? self.ygl_response.total : properties.size)) do |pager|
50
49
  pager.replace property_complexes
51
50
  end
@@ -5,9 +5,9 @@ module YouGotListed
5
5
 
6
6
  def initialize(listing, client)
7
7
  listing.each do |key, value|
8
- self.instance_variable_set('@'+key, value)
8
+ self.instance_variable_set("@#{key}", value)
9
9
  unless ["latitude", "longitude"].include?(key)
10
- self.class.send(:define_method, key, proc{self.instance_variable_get("@#{key}")})
10
+ self.class.send(:attr_reader, key)
11
11
  end
12
12
  end
13
13
  self.client = client
@@ -64,7 +64,7 @@ module YouGotListed
64
64
 
65
65
  class SearchResponse < YouGotListed::Response
66
66
 
67
- attr_accessor :limit, :paginator_cache, :client
67
+ attr_accessor :limit, :client
68
68
 
69
69
  def initialize(response, client, limit = 20, raise_error = false)
70
70
  super(response, raise_error)
@@ -93,10 +93,9 @@ module YouGotListed
93
93
  end
94
94
 
95
95
  def paginator
96
- paginator_cache if paginator_cache
97
- self.paginator_cache = WillPaginate::Collection.create(
98
- (self.ygl_response.page_index ? self.ygl_response.page_index : 1),
99
- self.limit,
96
+ @paginator_cache ||= WillPaginate::Collection.create(
97
+ (self.ygl_response.page_index ? self.ygl_response.page_index : 1),
98
+ self.limit,
100
99
  (self.ygl_response.total ? self.ygl_response.total : properties.size)) do |pager|
101
100
  pager.replace properties
102
101
  end
@@ -1,3 +1,3 @@
1
1
  module YouGotListed
2
- VERSION = '0.3.6'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_got_listed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 6
10
- version: 0.3.6
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Cocca