Class: IronBank::Describe::Tenant

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_bank/describe/tenant.rb

Overview

Describe a Zuora tenant, including its objects.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_connection(connection) ⇒ Object



14
15
16
17
18
19
20
21
22
# 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) ⇒ Object



10
11
12
# File 'lib/iron_bank/describe/tenant.rb', line 10

def self.from_xml(doc)
  new(doc)
end

Instance Method Details

#inspectObject



32
33
34
# File 'lib/iron_bank/describe/tenant.rb', line 32

def inspect
  "#<#{self.class}:0x#{(object_id << 1).to_s(16)}>"
end

#objectsObject



24
25
26
27
28
29
30
# 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