Sha256: 86e766841c82a4aae64c23719cae9f247ac60acc31ba89624a644768515e6d53

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

module Quandl
module Client

class Sheet < Quandl::Client::Base
  
  ##########  
  # SCOPES #
  ##########
  
  scope :query, :page, :parent_url_title
  
  
  ################
  # ASSOCIATIONS #
  ################
  
  def parent
    @parent ||= Sheet.find(parent_url_title)
  end
  
  def children
    Sheet.parent_url_title(self.full_url_title)
  end
  
  
  ###############
  # VALIDATIONS #
  ###############
  
  validates :title, presence: true
  

  ##############
  # PROPERTIES #
  ##############
  
  attributes :title, :content, :url_title, :full_url_title, :description
  
  def html
    @html ||= self.attributes[:html] || Sheet.find(full_url_title).attributes[:html]
  end
  
  def parent_url_title
    @parent_url_title ||= self.full_url_title.split('/')[0..-2].join()
  end
  
  
end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quandl_client-2.0.0 lib/quandl/client/models/sheet.rb