Class: ProcessOut::CardSchemeDetails
- Inherits:
-
Object
- Object
- ProcessOut::CardSchemeDetails
- Defined in:
- lib/processout/card_scheme_details.rb
Instance Attribute Summary collapse
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#transaction_link_id ⇒ Object
Returns the value of attribute transaction_link_id.
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. -
#initialize(client, data = {}) ⇒ CardSchemeDetails
constructor
Initializes the CardSchemeDetails object Params:
client::ProcessOutclient instancedata:: data that can be used to fill the object. -
#new(data = {}) ⇒ Object
Create a new CardSchemeDetails using the current client.
-
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data::Hashof data. -
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ CardSchemeDetails
Initializes the CardSchemeDetails object Params:
clientProcessOutclient instancedatadata that can be used to fill the object
28 29 30 31 32 33 34 |
# File 'lib/processout/card_scheme_details.rb', line 28 def initialize(client, data = {}) @client = client self.transaction_id = data.fetch(:transaction_id, nil) self.transaction_link_id = data.fetch(:transaction_link_id, nil) end |
Instance Attribute Details
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
11 12 13 |
# File 'lib/processout/card_scheme_details.rb', line 11 def transaction_id @transaction_id end |
#transaction_link_id ⇒ Object
Returns the value of attribute transaction_link_id.
12 13 14 |
# File 'lib/processout/card_scheme_details.rb', line 12 def transaction_link_id @transaction_link_id end |
Instance Method Details
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
dataHashof data coming from the API
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/processout/card_scheme_details.rb', line 52 def fill_with_data(data) if data.nil? return self end if data.include? "transaction_id" self.transaction_id = data["transaction_id"] end if data.include? "transaction_link_id" self.transaction_link_id = data["transaction_link_id"] end self end |
#new(data = {}) ⇒ Object
Create a new CardSchemeDetails using the current client
37 38 39 |
# File 'lib/processout/card_scheme_details.rb', line 37 def new(data = {}) CardSchemeDetails.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
dataHashof data
69 70 71 72 73 74 75 76 77 |
# File 'lib/processout/card_scheme_details.rb', line 69 def prefill(data) if data.nil? return self end self.transaction_id = data.fetch(:transaction_id, self.transaction_id) self.transaction_link_id = data.fetch(:transaction_link_id, self.transaction_link_id) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
42 43 44 45 46 47 |
# File 'lib/processout/card_scheme_details.rb', line 42 def to_json() { "transaction_id": self.transaction_id, "transaction_link_id": self.transaction_link_id, }.to_json end |