Sha256: 9bd4ef01c971bd417437f8c434adca3826d02e707af9029f5521dde9ba08a990

Contents?: true

Size: 707 Bytes

Versions: 36

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

module IronBank
  module Describe
    # Describe a related object in Zuora, e.g., an account has a default payment
    # method
    #
    class Related
      private_class_method :new

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

      def type
        @type ||= doc.attributes["href"].value.split("/").last
      end

      def name
        doc.at_xpath(".//name").text
      end

      def label
        doc.at_xpath(".//label").text
      end

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

      private

      attr_reader :doc

      def initialize(doc)
        @doc = doc
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
iron_bank-4.0.2 lib/iron_bank/describe/related.rb
iron_bank-4.0.1 lib/iron_bank/describe/related.rb
iron_bank-4.0.0 lib/iron_bank/describe/related.rb
iron_bank-3.4.0 lib/iron_bank/describe/related.rb
iron_bank-3.3.4 lib/iron_bank/describe/related.rb
iron_bank-3.3.3 lib/iron_bank/describe/related.rb
iron_bank-3.3.2 lib/iron_bank/describe/related.rb
iron_bank-3.3.1 lib/iron_bank/describe/related.rb
iron_bank-3.3.0 lib/iron_bank/describe/related.rb
iron_bank-3.2.0 lib/iron_bank/describe/related.rb
iron_bank-3.1.1 lib/iron_bank/describe/related.rb
iron_bank-3.1.0 lib/iron_bank/describe/related.rb
iron_bank-3.0.3 lib/iron_bank/describe/related.rb
iron_bank-3.0.2 lib/iron_bank/describe/related.rb
iron_bank-3.0.1 lib/iron_bank/describe/related.rb
iron_bank-3.0.0 lib/iron_bank/describe/related.rb