Class: Kassa24::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/kassa24/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(login:, password:, url:, params:) ⇒ Request

Returns a new instance of Request.



3
4
5
6
7
8
9
# File 'lib/kassa24/request.rb', line 3

def initialize(login:, password:, url:, params:)
  @conn = Faraday.new(
    url: url
  )
  @conn.request :authorization, :basic, , password
  @params = params
end

Instance Method Details

#callObject



11
12
13
14
15
16
# File 'lib/kassa24/request.rb', line 11

def call
  response = @conn.post do |req|
    req.body = camelize_keys(@params).to_json
  end
  Result.new(response)
end