Sha256: 88aed325fbca8b3a1401458bfc66d9ead6711f767f75e1a4b74df42181d86f18

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

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

4 entries across 4 versions & 1 rubygems

Version Path
horizon_client-0.2.3 lib/horizon_client/resource.rb
horizon_client-0.2.2 lib/horizon_client/resource.rb
horizon_client-0.2.1 lib/horizon_client/resource.rb
horizon_client-0.2.0 lib/horizon_client/resource.rb