Class: AuthorizeNet::ARB::SubscriptionListResponse
- Inherits:
-
XmlResponse
- Object
- Response
- XmlResponse
- AuthorizeNet::ARB::SubscriptionListResponse
- Defined in:
- lib/authorize_net/arb/subscription_list_response.rb
Constant Summary
Constants included from TypeConversions
TypeConversions::API_FIELD_PREFIX
Instance Method Summary collapse
-
#initialize(raw_response, transaction) ⇒ SubscriptionListResponse
constructor
Constructs a new response object from a +raw_response.
-
#subscription_details ⇒ Object
Returns an Array of SubscriptionDetail objects built from the entities returned in the response.
-
#total_num_in_resultset ⇒ Object
Returns total number of subscriptions matching the search criteria.
Methods inherited from XmlResponse
#connection_failure?, #message_code, #message_text, #raw, #reference_id, #response_code, #response_reason_code, #response_reason_text, #result_code, #success?, #xml
Methods inherited from Response
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.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 7 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 @raw_response = $! end end end |
Instance Method Details
#subscription_details ⇒ Object
Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 27 def subscription_details unless @subscription_details.nil? subscription_details = [] @subscription_details.element_children.each do |child| unless child.nil? subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION) subscription_details <<= subscription_detail end end return subscription_details unless subscription_details.length == 0 end end |
#total_num_in_resultset ⇒ Object
Returns total number of subscriptions matching the search criteria
22 23 24 |
# File 'lib/authorize_net/arb/subscription_list_response.rb', line 22 def total_num_in_resultset @total_num_in_resultset end |