Class: MoonropeClient::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, controller, action, params = {}) ⇒ Request

Initialize a new request

Parameters:



14
15
16
17
18
19
# File 'lib/moonrope_client/request.rb', line 14

def initialize(connection, controller, action, params = {})
  @connection = connection
  @controller = controller.to_sym
  @action = action.to_sym
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



21
22
23
# File 'lib/moonrope_client/request.rb', line 21

def params
  @params
end

Instance Method Details

#makeObject



23
24
25
# File 'lib/moonrope_client/request.rb', line 23

def make
  raw_data_to_response_object(make_request)
end

#make!Object



27
28
29
30
31
32
33
34
# File 'lib/moonrope_client/request.rb', line 27

def make!
  result = raw_data_to_response_object(make_request)
  if result.success?
    result
  else
    raise MoonropeClient::RequestError.new(result), "Request was not successful. Got #{result.class} (#{result.exception_message})."
  end
end