quandl_client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,19 +13,31 @@ module Properties
13
13
  before_save :halt_unless_valid!
14
14
 
15
15
  def valid_with_server?
16
- r = valid_without_server?
17
- r = self.attributes[:errors].blank? if r == true
18
- r
16
+ return false unless valid_without_server?
17
+ return false unless errors_params.blank?
18
+ return false unless errors_server.blank?
19
+ true
19
20
  end
20
21
  alias_method_chain :valid?, :server
21
22
 
22
23
  def error_messages
23
24
  valid?
24
- m = errors.messages || {}
25
- e = self.attributes[:errors] || {}
26
- m.deep_merge(e)
25
+ errors_client.deep_merge(errors_server).deep_merge(errors_params)
27
26
  end
28
27
 
28
+ def errors_client
29
+ errors.messages || {}
30
+ end
31
+
32
+ def errors_server
33
+ self.attributes[:errors] || {}
34
+ end
35
+
36
+ def errors_params
37
+ response_errors.present? ? { response_errors: response_errors } : {}
38
+ end
39
+
40
+
29
41
  protected
30
42
 
31
43
  def halt_unless_valid!
@@ -1,6 +1,6 @@
1
1
  module Quandl
2
2
  module Client
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.9'
4
4
  API_VERSION = 'v1'
5
5
 
6
6
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: