Sha256: a17be359ceba544e24f01ec891517b87c293574f4ca9846082d8685a8985e666

Contents?: true

Size: 881 Bytes

Versions: 10

Compression:

Stored size: 881 Bytes

Contents

module Quandl
module Client

class Source < Quandl::Client::Base
  
  class << self
  
    def cached
      @@cached ||= {}
    end
  
  end
  
  ##########  
  # SCOPES #
  ##########
  
  scope :query
  scope :page, ->(p){ where( page: p.to_i )}
  scope :code, ->(c){ where( code: c.to_s.upcase )}
  
  
  ###############
  # ASSOCIATIONS #
  ###############
  
  def datasets
    Quandl::Client::Dataset.source_code(code)
  end
  
  
  ###############
  # VALIDATIONS #
  ###############
   
  validates :code, presence: true, length: { minimum: 2 }, format: { with: Quandl::Pattern.code, message: "is invalid. Expected format: #{Quandl::Pattern.code.to_example}" }
  validates :host, :name, presence: true
  

  ##############
  # PROPERTIES #
  ##############
   
  attributes :code, :name, :host, :description, :datasets_count, :use_proxy, :type, :concurrency
  
end

end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
quandl_client-2.10.2 lib/quandl/client/models/source.rb
quandl_client-2.10.1 lib/quandl/client/models/source.rb
quandl_client-2.10.0 lib/quandl/client/models/source.rb
quandl_client-2.9.0 lib/quandl/client/models/source.rb
quandl_client-2.8.0 lib/quandl/client/models/source.rb
quandl_client-2.7.12 lib/quandl/client/models/source.rb
quandl_client-2.7.9 lib/quandl/client/models/source.rb
quandl_client-2.7.8 lib/quandl/client/models/source.rb
quandl_client-2.7.7 lib/quandl/client/models/source.rb
quandl_client-2.7.6 lib/quandl/client/models/source.rb