Sha256: 528cf26f573b64a3c85d282745a1ff9a2ea0f2a73aa53e92a82a4af1344fe3db

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

module FireEagle
  class Response
    include HappyMapper

    tag "rsp"
    attribute :status,  String, :tag => "stat"
    element   :querystring, String
    has_one   :error, Error
    has_one   :locations, Locations
    has_many  :users, User

    def self.parse(xml, opts = {})
      rsp = super(xml, opts)

      raise FireEagleException, rsp.error.message if rsp.fail?

      rsp
    end

    def fail?
      status == "fail"
    end

    # does the response indicate success?
    def success?
      status == "ok"
    end

    def user
      users[0]
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
jnewland-fireeagle-0.8.0.1 lib/fireeagle/response.rb
jnewland-fireeagle-0.8.99.1 lib/fireeagle/response.rb
mojodna-fireeagle-0.8.0.1 lib/fireeagle/response.rb
mojodna-fireeagle-0.8.99.1 lib/fireeagle/response.rb
mojodna-fireeagle-0.8.99 lib/fireeagle/response.rb
fireeagle-0.8.0.1 lib/fireeagle/response.rb