Sha256: 8252333e0ea69f477a3ab4dc0c386fa9d86e733f6595a3701d8f6e65b4b71ae0

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

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