Class: Billabear::InvoicesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/billabear/api/invoices_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InvoicesApi

Returns a new instance of InvoicesApi.



16
17
18
# File 'lib/billabear/api/invoices_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/billabear/api/invoices_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#charge_invoice(invoice_id, opts = {}) ⇒ InlineResponse20014

Charge Invoice Attempts to charge a card that is on file for the invoice amount

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:



24
25
26
27
# File 'lib/billabear/api/invoices_api.rb', line 24

def charge_invoice(invoice_id, opts = {})
  data, _status_code, _headers = charge_invoice_with_http_info(invoice_id, opts)
  data
end

#charge_invoice_with_http_info(invoice_id, opts = {}) ⇒ Array<(InlineResponse20014, Integer, Hash)>

Charge Invoice Attempts to charge a card that is on file for the invoice amount

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

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

    InlineResponse20014 data, response status code and response headers



34
35
36
37
38
39
40
41
42
43
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
# File 'lib/billabear/api/invoices_api.rb', line 34

def charge_invoice_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.charge_invoice ...'
  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 InvoicesApi.charge_invoice"
  end
  # resource path
  local_var_path = '/invoice/{invoiceId}/charge'.sub('{' + 'invoiceId' + '}', invoice_id.to_s)

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

  # 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 = opts[:return_type] || 'InlineResponse20014' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoicesApi#charge_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_invoice(invoice_id, opts = {}) ⇒ String

Download Invoice Returns the pdf blob for the invoice

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

  • (String)


80
81
82
83
# File 'lib/billabear/api/invoices_api.rb', line 80

def download_invoice(invoice_id, opts = {})
  data, _status_code, _headers = download_invoice_with_http_info(invoice_id, opts)
  data
end

#download_invoice_with_http_info(invoice_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download Invoice Returns the pdf blob for the invoice

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/billabear/api/invoices_api.rb', line 90

def download_invoice_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice ...'
  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 InvoicesApi.download_invoice"
  end
  # resource path
  local_var_path = '/invoice/{invoiceId}/download'.sub('{' + 'invoiceId' + '}', invoice_id.to_s)

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

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

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

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

  return_type = opts[:return_type] || 'String' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoicesApi#download_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_invoices_for_customer(customer_id, opts = {}) ⇒ InlineResponse2006

List Customer Invoices List Customer Invoices

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:



136
137
138
139
# File 'lib/billabear/api/invoices_api.rb', line 136

def get_invoices_for_customer(customer_id, opts = {})
  data, _status_code, _headers = get_invoices_for_customer_with_http_info(customer_id, opts)
  data
end

#get_invoices_for_customer_with_http_info(customer_id, opts = {}) ⇒ Array<(InlineResponse2006, Integer, Hash)>

List Customer Invoices List Customer Invoices

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:

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

    InlineResponse2006 data, response status code and response headers



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/billabear/api/invoices_api.rb', line 146

def get_invoices_for_customer_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoices_for_customer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling InvoicesApi.get_invoices_for_customer"
  end
  # resource path
  local_var_path = '/customer/{customerId}/invoices'.sub('{' + 'customerId' + '}', customer_id.to_s)

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

  # 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 = opts[:return_type] || 'InlineResponse2006' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoicesApi#get_invoices_for_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end