Class: Billingrails::Resources::TaxRates

Inherits:
Object
  • Object
show all
Defined in:
lib/billingrails/resources/tax_rates.rb

Overview

Tax rates resource

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ TaxRates

Returns a new instance of TaxRates.

Parameters:

  • client (Client)

    The API client



10
11
12
# File 'lib/billingrails/resources/tax_rates.rb', line 10

def initialize(client)
  @client = client
end

Instance Method Details

#archive(id) ⇒ Hash

Archive a tax rate

Archives a tax rate.

Parameters:

  • id (String)

    Resource ID

Returns:

  • (Hash)

    Response data



77
78
79
80
# File 'lib/billingrails/resources/tax_rates.rb', line 77

def archive(id)
  path = "/tax_rates/#{id}/archive"
  @client.request(:post, path)
end

#create(data) ⇒ Hash

Create a tax rate

Creates a tax rate.

Parameters:

  • data (Hash)

    Request body

Returns:

  • (Hash)

    Response data



31
32
33
34
# File 'lib/billingrails/resources/tax_rates.rb', line 31

def create(data)
  path = "/tax_rates"
  @client.request(:post, path, body: data)
end

#delete(id) ⇒ Hash

Delete a tax rate

Deletes a tax rate.

Parameters:

  • id (String)

    Resource ID

Returns:

  • (Hash)

    Response data



66
67
68
69
# File 'lib/billingrails/resources/tax_rates.rb', line 66

def delete(id)
  path = "/tax_rates/#{id}"
  @client.request(:delete, path)
end

#list(params: nil) ⇒ Hash

List tax rates

Retrieve a list of tax rates.

Parameters:

  • params (Hash, nil) (defaults to: nil)

    Query parameters

Returns:

  • (Hash)

    Response data



20
21
22
23
# File 'lib/billingrails/resources/tax_rates.rb', line 20

def list(params: nil)
  path = "/tax_rates"
  @client.request(:get, path, params: params)
end

#retrieve(id, params: nil) ⇒ Hash

Retrieve tax rate

Retrieves a tax rate by ID.

Parameters:

  • id (String)

    Resource ID

  • params (Hash, nil) (defaults to: nil)

    Query parameters

Returns:

  • (Hash)

    Response data



43
44
45
46
# File 'lib/billingrails/resources/tax_rates.rb', line 43

def retrieve(id, params: nil)
  path = "/tax_rates/#{id}"
  @client.request(:get, path, params: params)
end

#update(id, data) ⇒ Hash

Update a tax rate

Updates a tax rate.

Parameters:

  • id (String)

    Resource ID

  • data (Hash)

    Request body

Returns:

  • (Hash)

    Response data



55
56
57
58
# File 'lib/billingrails/resources/tax_rates.rb', line 55

def update(id, data)
  path = "/tax_rates/#{id}"
  @client.request(:put, path, body: data)
end