Class: Stripe::Tax::RegistrationService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/tax/registration_service.rb

Instance Method Summary collapse

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 Registration object.



8
9
10
11
12
13
14
15
16
# File 'lib/stripe/services/tax/registration_service.rb', line 8

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/tax/registrations",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(params = {}, opts = {}) ⇒ Object

Returns a list of Tax Registration objects.



19
20
21
22
23
24
25
26
27
# File 'lib/stripe/services/tax/registration_service.rb', line 19

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/tax/registrations",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(id, params = {}, opts = {}) ⇒ Object

Returns a Tax Registration object.



30
31
32
33
34
35
36
37
38
# File 'lib/stripe/services/tax/registration_service.rb', line 30

def retrieve(id, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/tax/registrations/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#serialize_batch_create(params = {}, opts = {}) ⇒ Object

Serializes a Registration create request into a batch job JSONL line.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/stripe/services/tax/registration_service.rb', line 41

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(id, params = {}, opts = {}) ⇒ Object

Serializes a Registration update request into a batch job JSONL line.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/stripe/services/tax/registration_service.rb', line 55

def serialize_batch_update(id, 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] = { id: id }
  request_body[:context] = opts[:stripe_context] if opts[:stripe_context]
  JSON.generate(request_body)
end

#update(id, params = {}, opts = {}) ⇒ Object

Updates an existing Tax Registration object.

A registration cannot be deleted after it has been created. If you wish to end a registration you may do so by setting expires_at.



72
73
74
75
76
77
78
79
80
# File 'lib/stripe/services/tax/registration_service.rb', line 72

def update(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/tax/registrations/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end