Class: Braintree::CustomerRecommendations

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/graphql/unions/customer_recommendations.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes = {}) ⇒ CustomerRecommendations

Returns a new instance of CustomerRecommendations.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/braintree/graphql/unions/customer_recommendations.rb', line 11

def initialize(attributes = {})
  @payment_recommendations = initialize_payment_recommendations(attributes[:payment_recommendations])

  # Always derive payment_options from payment_recommendations
  @payment_options = @payment_recommendations.map do |recommendation|
    PaymentOptions._new(
      paymentOption: recommendation.payment_option,
      recommendedPriority: recommendation.recommended_priority,
    )
  end
end

Instance Attribute Details

#payment_optionsObject (readonly)

Returns the value of attribute payment_options.



9
10
11
# File 'lib/braintree/graphql/unions/customer_recommendations.rb', line 9

def payment_options
  @payment_options
end

#payment_recommendationsObject (readonly)

Returns the value of attribute payment_recommendations.



9
10
11
# File 'lib/braintree/graphql/unions/customer_recommendations.rb', line 9

def payment_recommendations
  @payment_recommendations
end

Class Method Details

._new(attributes = {}) ⇒ Object



42
43
44
# File 'lib/braintree/graphql/unions/customer_recommendations.rb', line 42

def _new(attributes = {})
  new(attributes)
end

Instance Method Details

#inspectObject



23
24
25
# File 'lib/braintree/graphql/unions/customer_recommendations.rb', line 23

def inspect
  "#<#{self.class} payment_options: #{payment_options.inspect}, payment_recommendations: #{payment_recommendations.inspect}>"
end