Class: CrescaBrasilApi::Connection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

Returns a new instance of Connection.



5
6
7
# File 'lib/cresca_brasil_api/connection.rb', line 5

def initialize
  @environment = eval(CrescaBrasilApi.environment.to_s.capitalize)
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



4
5
6
# File 'lib/cresca_brasil_api/connection.rb', line 4

def environment
  @environment
end

Instance Method Details

#request(service, method, version, xml) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/cresca_brasil_api/connection.rb', line 9

def request(service, method, version, xml)
  client = client_savon(service, true)
  response = client.call(method) do 
    message({:versao => version, :xmlParametros => xml})
  end
  get_response(method, response.body.to_hash)
end

#view_operations(service) ⇒ Object



17
18
19
20
# File 'lib/cresca_brasil_api/connection.rb', line 17

def view_operations(service)
  client = client_savon(service, false)
  client.operations
end