api_resource 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -39,14 +39,12 @@ GEM
39
39
  activesupport (3.2.10)
40
40
  i18n (~> 0.6)
41
41
  multi_json (~> 1.0)
42
- archive-tar-minitar (0.5.2)
43
42
  arel (3.0.2)
44
43
  builder (3.0.4)
45
44
  childprocess (0.3.6)
46
45
  ffi (~> 1.0, >= 1.0.6)
47
46
  coderay (1.0.8)
48
47
  colorize (0.5.8)
49
- columnize (0.3.6)
50
48
  diff-lcs (1.1.3)
51
49
  differ (0.1.2)
52
50
  erubis (2.7.0)
@@ -83,8 +81,6 @@ GEM
83
81
  i18n (0.6.1)
84
82
  journey (1.0.4)
85
83
  json (1.7.7)
86
- linecache19 (0.5.12)
87
- ruby_core_source (>= 0.1.4)
88
84
  listen (0.7.1)
89
85
  log4r (1.1.10)
90
86
  lumberjack (1.0.2)
@@ -139,16 +135,6 @@ GEM
139
135
  rspec-expectations (2.12.1)
140
136
  diff-lcs (~> 1.1.3)
141
137
  rspec-mocks (2.12.1)
142
- ruby-debug-base19 (0.11.25)
143
- columnize (>= 0.3.1)
144
- linecache19 (>= 0.5.11)
145
- ruby_core_source (>= 0.1.4)
146
- ruby-debug19 (0.11.6)
147
- columnize (>= 0.3.1)
148
- linecache19 (>= 0.5.11)
149
- ruby-debug-base19 (>= 0.11.19)
150
- ruby_core_source (0.1.5)
151
- archive-tar-minitar (>= 0.5.2)
152
138
  ruby_parser (3.1.1)
153
139
  sexp_processor (~> 4.1)
154
140
  sexp_processor (4.1.3)
@@ -188,7 +174,6 @@ DEPENDENCIES
188
174
  rake
189
175
  rb-fsevent
190
176
  rspec
191
- ruby-debug19
192
177
  simplecov
193
178
  spork
194
179
  sqlite3
@@ -344,6 +344,16 @@ module ApiResource
344
344
  connection.delete(element_path(id, options))
345
345
  end
346
346
 
347
+ # do we have an invalid resource
348
+ def resource_definition_is_invalid?
349
+ # if we have a Hash, it's valid
350
+ return false if @resource_definition.is_a?(Hash)
351
+ # if we have no recheck time, it's invalid
352
+ return true if @resource_load_time.nil?
353
+ # have we checked in the last minute?
354
+ return @resource_load_time < Time.now - 1.minute
355
+ end
356
+
347
357
  # split an option hash into two hashes, one containing the prefix options,
348
358
  # and the other containing the leftovers.
349
359
  def split_options(options = {})
@@ -358,16 +368,6 @@ module ApiResource
358
368
 
359
369
  protected
360
370
 
361
- # do we have an invalid resource
362
- def resource_definition_is_invalid?
363
- # if we have a Hash, it's valid
364
- return false if @resource_definition.is_a?(Hash)
365
- # if we have no recheck time, it's invalid
366
- return true if @resource_load_time.nil?
367
- # have we checked in the last minute?
368
- return @resource_load_time < Time.now - 1.minute
369
- end
370
-
371
371
  def method_missing(meth, *args, &block)
372
372
  # make one attempt to load remote attrs
373
373
  if self.resource_definition_is_invalid?
@@ -600,6 +600,19 @@ module ApiResource
600
600
  end
601
601
  response
602
602
  end
603
+
604
+ def method_missing(meth, *args, &block)
605
+ # make one attempt to load remote attrs
606
+ if self.class.resource_definition_is_invalid?
607
+ self.class.reload_resource_definition
608
+ end
609
+ # see if we respond to the method now
610
+ if self.respond_to?(meth)
611
+ return self.send(meth, *args, &block)
612
+ else
613
+ super
614
+ end
615
+ end
603
616
 
604
617
  def element_path(id, prefix_override_options = {}, query_options = nil)
605
618
  self.class.element_path(
@@ -693,4 +706,4 @@ module ApiResource
693
706
 
694
707
  end
695
708
 
696
- end
709
+ end
@@ -1,3 +1,3 @@
1
1
  module ApiResource
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-04-18 00:00:00.000000000 Z
14
+ date: 2013-04-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake