Sha256: ef56e6ee8d2d160acd20a896ebeb4000b21118ee2467b06f856887b72c7eb88f

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 Bytes

Contents

module ButterCMS
  class Content
    attr_reader :data

    def initialize(json)
      @json = json
      @data = HashToObject.convert(json["data"])
    end

    def inspect
      id_string = (self.respond_to?(:id) && !self.id.nil?) ? " id=#{self.id}" : ""
      "#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(@json)
    end

    def self.fetch(keys = [], options = {})
      params = {keys: keys.join(',')}.merge(options)

      response = ButterCMS.request("/content", params)

      self.new(response)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buttercms-ruby-1.2.0 lib/buttercms/content.rb
buttercms-ruby-1.1.3 lib/buttercms/content.rb