Class: CardDB::Record
Overview
Wrapper for DatasetRecord objects
Instance Attribute Summary
Attributes inherited from Resource
#client, #data
Instance Method Summary
collapse
Methods inherited from Resource
#initialize, #key?, #to_h, #to_json
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
Access record data fields directly via method calls
875
876
877
878
879
880
881
882
|
# File 'lib/carddb/collection.rb', line 875
def method_missing(method_name, *args, &block)
key = method_name.to_s
return record_data&.[](key) if args.empty? && block.nil? && !key.end_with?('=')
super
end
|
Instance Method Details
#[](key) ⇒ Object?
Access record data fields directly via bracket notation
866
867
868
|
# File 'lib/carddb/collection.rb', line 866
def [](key)
record_data&.[](key.to_s)
end
|
#created_at ⇒ Object
854
855
856
|
# File 'lib/carddb/collection.rb', line 854
def created_at
parse_time(data['createdAt'])
end
|
#dataset ⇒ Object
842
843
844
|
# File 'lib/carddb/collection.rb', line 842
def dataset
data['dataset']
end
|
#dataset_id ⇒ Object
833
834
835
|
# File 'lib/carddb/collection.rb', line 833
def dataset_id
data['datasetId']
end
|
#id ⇒ Object
829
830
831
|
# File 'lib/carddb/collection.rb', line 829
def id
data['id']
end
|
#pricing ⇒ Object
850
851
852
|
# File 'lib/carddb/collection.rb', line 850
def pricing
data['pricing']
end
|
#record_data ⇒ Object
Also known as:
fields
837
838
839
|
# File 'lib/carddb/collection.rb', line 837
def record_data
data['data']
end
|
#resolved_links ⇒ Object
846
847
848
|
# File 'lib/carddb/collection.rb', line 846
def resolved_links
@resolved_links ||= parse_resolved_links
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Support respond_to? for dynamic field access
885
886
887
888
889
890
|
# File 'lib/carddb/collection.rb', line 885
def respond_to_missing?(method_name, include_private = false)
key = method_name.to_s
return true if record_data&.key?(key)
super
end
|
#updated_at ⇒ Object
858
859
860
|
# File 'lib/carddb/collection.rb', line 858
def updated_at
parse_time(data['updatedAt'])
end
|