Class: Yoomoney::Resources::Deals
- Inherits:
-
Object
- Object
- Yoomoney::Resources::Deals
- Defined in:
- lib/yoomoney/resources/deals.rb
Instance Method Summary collapse
-
#create(fee_moment:, type:, idempotence_key:, description: nil, metadata: nil, request_options: {}) ⇒ Yoomoney::Models::SafeDeal
Some parameter documentations has been truncated, see Models::DealCreateParams for more details.
-
#initialize(client:) ⇒ Deals
constructor
private
A new instance of Deals.
-
#list(created_at: nil, cursor: nil, expires_at: nil, full_text_search: nil, limit: nil, status: nil, request_options: {}) ⇒ Yoomoney::Models::DealListResponse
Список сделок.
-
#retrieve(deal_id, request_options: {}) ⇒ Yoomoney::Models::SafeDeal
Информация о сделке.
Constructor Details
#initialize(client:) ⇒ Deals
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Deals.
89 90 91 |
# File 'lib/yoomoney/resources/deals.rb', line 89 def initialize(client:) @client = client end |
Instance Method Details
#create(fee_moment:, type:, idempotence_key:, description: nil, metadata: nil, request_options: {}) ⇒ Yoomoney::Models::SafeDeal
Some parameter documentations has been truncated, see Models::DealCreateParams for more details.
Создание сделки
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yoomoney/resources/deals.rb', line 28 def create(params) parsed, = Yoomoney::DealCreateParams.dump_request(params) header_params = {idempotence_key: "idempotence-key"} @client.request( method: :post, path: "deals", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Yoomoney::SafeDeal, options: ) end |
#list(created_at: nil, cursor: nil, expires_at: nil, full_text_search: nil, limit: nil, status: nil, request_options: {}) ⇒ Yoomoney::Models::DealListResponse
Список сделок
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/yoomoney/resources/deals.rb', line 75 def list(params = {}) parsed, = Yoomoney::DealListParams.dump_request(params) @client.request( method: :get, path: "deals", query: parsed, model: Yoomoney::Models::DealListResponse, options: ) end |
#retrieve(deal_id, request_options: {}) ⇒ Yoomoney::Models::SafeDeal
Информация о сделке
51 52 53 54 55 56 57 58 |
# File 'lib/yoomoney/resources/deals.rb', line 51 def retrieve(deal_id, params = {}) @client.request( method: :get, path: ["deals/%1$s", deal_id], model: Yoomoney::SafeDeal, options: params[:request_options] ) end |