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
885
886
887
888
889
890
891
892
|
# File 'lib/carddb/collection.rb', line 885
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
876
877
878
|
# File 'lib/carddb/collection.rb', line 876
def [](key)
record_data&.[](key.to_s)
end
|
#created_at ⇒ Object
864
865
866
|
# File 'lib/carddb/collection.rb', line 864
def created_at
parse_time(data['createdAt'])
end
|
#dataset ⇒ Object
852
853
854
|
# File 'lib/carddb/collection.rb', line 852
def dataset
data['dataset']
end
|
#dataset_id ⇒ Object
843
844
845
|
# File 'lib/carddb/collection.rb', line 843
def dataset_id
data['datasetId']
end
|
#id ⇒ Object
839
840
841
|
# File 'lib/carddb/collection.rb', line 839
def id
data['id']
end
|
#pricing ⇒ Object
860
861
862
|
# File 'lib/carddb/collection.rb', line 860
def pricing
data['pricing']
end
|
#record_data ⇒ Object
Also known as:
fields
847
848
849
|
# File 'lib/carddb/collection.rb', line 847
def record_data
data['data']
end
|
#resolved_links ⇒ Object
856
857
858
|
# File 'lib/carddb/collection.rb', line 856
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
895
896
897
898
899
900
|
# File 'lib/carddb/collection.rb', line 895
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
868
869
870
|
# File 'lib/carddb/collection.rb', line 868
def updated_at
parse_time(data['updatedAt'])
end
|