Sha256: cd3760f99baa96ea3ec094630c1045b5a857fb18e88b15874d86eaf02db66c7b

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

module Quandl
module Client

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

  ##############
  # PROPERTIES #
  ##############
  
  attributes :title, :content, :url_title, :full_url_title, :description, :skip_browse
  
  def html
    @html ||= self.attributes[:html] || Quandl::Client::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

3 entries across 3 versions & 1 rubygems

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