Class: IronBank::Resources::Invoice

Inherits:
IronBank::Resource show all
Defined in:
lib/iron_bank/resources/invoice.rb

Overview

A Zuora invoice is generated through a bill run, belongs to an account and holds many invoice items.

Instance Attribute Summary

Attributes inherited from IronBank::Resource

#remote

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IronBank::Resource

#==, #id, #initialize, #inspect, object_name, #reload, #remove_instance_vars, with_cache, with_local_records

Methods included from Associations::ClassMethods

#with_many, #with_one

Methods included from Metadata

#excluded_fields, #fields, #query_custom_fields, #query_fields, #reset, #schema, #single_resource_query_fields, #with_schema

Methods included from Queryable

#all, #find, #find_each, #first, #where

Methods included from Associations

#with_memoization

Constructor Details

This class inherits a constructor from IronBank::Resource

Class Method Details

.excluded_fieldsObject

See the comment for the instance method ‘#body`



10
11
12
# File 'lib/iron_bank/resources/invoice.rb', line 10

def self.excluded_fields
  super + single_resource_query_fields
end

.single_resource_query_fieldsObject



14
15
16
# File 'lib/iron_bank/resources/invoice.rb', line 14

def self.single_resource_query_fields
  %w[Body]
end

Instance Method Details

#bodyObject

We can only retrieve one invoice body at a time, hence Body is excluded from the query fields, but is populated using the ‘find` class method



29
30
31
# File 'lib/iron_bank/resources/invoice.rb', line 29

def body
  remote[:body] || reload.remote[:body]
end