Class: Braintree::CustomerRecommendationsInput
- Inherits:
-
Object
- Object
- Braintree::CustomerRecommendationsInput
- Includes:
- BaseModule
- Defined in:
- lib/braintree/graphql/inputs/customer_recommendations_input.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#merchant_account_id ⇒ Object
readonly
Returns the value of attribute merchant_account_id.
-
#recommendations ⇒ Object
readonly
Returns the value of attribute recommendations.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ CustomerRecommendationsInput
constructor
A new instance of CustomerRecommendationsInput.
- #inspect ⇒ Object
- #to_graphql_variables ⇒ Object
Methods included from BaseModule
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) ⇒ CustomerRecommendationsInput
Returns a new instance of CustomerRecommendationsInput.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 13 def initialize(attributes) unless attributes[:session_id] raise ArgumentError, "Expected hash to contain a :session_id" end unless attributes[:recommendations] raise ArgumentError, "Expected hash to contain a :recommendations" end @attrs = attributes.keys set_instance_variables_from_hash(attributes) @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
7 8 9 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 7 def attrs @attrs end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
11 12 13 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 11 def customer @customer end |
#merchant_account_id ⇒ Object (readonly)
Returns the value of attribute merchant_account_id.
8 9 10 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 8 def merchant_account_id @merchant_account_id end |
#recommendations ⇒ Object (readonly)
Returns the value of attribute recommendations.
10 11 12 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 10 def recommendations @recommendations end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
9 10 11 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 9 def session_id @session_id end |
Instance Method Details
#inspect ⇒ Object
25 26 27 28 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 25 def inspect inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" } "#<#{self.class} #{inspected_attributes.join(" ")}>" end |
#to_graphql_variables ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/braintree/graphql/inputs/customer_recommendations_input.rb', line 30 def to_graphql_variables variables = {} variables["merchantAccountId"] = merchant_account_id if merchant_account_id variables["sessionId"] = session_id if session_id variables["recommendations"] = recommendations if recommendations variables["customer"] = customer.to_graphql_variables if customer variables end |