Class: Airtable::RecordSet
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Airtable::RecordSet
- Defined in:
- lib/airtable/record_set.rb
Overview
Contains records and the offset after a record query
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
-
#initialize(results) ⇒ RecordSet
constructor
results = { “records” => [{ … }], “offset” => “abc5643” } response from records api.
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
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
6 7 8 |
# File 'lib/airtable/record_set.rb', line 6 def offset @offset end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
6 7 8 |
# File 'lib/airtable/record_set.rb', line 6 def records @records end |