Sha256: 3955d06c6f39262afe9b7d937c3c0ad3c48d9fd6e53a83d376f840696f8efc23

Contents?: true

Size: 805 Bytes

Versions: 21

Compression:

Stored size: 805 Bytes

Contents

module Quandl
module Client

class Source < Quandl::Client::Base
  
  ##########  
  # 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

21 entries across 21 versions & 1 rubygems

Version Path
quandl_client-2.4.0 lib/quandl/client/models/source.rb