Class: UWAPI::Result
- Inherits:
-
Object
- Object
- UWAPI::Result
- Defined in:
- lib/uwapi.rb
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(args) ⇒ Result
constructor
A new instance of Result.
- #meta ⇒ Object
- #result ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(args) ⇒ Result
Returns a new instance of Result.
21 22 23 24 25 26 27 |
# File 'lib/uwapi.rb', line 21 def initialize(args) if args.is_a?(Hash) && args.has_key?('response') @result = args else raise ArgumentError, 'args is not a UWAPI returned result' end end |
Instance Method Details
#failure? ⇒ Boolean
42 43 44 |
# File 'lib/uwapi.rb', line 42 def failure? !success? end |
#meta ⇒ Object
34 35 36 |
# File 'lib/uwapi.rb', line 34 def @result['response']['meta'] end |
#result ⇒ Object
29 30 31 32 |
# File 'lib/uwapi.rb', line 29 def result @result ||= {} @result end |
#success? ⇒ Boolean
38 39 40 |
# File 'lib/uwapi.rb', line 38 def success? Integer.new(@result['response']['meta']['Status']) == 200 end |