Sha256: 00e3ac8dbe6c67f9204e94319ff6534b252c7919b17244a069326c189998a653

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

module Quandl
module Client

class Sheet
  
  include Concerns::Search
  include Concerns::Properties
  
  
  ##########  
  # SCOPES #
  ##########
  
  search_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

2 entries across 2 versions & 1 rubygems

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