Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Easily connect to airtable data using ruby with access to all of the airtable features.
We are currently transitioning this gem to be supported by Airtable. We will maintain it moving forward, but until we fully support it, it will stay in the status of "community libraries". At that time we will remove this notice and add a "ruby" section to the API docs.
Add this line to your application's Gemfile:
gem 'airtable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install airtable
First, be sure to register for an airtable account, create a data worksheet and get an api key. Now, setup your Airtable client:
# Pass in api key to client
@client = Airtable::Client.new("keyPCx5W")
Your API key carries the same privileges as your user account, so be sure to keep it secret!
Now we can access any table in our Airsheet account by referencing the API docs:
# Pass in the app key and table name
@table = @client.table("appPo84QuCy2BPgLk", "Table Name")
Once you have access to a table from above, we can query a set of records in the table with:
@records = @table.records
We can specify a sort
order, limit
, and offset
as part of our query:
@records = @table.records(:sort => ["Name", :asc], :limit => 50)
@records # => [#<Airtable::Record :name=>"Bill Lowry", :email=>"billery@gmail.com">, ...]
@records.offset #=> "itrEN2TCbrcSN2BMs"
This will return the records based on the query as well as an offset
for the next round of records. We can then access the contents of any record:
@bill = @record.first
# => #<Airtable::Record :name=>"Bill Lowry", :email=>"billery@gmail.com", :id=>"rec02sKGVIzU65eV1">
@bill[:id] # => "rec02sKGVIzU65eV2"
@bill[:name] # => "Bill Lowry"
@bill[:email] # => "billery@gmail.com"
Note that you can only request a maximimum of 100 records in a single query. To retrieve more records, use the "batch" feature below.
We can also query all records in the table through a series of batch requests with:
@records = @table.all(:sort => ["Name", :asc])
This executes a variable number of network requests (100 records per batch) to retrieve all records in a sheet.
Records can be queried by id
using the find
method on a table:
@record = @table.find("rec02sKGVIzU65eV2")
# => #<Airtable::Record :name=>"Bill Lowry", :email=>"billery@gmail.com", :id=>"rec02sKGVIzU65eV1">
Records can be inserted using the create
method on a table:
@record = Airtable::Record.new(:name => "Sarah Jaine", :email => "sarah@jaine.com")
@table.create(@record)
# => #<Airtable::Record :name=>"Sarah Jaine", :email=>"sarah@jaine.com", :id=>"rec03sKOVIzU65eV4">
Records can be updated using the update
method on a table:
@record[:email] = "sarahjaine@updated.com"
@table.update(record)
# => #<Airtable::Record :name=>"Sarah Jaine", :email=>"sarahjaine@updated.com", :id=>"rec03sKOVIzU65eV4">
Records can be destroyed using the destroy
method on a table:
@table.destroy(record)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that airtable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.