Module: Quandl::Format::Dataset::Client
- Extended by:
- ActiveSupport::Concern
- Included in:
- Quandl::Format::Dataset
- Defined in:
- lib/quandl/format/dataset/client.rb
Instance Method Summary collapse
- #client ⇒ Object
- #client=(value) ⇒ Object
- #full_url ⇒ Object
- #human_error(name, message) ⇒ Object
- #human_errors ⇒ Object
- #upload ⇒ Object
Instance Method Details
#client ⇒ Object
38 39 40 |
# File 'lib/quandl/format/dataset/client.rb', line 38 def client @client ||= find_or_build_client end |
#client=(value) ⇒ Object
41 42 43 44 |
# File 'lib/quandl/format/dataset/client.rb', line 41 def client=(value) raise ArgumentError, "Expected Quandl::Client::Dataset received #{value.class}" unless value.is_a?(Quandl::Client::Dataset) @client = value end |
#full_url ⇒ Object
30 31 32 |
# File 'lib/quandl/format/dataset/client.rb', line 30 def full_url client.full_url end |
#human_error(name, message) ⇒ Object
25 26 27 28 |
# File 'lib/quandl/format/dataset/client.rb', line 25 def human_error(name, ) = .join(', ') if .respond_to?(:join) " #{name}: #{}\n" end |
#human_errors ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/quandl/format/dataset/client.rb', line 15 def human_errors m = "#{client.human_status} \t #{client.full_url}" return m if errors.blank? m += "\n errors: \n" m += errors.collect do |error_type, | next human_error(error_type, ) unless .is_a?(Hash) .collect{|n,m| human_error(n, m) } end.flatten.compact.join end |
#upload ⇒ Object
34 35 36 |
# File 'lib/quandl/format/dataset/client.rb', line 34 def upload client.save if valid? end |