Class: Helpful::Api::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/helpful/api/accounts.rb

Overview

These are like organizations which use Helpful.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Accounts

Returns a new instance of Accounts.



8
9
10
# File 'lib/helpful/api/accounts.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#all(options = {}) ⇒ Object

All the accounts the user has access to

‘/accounts’ GET



15
16
17
18
19
# File 'lib/helpful/api/accounts.rb', line 15

def all(options = {})
  body = options.fetch(:query, {})

  @client.get("/accounts", body, options)
end

#get(account_id, options = {}) ⇒ Object

Get an account the user has access to

‘/accounts/:account_id’ GET

account_id - Identifier of the account



26
27
28
29
30
# File 'lib/helpful/api/accounts.rb', line 26

def get(, options = {})
  body = options.fetch(:query, {})

  @client.get("/accounts/#{}", body, options)
end

#update(account_id, options = {}) ⇒ Object

Update an account the user has access to

‘/accounts/:account_id’ PATCH

account_id - Identifier of the account



37
38
39
40
41
# File 'lib/helpful/api/accounts.rb', line 37

def update(, options = {})
  body = options.fetch(:body, {})

  @client.patch("/accounts/#{}", body, options)
end