Class: QingCloudServer::Client::ServiceFoudation

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

Direct Known Subclasses

Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connector) ⇒ ServiceFoudation

Returns a new instance of ServiceFoudation.



15
16
17
# File 'lib/client/service_foundation.rb', line 15

def initialize(connector)
  @connector = connector
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



14
15
16
# File 'lib/client/service_foundation.rb', line 14

def response
  @response
end

Instance Method Details

#fetch_response(action, params) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/client/service_foundation.rb', line 19

def fetch_response(action, params)
  params.each do |k, v|
    params.delete(k) unless (v.is_a?(Numeric)) || (v && v.length > 0)
  end

  self.response = @connector.fetch_server_condition(action, params)
end

#make_action_and_paramsObject

def convert_arr_to_hash(arr)

hash = {}
arr.each {|h| hash.merge!(h)}
hash

end



33
34
35
36
37
38
39
40
# File 'lib/client/service_foundation.rb', line 33

def make_action_and_params
  "
  fetch_response(
      __method__.to_s.split('_').map {|e| e.capitalize!}.join,
      method(__method__).parameters.map { |_, p| {p.to_sym => eval(p.to_s)} }.arr_to_hsh
  )
  "
end