Sha256: bfb3f6a653561b08f92848c90c9c2100022797512f7fe7595e166f148b1efaa4

Contents?: true

Size: 843 Bytes

Versions: 22

Compression:

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

22 entries across 22 versions & 1 rubygems

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