Class: Stripe::Tax::CalculationService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::Tax::CalculationService
- Defined in:
- lib/stripe/services/tax/calculation_service.rb
Defined Under Namespace
Classes: CreateParams, RetrieveParams
Instance Attribute Summary collapse
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Calculates tax based on the input and returns a Tax Calculation object.
-
#initialize(requestor) ⇒ CalculationService
constructor
A new instance of CalculationService.
-
#retrieve(calculation, params = {}, opts = {}) ⇒ Object
Retrieves a Tax Calculation object, if the calculation hasn’t expired.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ CalculationService
Returns a new instance of CalculationService.
9 10 11 12 |
# File 'lib/stripe/services/tax/calculation_service.rb', line 9 def initialize(requestor) super(requestor) @line_items = Stripe::Tax::CalculationLineItemService.new(@requestor) end |
Instance Attribute Details
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
7 8 9 |
# File 'lib/stripe/services/tax/calculation_service.rb', line 7 def line_items @line_items end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Calculates tax based on the input and returns a Tax Calculation object.
250 251 252 253 254 255 256 257 258 |
# File 'lib/stripe/services/tax/calculation_service.rb', line 250 def create(params = {}, opts = {}) request( method: :post, path: "/v1/tax/calculations", params: params, opts: opts, base_address: :api ) end |
#retrieve(calculation, params = {}, opts = {}) ⇒ Object
Retrieves a Tax Calculation object, if the calculation hasn’t expired.
261 262 263 264 265 266 267 268 269 |
# File 'lib/stripe/services/tax/calculation_service.rb', line 261 def retrieve(calculation, params = {}, opts = {}) request( method: :get, path: format("/v1/tax/calculations/%<calculation>s", { calculation: CGI.escape(calculation) }), params: params, opts: opts, base_address: :api ) end |