Class: Fiscalizer::RequestSender

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/fiscalizer/services/request_sender.rb

Constant Summary

Constants included from Constants

Constants::DEMO_CERT_ISSUER, Constants::DEMO_URL, Constants::PROD_CERT_ISSUER, Constants::PROD_URL, Constants::SCHEMA_LOCATION, Constants::TNS, Constants::XSI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_cert, password, timeout, demo, ca_cert_path) ⇒ RequestSender

Returns a new instance of RequestSender.



5
6
7
8
9
10
11
12
13
# File 'lib/fiscalizer/services/request_sender.rb', line 5

def initialize(app_cert, password, timeout, demo, ca_cert_path)
  @app_cert = app_cert
  @password = password
  @timeout = timeout
  @demo = demo
  @ca_cert_path = ca_cert_path

  prepare_net_http
end

Instance Attribute Details

#app_certObject (readonly)

Returns the value of attribute app_cert.



15
16
17
# File 'lib/fiscalizer/services/request_sender.rb', line 15

def app_cert
  @app_cert
end

#ca_cert_pathObject (readonly)

Returns the value of attribute ca_cert_path.



15
16
17
# File 'lib/fiscalizer/services/request_sender.rb', line 15

def ca_cert_path
  @ca_cert_path
end

#demoObject (readonly)

Returns the value of attribute demo.



15
16
17
# File 'lib/fiscalizer/services/request_sender.rb', line 15

def demo
  @demo
end

#passwordObject (readonly)

Returns the value of attribute password.



15
16
17
# File 'lib/fiscalizer/services/request_sender.rb', line 15

def password
  @password
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



15
16
17
# File 'lib/fiscalizer/services/request_sender.rb', line 15

def timeout
  @timeout
end

Instance Method Details

#send(message) ⇒ Object



17
18
19
20
21
# File 'lib/fiscalizer/services/request_sender.rb', line 17

def send(message)
  request.content_type = 'application/xml'
  request.body = message
  http.request(request)
end