Class: Airtable::Client

Inherits:
Resource show all
Defined in:
lib/airtable/client.rb

Overview

Client carrying authorization token

Instance Attribute Summary

Attributes inherited from Resource

#id, #token

Instance Method Summary collapse

Methods inherited from Resource

#check_and_raise_error, #initialize

Constructor Details

This class inherits a constructor from Airtable::Resource

Instance Method Details

#base(base_id) ⇒ Airtable::Base

Instantiate base

Parameters:

  • base_id (String)

    ID of base

Returns:



25
26
27
# File 'lib/airtable/client.rb', line 25

def base(base_id)
  Airtable::Base.new(@token, base_id)
end

#basesArray<Airtable::Base>



7
8
9
10
11
12
13
# File 'lib/airtable/client.rb', line 7

def bases
  response = self.class.get('/v0/meta/bases').parsed_response

  check_and_raise_error(response)

  response['bases'].map { Airtable::Base.new(@token, _1['id']) }
end

#whoamiHash

Returns User’s data based on token.

Returns:

  • (Hash)

    User’s data based on token

See Also:



31
32
33
34
35
36
37
# File 'lib/airtable/client.rb', line 31

def whoami
  response = self.class.get('/v0/meta/whoami').parsed_response

  check_and_raise_error(response)

  response
end

#workspace(workspace_id) ⇒ Airtable::Workspace

Instantiate workspace

Parameters:

  • workspace_id (String)

    ID of workspace

Returns:



18
19
20
# File 'lib/airtable/client.rb', line 18

def workspace(workspace_id)
  Airtable::Workspace.new(@token, workspace_id)
end