Class: AuthorizeNet::ARB::SubscriptionListResponse

Inherits:
XmlResponse show all
Defined in:
lib/authorize_net/arb/subscription_list_response.rb

Constant Summary

Constants included from TypeConversions

TypeConversions::API_FIELD_PREFIX

Instance Attribute Summary collapse

Attributes inherited from XmlResponse

#message_code, #message_text, #reference_id, #result_code

Instance Method Summary collapse

Methods inherited from XmlResponse

#connection_failure?, #raw, #response_code, #response_reason_code, #response_reason_text, #success?, #xml

Methods inherited from Response

#success?

Methods included from TypeConversions

#boolean_to_value, #date_to_value, #datetime_to_value, #decimal_to_value, #integer_to_value, #to_external_field, #to_internal_field, #to_param, #value_to_boolean, #value_to_date, #value_to_datetime, #value_to_decimal, #value_to_integer

Constructor Details

#initialize(raw_response, transaction) ⇒ SubscriptionListResponse

Constructs a new response object from a +raw_response. You don’t typically construct this object yourself, as AuthorizeNet::ARB::Transaction will build one for you when it makes the request to the gateway.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 6

def initialize(raw_response, transaction)
  super
  unless connection_failure?
    begin
      @subscription_details = @root.at_css('subscriptionDetails')
      @subscription_detail = @root.at_css('subscriptionDetail')
      @total_num_in_resultset = node_content_unless_nil(@root.at_css('totalNumInResultSet'))
    rescue StandardError
      @raw_response = $ERROR_INFO
    end
  end
end

Instance Attribute Details

#total_num_in_resultsetObject (readonly)

Returns total number of subscriptions matching the search criteria



20
21
22
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 20

def total_num_in_resultset
  @total_num_in_resultset
end

Instance Method Details

#subscription_detailsObject

Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 23

def subscription_details
  unless @subscription_details.nil?
    subscription_details = []
    @subscription_details.element_children.each do |child|
      next if child.nil?
      subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION)

      subscription_details <<= subscription_detail
    end
    return subscription_details unless subscription_details.empty?
   end
end