Sha256: ee5cd8b270d7f3a1d51a20891f57873da2e9f0098f79a15060583111f4c5fff6

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

module Quandl
module Client

class Source
  
  include Concerns::Search
  include Concerns::Properties
  
  ##########  
  # SCOPES #
  ##########
  
  search_scope :query
  search_scope :page, ->(p){ where( page: p.to_i )}
  search_scope :code, ->(c){ where( code: c.to_s.upcase )}
  
  
  ###############
  # ASSOCIATIONS #
  ###############
  
  def datasets
    Dataset.source_code(code)
  end
  
  
  ###############
  # VALIDATIONS #
  ###############
   
  validates :code, presence: true, length: { minimum: 2 }, format: { with: /([A-Z][A-Z0-9_]+)/ }
  validates :host, :name, presence: true
  

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

end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quandl_client-0.0.13 lib/quandl/client/models/source.rb
quandl_client-0.0.12 lib/quandl/client/models/source.rb
quandl_client-0.0.11 lib/quandl/client/models/source.rb
quandl_client-0.0.10 lib/quandl/client/models/source.rb