Sha256: 216e418caed2694bbb73b58bca9ef8a239e2b7cab1b93abfd7ee78e9729c5feb

Contents?: true

Size: 857 Bytes

Versions: 16

Compression:

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

16 entries across 16 versions & 1 rubygems

Version Path
quandl_client-2.4.3 lib/quandl/client/models/sheet.rb
quandl_client-2.4.2 lib/quandl/client/models/sheet.rb
quandl_client-2.4.1 lib/quandl/client/models/sheet.rb
quandl_client-2.4.0 lib/quandl/client/models/sheet.rb
quandl_client-2.3.2 lib/quandl/client/models/sheet.rb
quandl_client-2.3.1 lib/quandl/client/models/sheet.rb
quandl_client-2.3.0 lib/quandl/client/models/sheet.rb
quandl_client-2.2.2 lib/quandl/client/models/sheet.rb
quandl_client-2.2.1 lib/quandl/client/models/sheet.rb
quandl_client-2.2.0 lib/quandl/client/models/sheet.rb
quandl_client-2.1.4 lib/quandl/client/models/sheet.rb
quandl_client-2.1.3 lib/quandl/client/models/sheet.rb
quandl_client-2.1.2 lib/quandl/client/models/sheet.rb
quandl_client-2.1.1 lib/quandl/client/models/sheet.rb
quandl_client-2.1.0 lib/quandl/client/models/sheet.rb
quandl_client-2.0.1 lib/quandl/client/models/sheet.rb