Class: UWAPI::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/uwapi.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


42
43
44
# File 'lib/uwapi.rb', line 42

def failure?
  !success?
end

#metaObject



34
35
36
# File 'lib/uwapi.rb', line 34

def meta
  @result['response']['meta']
end

#resultObject



29
30
31
32
# File 'lib/uwapi.rb', line 29

def result
  @result ||= {}
  @result
end

#success?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/uwapi.rb', line 38

def success?
  Integer.new(@result['response']['meta']['Status']) == 200
end