class IronBank::Describe::Tenant
Describe
a Zuora tenant, including its objects.
Attributes
connection[R]
doc[R]
Public Class Methods
from_connection(connection)
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 14 def self.from_connection(connection) xml = connection.get("v1/describe").body new(Nokogiri::XML(xml), connection) rescue TypeError # NOTE: Zuora returns HTTP 401 (unauthorized) roughly 1 out of 3 times # we make this call. Since this is a setup-only call and not a runtime # one, we deemed it acceptable to keep retrying until it works. retry end
from_xml(doc)
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 10 def self.from_xml(doc) new(doc) end
new(doc, connection = nil)
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 40 def initialize(doc, connection = nil) @doc = doc @connection = connection end
Public Instance Methods
inspect()
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 32 def inspect "#<#{self.class}:0x#{(object_id << 1).to_s(16)}>" end
objects()
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 24 def objects return object_names unless connection @objects ||= object_names.map do |name| IronBank::Describe::Object.from_connection(connection, name) end end
Private Instance Methods
object_names()
click to toggle source
# File lib/iron_bank/describe/tenant.rb, line 45 def object_names @object_names ||= doc.xpath(".//object/name").map(&:text) end