Class: SevenApi::Resources::Subaccounts

Inherits:
SevenApi::Resource show all
Defined in:
lib/seven_api/resources/subaccounts.rb

Constant Summary

Constants inherited from SevenApi::Resource

SevenApi::Resource::BASE_PATH

Instance Attribute Summary

Attributes inherited from SevenApi::Resource

#api_key, #builder, #conn, #endpoint, #http_methods, #request_methods, #sent_with

Instance Method Summary collapse

Methods inherited from SevenApi::Resource

get_endpoint, get_http_methods, #initialize

Constructor Details

This class inherits a constructor from SevenApi::Resource

Instance Method Details

#create(params) ⇒ Hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)


22
23
24
25
26
# File 'lib/seven_api/resources/subaccounts.rb', line 22

def create(params)
  SevenApi::Subaccounts::Validator::create(params)

  request(params.merge({ :action => SevenApi::Subaccounts::Action::CREATE }))
end

#delete(params) ⇒ Hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)


32
33
34
35
36
# File 'lib/seven_api/resources/subaccounts.rb', line 32

def delete(params)
  SevenApi::Subaccounts::Validator::delete(params)

  request(params.merge({ :action => SevenApi::Subaccounts::Action::DELETE }))
end

#read(params = {}) ⇒ Hash

Parameters:

  • params (Hash) (defaults to: {})

Returns:

  • (Hash)


42
43
44
# File 'lib/seven_api/resources/subaccounts.rb', line 42

def read(params = {})
  request({}, params.merge({ :action => SevenApi::Subaccounts::Action::READ }))
end

#transfer_credits(params) ⇒ Hash

Parameters:

  • params (Hash)

Returns:

  • (Hash)


50
51
52
53
54
# File 'lib/seven_api/resources/subaccounts.rb', line 50

def transfer_credits(params)
  SevenApi::Subaccounts::Validator::transfer_credits(params)

  request(params.merge({ :action => SevenApi::Subaccounts::Action::TRANSFER_CREDITS }))
end

#update(params) ⇒ Hash

Update automatic charging of a subaccount read more: docs.seven.io/en/rest-api/endpoints/subaccounts#automatic-credit-transfer

Parameters:

  • params (Hash)

Returns:

  • (Hash)


60
61
62
63
64
# File 'lib/seven_api/resources/subaccounts.rb', line 60

def update(params)
  SevenApi::Subaccounts::Validator::update(params)

  request(params.merge({ :action => SevenApi::Subaccounts::Action::UPDATE }))
end