module IronBank::Metadata
Metadata
to provide accessors to Zuora resources.
Public Instance Methods
excluded_fields()
click to toggle source
# File lib/iron_bank/metadata.rb, line 7 def excluded_fields return [] unless (fields = IronBank.configuration.excluded_fields) # Return the field for the given resource name # (where the module is extended from) fields.fetch(object_name, []) end
fields()
click to toggle source
# File lib/iron_bank/metadata.rb, line 22 def fields return [] unless schema @fields ||= schema.fields.map(&:name) - excluded_fields end
query_custom_fields()
click to toggle source
# File lib/iron_bank/metadata.rb, line 34 def query_custom_fields return [] unless schema @query_custom_fields ||= schema.query_custom_fields - excluded_fields end
query_fields()
click to toggle source
# File lib/iron_bank/metadata.rb, line 28 def query_fields return [] unless schema @query_fields ||= schema.query_fields - excluded_fields end
reset()
click to toggle source
# File lib/iron_bank/metadata.rb, line 44 def reset %i[@fields @query_fields @schema].each do |var| remove_instance_variable(var) if instance_variable_defined?(var) end with_schema end
schema()
click to toggle source
# File lib/iron_bank/metadata.rb, line 40 def schema @schema ||= IronBank::Schema.for(object_name) end
single_resource_query_fields()
click to toggle source
NOTE: For some resources, fields are queryable with some restrictions,
e.g. the `Invoice#body` can only be added to the list of fields if there is only one invoice in the query response.
# File lib/iron_bank/metadata.rb, line 18 def single_resource_query_fields [] end
with_schema()
click to toggle source
# File lib/iron_bank/metadata.rb, line 52 def with_schema fields.each do |field| field_name = IronBank::Utils.underscore(field).to_sym define_method(:"#{field_name}") { remote[field_name] } end end