Class: Candid::BillingNotes::V2::Client
- Inherits:
-
Object
- Object
- Candid::BillingNotes::V2::Client
- Defined in:
- lib/candid/billing_notes/v_2/client.rb
Instance Method Summary collapse
- #create(request_options: {}, **params) ⇒ Candid::BillingNotes::V2::Types::BillingNote
- #delete(request_options: {}, **params) ⇒ untyped
- #initialize(client:) ⇒ Candid::BillingNotes::V2::Client constructor
- #update(request_options: {}, **params) ⇒ Candid::BillingNotes::V2::Types::BillingNote
Constructor Details
#initialize(client:) ⇒ Candid::BillingNotes::V2::Client
8 9 10 |
# File 'lib/candid/billing_notes/v_2/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Candid::BillingNotes::V2::Types::BillingNote
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/candid/billing_notes/v_2/client.rb', line 13 def create(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "POST", path: "/api/billing_notes/v2", body: params ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::BillingNotes::V2::Types::BillingNote.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/candid/billing_notes/v_2/client.rb', line 35 def delete(request_options: {}, **params) _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "DELETE", path: "/api/billing_notes/v2/#{params[:billing_note_id]}" ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i return if code.between?(200, 299) error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end |
#update(request_options: {}, **params) ⇒ Candid::BillingNotes::V2::Types::BillingNote
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/candid/billing_notes/v_2/client.rb', line 54 def update(request_options: {}, **params) _path_param_names = ["billing_note_id"] _request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || Candid::Environment::PRODUCTION, method: "PATCH", path: "/api/billing_notes/v2/#{params[:billing_note_id]}", body: params.except(*_path_param_names) ) begin _response = @client.send(_request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = _response.code.to_i if code.between?(200, 299) Candid::BillingNotes::V2::Types::BillingNote.load(_response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(_response.body, code: code) end end |