Sha256: 997ec85be6a23edaf73d95f0c33d10dafabe5cb60912c900e203c6750df66639

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 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

2 entries across 2 versions & 1 rubygems

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