Class: AlfaBank::RequestSender
- Inherits:
-
Object
- Object
- AlfaBank::RequestSender
- Defined in:
- lib/alfa_bank/request_sender.rb
Instance Attribute Summary collapse
-
#data_builder ⇒ Object
Returns the value of attribute data_builder.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(request_type, params) ⇒ RequestSender
constructor
A new instance of RequestSender.
Constructor Details
#initialize(request_type, params) ⇒ RequestSender
Returns a new instance of RequestSender.
8 9 10 |
# File 'lib/alfa_bank/request_sender.rb', line 8 def initialize(request_type, params) @data_builder = DataBuilder.new(request_type, params) end |
Instance Attribute Details
#data_builder ⇒ Object
Returns the value of attribute data_builder.
6 7 8 |
# File 'lib/alfa_bank/request_sender.rb', line 6 def data_builder @data_builder end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/alfa_bank/request_sender.rb', line 12 def call uri = URI.parse(data_builder.link) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'}) params = data_builder.call request.set_form_data params http.request(request) end |