Class: Stripe::TaxRateService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::TaxRateService
- Defined in:
- lib/stripe/services/tax_rate_service.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a new tax rate.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your tax rates.
-
#retrieve(tax_rate, params = {}, opts = {}) ⇒ Object
Retrieves a tax rate with the given ID.
-
#serialize_batch_create(params = {}, opts = {}) ⇒ Object
Serializes a TaxRate create request into a batch job JSONL line.
-
#serialize_batch_update(tax_rate, params = {}, opts = {}) ⇒ Object
Serializes a TaxRate update request into a batch job JSONL line.
-
#update(tax_rate, params = {}, opts = {}) ⇒ Object
Updates an existing tax rate.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Creates a new tax rate.
7 8 9 |
# File 'lib/stripe/services/tax_rate_service.rb', line 7 def create(params = {}, opts = {}) request(method: :post, path: "/v1/tax_rates", params: params, opts: opts, base_address: :api) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first.
12 13 14 |
# File 'lib/stripe/services/tax_rate_service.rb', line 12 def list(params = {}, opts = {}) request(method: :get, path: "/v1/tax_rates", params: params, opts: opts, base_address: :api) end |
#retrieve(tax_rate, params = {}, opts = {}) ⇒ Object
Retrieves a tax rate with the given ID
17 18 19 20 21 22 23 24 25 |
# File 'lib/stripe/services/tax_rate_service.rb', line 17 def retrieve(tax_rate, params = {}, opts = {}) request( method: :get, path: format("/v1/tax_rates/%<tax_rate>s", { tax_rate: CGI.escape(tax_rate) }), params: params, opts: opts, base_address: :api ) end |
#serialize_batch_create(params = {}, opts = {}) ⇒ Object
Serializes a TaxRate create request into a batch job JSONL line.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stripe/services/tax_rate_service.rb', line 28 def serialize_batch_create(params = {}, opts = {}) request_id = SecureRandom.uuid stripe_version = opts[:stripe_version] || Stripe.api_version request_body = { id: request_id, params: params, stripe_version: stripe_version, } request_body[:context] = opts[:stripe_context] if opts[:stripe_context] JSON.generate(request_body) end |
#serialize_batch_update(tax_rate, params = {}, opts = {}) ⇒ Object
Serializes a TaxRate update request into a batch job JSONL line.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/stripe/services/tax_rate_service.rb', line 42 def serialize_batch_update(tax_rate, params = {}, opts = {}) request_id = SecureRandom.uuid stripe_version = opts[:stripe_version] || Stripe.api_version request_body = { id: request_id, params: params, stripe_version: stripe_version, } request_body[:path_params] = { tax_rate: tax_rate } request_body[:context] = opts[:stripe_context] if opts[:stripe_context] JSON.generate(request_body) end |
#update(tax_rate, params = {}, opts = {}) ⇒ Object
Updates an existing tax rate.
57 58 59 60 61 62 63 64 65 |
# File 'lib/stripe/services/tax_rate_service.rb', line 57 def update(tax_rate, params = {}, opts = {}) request( method: :post, path: format("/v1/tax_rates/%<tax_rate>s", { tax_rate: CGI.escape(tax_rate) }), params: params, opts: opts, base_address: :api ) end |