Class: Rovi::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Response

Returns a new instance of Response.



4
5
6
# File 'lib/rovi/response.rb', line 4

def initialize(data = {})
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/rovi/response.rb', line 12

def method_missing(m)
  key = m.to_s
  if @hash != nil and @hash.has_key?(key)
    v = @hash[key]
    v = JsonResponse.new(v) if v.is_a?(Hash)
    return v
  else
    super
  end
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rovi/response.rb', line 8

def success?
  @data['status']
end