Class: AirtableBaseBuilder::Airtable::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/airtable_base_builder/airtable/client.rb

Direct Known Subclasses

Base, Field, Table

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



8
9
10
# File 'lib/airtable_base_builder/airtable/client.rb', line 8

def initialize
  @pat = AirtableBaseBuilder::Config.new.pat
end

Instance Method Details

#post(params: {}) ⇒ Object

params: { name: ‘My Base’, workspaceId: ‘wrk123’, tables: [{}, {}] }



13
14
15
16
17
18
19
20
21
22
# File 'lib/airtable_base_builder/airtable/client.rb', line 13

def post(params: {})
  http_connection.post(
    "https://api.airtable.com/v0/meta/bases",
    params.to_json
  )
  rescue Faraday::ClientError => e
    errors_response(e.response[:body].values)
  rescue Faraday::ServerError
    errors_response(["The server responded with status 500"])
end