Sha256: dc4b163d5fdda50a0d49117a9f2f65288254bed5f7d9e5d793add4f7561a9a5b

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

module HorizonClient
  class Resource
    attr_reader :document

    def initialize(xml)
      @document = Ox.parse(xml)
    end

    def entity
      node = @document.resource.entity
      Entity.new(node)
    end

    def result
      node = @document.result
      Entity.new(node)
    end

    def collection
      node = @document.resource.collection
      @collection ||= Collection.new(node)
    end

    def error
      if document.respond_to?('error')
        document.error.message.text
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
horizon_client-0.2.4 lib/horizon_client/resource.rb