Sha256: 6e143938baea6febe44493e805c46ef11c15147f9d34a4dad38fb0f3ad951eb9

Contents?: true

Size: 707 Bytes

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
iron_bank-2.2.0 lib/iron_bank/describe/related.rb
iron_bank-2.1.0 lib/iron_bank/describe/related.rb
iron_bank-2.0.2 lib/iron_bank/describe/related.rb
iron_bank-2.0.1 lib/iron_bank/describe/related.rb
iron_bank-2.0.0 lib/iron_bank/describe/related.rb
iron_bank-1.0.4 lib/iron_bank/describe/related.rb
iron_bank-1.0.3 lib/iron_bank/describe/related.rb
iron_bank-1.0.2 lib/iron_bank/describe/related.rb
iron_bank-1.0.1 lib/iron_bank/describe/related.rb
iron_bank-1.0.0 lib/iron_bank/describe/related.rb
iron_bank-0.7.1 lib/iron_bank/describe/related.rb