| Class | Dsadmin::Response |
| In: |
lib/dsadmin/response.rb
|
| Parent: | Object |
| data | [R] | |
| status | [R] |
Create a new Response and deserialize it from the given YAML Raises an ArgumentError if the data is invalid
# File lib/dsadmin/response.rb, line 48
48: def self.from_yaml(string_or_io)
49: hash = YAML.load(string_or_io)
50: raise ArgumentError.new("Unrecognized data format") unless(hash.kind_of?(Hash))
51:
52: status = hash['status']
53: raise ArgumentError.new("Invalid status") unless(status.kind_of?(String))
54:
55: req = Response.new(status.to_sym)
56: req.data = hash['data']
57:
58: req
59: end
# File lib/dsadmin/response.rb, line 63
63: def initialize(status, data = nil)
64: self.status = status
65: self.data = data
66: end
# File lib/dsadmin/response.rb, line 31
31: def data=(value)
32: checkKindOf(Hash, value) unless value.nil?
33: @data = value
34: end