Class: ProcessOut::CustomerAction
- Inherits:
-
Object
- Object
- ProcessOut::CustomerAction
- Defined in:
- lib/processout/customer_action.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data -
Hashof data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ CustomerAction
constructor
- Initializes the CustomerAction object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the CustomerAction object Params:
-
#new(data = {}) ⇒ Object
Create a new CustomerAction using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data -
Hashof data.
- Prefills the object with the data passed as parameters Params:
Constructor Details
#initialize(client, data = {}) ⇒ CustomerAction
Initializes the CustomerAction object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
27 28 29 30 31 32 33 |
# File 'lib/processout/customer_action.rb', line 27 def initialize(client, data = {}) @client = client self.type = data.fetch(:type, nil) self.value = data.fetch(:value, nil) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/processout/customer_action.rb', line 10 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/processout/customer_action.rb', line 11 def value @value end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data-
Hashof data coming from the API
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/processout/customer_action.rb', line 43 def fill_with_data(data) if data.nil? return self end if data.include? "type" self.type = data["type"] end if data.include? "value" self.value = data["value"] end self end |
#new(data = {}) ⇒ Object
Create a new CustomerAction using the current client
36 37 38 |
# File 'lib/processout/customer_action.rb', line 36 def new(data = {}) CustomerAction.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
60 61 62 63 64 65 66 67 68 |
# File 'lib/processout/customer_action.rb', line 60 def prefill(data) if data.nil? return self end self.type = data.fetch(:type, self.type) self.value = data.fetch(:value, self.value) self end |