Class: RSimpy::QueryingService

Inherits:
BaseService show all
Defined in:
lib/querying_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#status_code, #status_message, #success

Instance Method Summary collapse

Methods inherited from BaseService

#execute_using, #reset, #set_status

Constructor Details

#initialize(command, client) ⇒ QueryingService

Returns a new instance of QueryingService.



10
11
12
13
# File 'lib/querying_service.rb', line 10

def initialize command, client
  @client = client
  @command = command
end

Instance Method Details



26
27
28
29
# File 'lib/querying_service.rb', line 26

def build_link params
  params.add(:src, 'rsimpy')
  "/#{@command}.do?" << params.to_querystring
end

#execute(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/querying_service.rb', line 15

def execute params
  params = RSimpy::Parameters.new unless params

  reset
  response = @client.get build_link params

  @success = (response.code == 200)

  response
end