Class: Stripe::V2::Core::AccountService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/v2/core/account_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StripeService

#request, #request_stream

Constructor Details

#initialize(requestor) ⇒ AccountService

Returns a new instance of AccountService.



10
11
12
13
14
# File 'lib/stripe/services/v2/core/account_service.rb', line 10

def initialize(requestor)
  super
  @persons = Stripe::V2::Core::Accounts::PersonService.new(@requestor)
  @person_tokens = Stripe::V2::Core::Accounts::PersonTokenService.new(@requestor)
end

Instance Attribute Details

#person_tokensObject (readonly)

Returns the value of attribute person_tokens.



8
9
10
# File 'lib/stripe/services/v2/core/account_service.rb', line 8

def person_tokens
  @person_tokens
end

#personsObject (readonly)

Returns the value of attribute persons.



8
9
10
# File 'lib/stripe/services/v2/core/account_service.rb', line 8

def persons
  @persons
end

Instance Method Details

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

Removes access to the Account and its associated resources. Closed Accounts can no longer be operated on, but limited information can still be retrieved through the API in order to be able to track their history.

** raises RateLimitError



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

def close(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v2/core/accounts/%<id>s/close", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

An Account is a representation of a company, individual or other entity that a user interacts with. Accounts contain identifying information about the entity, and configurations that store the features an account has access to. An account can be configured as any or all of the following configurations: Customer, Merchant and/or Recipient.

** raises RateLimitError



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/stripe/services/v2/core/account_service.rb', line 32

def create(params = {}, opts = {})
  unless params.is_a?(Stripe::RequestParams)
    params = ::Stripe::V2::Core::AccountCreateParams.coerce_params(params)
  end

  request(
    method: :post,
    path: "/v2/core/accounts",
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Returns a list of Accounts.

** raises RateLimitError



49
50
51
52
53
54
55
56
57
# File 'lib/stripe/services/v2/core/account_service.rb', line 49

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v2/core/accounts",
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Retrieves the details of an Account.

** raises RateLimitError



62
63
64
65
66
67
68
69
70
# File 'lib/stripe/services/v2/core/account_service.rb', line 62

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

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

Updates the details of an Account.

** raises RateLimitError



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/stripe/services/v2/core/account_service.rb', line 75

def update(id, params = {}, opts = {})
  unless params.is_a?(Stripe::RequestParams)
    params = ::Stripe::V2::Core::AccountUpdateParams.coerce_params(params)
  end

  request(
    method: :post,
    path: format("/v2/core/accounts/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end