Class: ProcessOut::SubmerchantAddress
- Inherits:
-
Object
- Object
- ProcessOut::SubmerchantAddress
- Defined in:
- lib/processout/submerchant_address.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#county ⇒ Object
Returns the value of attribute county.
-
#line1 ⇒ Object
Returns the value of attribute line1.
-
#line2 ⇒ Object
Returns the value of attribute line2.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
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 = {}) ⇒ SubmerchantAddress
constructor
- Initializes the SubmerchantAddress object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the SubmerchantAddress object Params:
-
#new(data = {}) ⇒ Object
Create a new SubmerchantAddress 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:
-
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ SubmerchantAddress
Initializes the SubmerchantAddress object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/processout/submerchant_address.rb', line 53 def initialize(client, data = {}) @client = client self.line1 = data.fetch(:line1, nil) self.line2 = data.fetch(:line2, nil) self.city = data.fetch(:city, nil) self.state = data.fetch(:state, nil) self.country_code = data.fetch(:country_code, nil) self.zip = data.fetch(:zip, nil) self.county = data.fetch(:county, nil) end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
13 14 15 |
# File 'lib/processout/submerchant_address.rb', line 13 def city @city end |
#country_code ⇒ Object
Returns the value of attribute country_code.
15 16 17 |
# File 'lib/processout/submerchant_address.rb', line 15 def country_code @country_code end |
#county ⇒ Object
Returns the value of attribute county.
17 18 19 |
# File 'lib/processout/submerchant_address.rb', line 17 def county @county end |
#line1 ⇒ Object
Returns the value of attribute line1.
11 12 13 |
# File 'lib/processout/submerchant_address.rb', line 11 def line1 @line1 end |
#line2 ⇒ Object
Returns the value of attribute line2.
12 13 14 |
# File 'lib/processout/submerchant_address.rb', line 12 def line2 @line2 end |
#state ⇒ Object
Returns the value of attribute state.
14 15 16 |
# File 'lib/processout/submerchant_address.rb', line 14 def state @state end |
#zip ⇒ Object
Returns the value of attribute zip.
16 17 18 |
# File 'lib/processout/submerchant_address.rb', line 16 def zip @zip 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
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/processout/submerchant_address.rb', line 87 def fill_with_data(data) if data.nil? return self end if data.include? "line1" self.line1 = data["line1"] end if data.include? "line2" self.line2 = data["line2"] end if data.include? "city" self.city = data["city"] end if data.include? "state" self.state = data["state"] end if data.include? "country_code" self.country_code = data["country_code"] end if data.include? "zip" self.zip = data["zip"] end if data.include? "county" self.county = data["county"] end self end |
#new(data = {}) ⇒ Object
Create a new SubmerchantAddress using the current client
67 68 69 |
# File 'lib/processout/submerchant_address.rb', line 67 def new(data = {}) SubmerchantAddress.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/processout/submerchant_address.rb', line 119 def prefill(data) if data.nil? return self end self.line1 = data.fetch(:line1, self.line1) self.line2 = data.fetch(:line2, self.line2) self.city = data.fetch(:city, self.city) self.state = data.fetch(:state, self.state) self.country_code = data.fetch(:country_code, self.country_code) self.zip = data.fetch(:zip, self.zip) self.county = data.fetch(:county, self.county) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/processout/submerchant_address.rb', line 72 def to_json() { "line1": self.line1, "line2": self.line2, "city": self.city, "state": self.state, "country_code": self.country_code, "zip": self.zip, "county": self.county, }.to_json end |