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
935
936
937
938
939
940
941
942
|
# File 'lib/carddb/collection.rb', line 935
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
926
927
928
|
# File 'lib/carddb/collection.rb', line 926
def [](key)
record_data&.[](key.to_s)
end
|
#created_at ⇒ Object
914
915
916
|
# File 'lib/carddb/collection.rb', line 914
def created_at
parse_time(data['createdAt'])
end
|
#dataset ⇒ Object
902
903
904
|
# File 'lib/carddb/collection.rb', line 902
def dataset
data['dataset']
end
|
#dataset_id ⇒ Object
893
894
895
|
# File 'lib/carddb/collection.rb', line 893
def dataset_id
data['datasetId']
end
|
#id ⇒ Object
889
890
891
|
# File 'lib/carddb/collection.rb', line 889
def id
data['id']
end
|
#pricing ⇒ Object
910
911
912
|
# File 'lib/carddb/collection.rb', line 910
def pricing
data['pricing']
end
|
#record_data ⇒ Object
Also known as:
fields
897
898
899
|
# File 'lib/carddb/collection.rb', line 897
def record_data
data['data']
end
|
#resolved_links ⇒ Object
906
907
908
|
# File 'lib/carddb/collection.rb', line 906
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
945
946
947
948
949
950
|
# File 'lib/carddb/collection.rb', line 945
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
918
919
920
|
# File 'lib/carddb/collection.rb', line 918
def updated_at
parse_time(data['updatedAt'])
end
|