Class: YaKassa::V3::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ya_kassa/v3/client/base.rb

Direct Known Subclasses

Get, Post

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, body = nil, idempotence_key = nil) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/ya_kassa/v3/client/base.rb', line 7

def initialize(url, body = nil, idempotence_key = nil)
  @url = url
  @body = body
  @idempotence_key = idempotence_key
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/ya_kassa/v3/client/base.rb', line 5

def body
  @body
end

#idempotence_keyObject (readonly)

Returns the value of attribute idempotence_key.



5
6
7
# File 'lib/ya_kassa/v3/client/base.rb', line 5

def idempotence_key
  @idempotence_key
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/ya_kassa/v3/client/base.rb', line 5

def url
  @url
end

Instance Method Details

#requestObject



13
14
15
16
# File 'lib/ya_kassa/v3/client/base.rb', line 13

def request
  response = send
  { code: response.code, body: response_body(response), headers: response.headers}
end