Class: Airtable::RecordSet

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/airtable/record_set.rb

Overview

Contains records and the offset after a record query

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results) ⇒ RecordSet

results = { “records” => [{ … }], “offset” => “abc5643” } response from records api



10
11
12
13
14
15
16
17
18
# File 'lib/airtable/record_set.rb', line 10

def initialize(results)
  # Parse records
  @records = results && results["records"] ?
    results["records"].map { |r| Record.new(r["fields"].merge("id" => r["id"])) } : []
  # Store offset
  @offset = results["offset"] if results
  # Assign delegation object
  __setobj__(@records)
end

Instance Attribute Details

#offsetObject (readonly)

Returns the value of attribute offset.



6
7
8
# File 'lib/airtable/record_set.rb', line 6

def offset
  @offset
end

#recordsObject (readonly)

Returns the value of attribute records.



6
7
8
# File 'lib/airtable/record_set.rb', line 6

def records
  @records
end