module ActiveZuora::LazyAttr
Private Instance Methods
fetch_field(field_name)
click to toggle source
# File lib/active_zuora/lazy_attr.rb, line 17 def fetch_field(field_name) return nil unless self.id records = fetch_field_records("select #{self.class.get_field!(field_name).zuora_name} from #{zuora_object_name} where Id = '#{self.id}'") type_cast_fetched_field(field_name, records.nil? ? nil : records[field_name.to_sym]) end
fetch_field_records(query_string)
click to toggle source
# File lib/active_zuora/lazy_attr.rb, line 25 def fetch_field_records(query_string) response = self.class.connection.request(:query){ |soap| soap.body = { :query_string => query_string } } response[:query_response][:result][:records] end
type_cast_fetched_field(field_name, value)
click to toggle source
# File lib/active_zuora/lazy_attr.rb, line 31 def type_cast_fetched_field(field_name, value) get_field!(field_name).type_cast(value) end