Class: Hubspot::Crm::Extensions::Accounting::InvoiceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InvoiceApi

Returns a new instance of InvoiceApi.



22
23
24
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 22

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#create_payment(invoice_id, invoice_create_payment_request, opts = {}) ⇒ InvoiceUpdateResponse

Records an invoice payment Records an payment against an invoice.

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • invoice_create_payment_request (InvoiceCreatePaymentRequest)

    The payment information

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

Returns:



32
33
34
35
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 32

def create_payment(invoice_id, invoice_create_payment_request, opts = {})
  data, _status_code, _headers = create_payment_with_http_info(invoice_id, invoice_create_payment_request, opts)
  data
end

#create_payment_with_http_info(invoice_id, invoice_create_payment_request, opts = {}) ⇒ Array<(InvoiceUpdateResponse, Integer, Hash)>

Records an invoice payment Records an payment against an invoice.

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • invoice_create_payment_request (InvoiceCreatePaymentRequest)

    The payment information

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

Returns:

  • (Array<(InvoiceUpdateResponse, Integer, Hash)>)

    InvoiceUpdateResponse data, response status code and response headers



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 44

def create_payment_with_http_info(invoice_id, invoice_create_payment_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoiceApi.create_payment ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoiceApi.create_payment"
  end
  # verify the required parameter 'invoice_create_payment_request' is set
  if @api_client.config.client_side_validation && invoice_create_payment_request.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_create_payment_request' when calling InvoiceApi.create_payment"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/accounting/invoice/{invoiceId}/payment'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(invoice_create_payment_request) 

  # return_type
  return_type = opts[:return_type] || 'InvoiceUpdateResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#create_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_by_id(invoice_id, account_id, opts = {}) ⇒ InvoiceReadResponse

Get invoice data Returns invoice data for an Accounting account from the specified ID

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



104
105
106
107
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 104

def get_by_id(invoice_id, , opts = {})
  data, _status_code, _headers = get_by_id_with_http_info(invoice_id, , opts)
  data
end

#get_by_id_with_http_info(invoice_id, account_id, opts = {}) ⇒ Array<(InvoiceReadResponse, Integer, Hash)>

Get invoice data Returns invoice data for an Accounting account from the specified ID

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InvoiceReadResponse, Integer, Hash)>)

    InvoiceReadResponse data, response status code and response headers



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 115

def get_by_id_with_http_info(invoice_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoiceApi.get_by_id ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoiceApi.get_by_id"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling InvoiceApi.get_by_id"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/accounting/invoice/{invoiceId}'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'InvoiceReadResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update(invoice_id, account_id, invoice_update_request, opts = {}) ⇒ InvoiceUpdateResponse

Update an invoice Updates an Invoice by the given ID.

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

  • invoice_update_request (InvoiceUpdateRequest)

    The invoice data to update

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



174
175
176
177
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 174

def update(invoice_id, , invoice_update_request, opts = {})
  data, _status_code, _headers = update_with_http_info(invoice_id, , invoice_update_request, opts)
  data
end

#update_with_http_info(invoice_id, account_id, invoice_update_request, opts = {}) ⇒ Array<(InvoiceUpdateResponse, Integer, Hash)>

Update an invoice Updates an Invoice by the given ID.

Parameters:

  • invoice_id (String)

    The ID of the invoice. This is the invoice ID from the external accounting system.

  • account_id (String)

    The ID of the account that the invoice belongs to. This is the account ID from the external accounting system.

  • invoice_update_request (InvoiceUpdateRequest)

    The invoice data to update

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InvoiceUpdateResponse, Integer, Hash)>)

    InvoiceUpdateResponse data, response status code and response headers



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/hubspot/codegen/crm/extensions/accounting/api/invoice_api.rb', line 186

def update_with_http_info(invoice_id, , invoice_update_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoiceApi.update ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoiceApi.update"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling InvoiceApi.update"
  end
  # verify the required parameter 'invoice_update_request' is set
  if @api_client.config.client_side_validation && invoice_update_request.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_update_request' when calling InvoiceApi.update"
  end
  # resource path
  local_var_path = '/crm/v3/extensions/accounting/invoice/{invoiceId}'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = 

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(invoice_update_request) 

  # return_type
  return_type = opts[:return_type] || 'InvoiceUpdateResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['hapikey', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end