Class: CrescaBrasilApi::Connection
- Inherits:
-
Object
- Object
- CrescaBrasilApi::Connection
- Defined in:
- lib/cresca_brasil_api/connection.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #request(service, method, version, xml) ⇒ Object
- #view_operations(service) ⇒ Object
Constructor Details
#initialize ⇒ Connection
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
#environment ⇒ Object (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 ({: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 |