Class: Cielo::API30::Address
- Inherits:
-
Object
- Object
- Cielo::API30::Address
- Defined in:
- lib/cielo/api30/address.rb
Overview
Customer’s address.
Instance Attribute Summary collapse
-
#city ⇒ String
the city of customer’s address.
-
#complement ⇒ String
any complement of customer’s address.
-
#country ⇒ String
the country of customer’s address.
-
#number ⇒ String
the customer’s address number.
-
#state ⇒ String
the state of customer’s address.
-
#street ⇒ String
the customer’s address.
-
#zip_code ⇒ String
the zip code of customer’s address.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#city ⇒ String
the city of customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def city @city end |
#complement ⇒ String
any complement of customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def complement @complement end |
#country ⇒ String
the country of customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def country @country end |
#number ⇒ String
the customer’s address number
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def number @number end |
#state ⇒ String
the state of customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def state @state end |
#street ⇒ String
the customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def street @street end |
#zip_code ⇒ String
the zip code of customer’s address
12 13 14 |
# File 'lib/cielo/api30/address.rb', line 12 def zip_code @zip_code end |
Class Method Details
.from_json(data) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cielo/api30/address.rb', line 27 def self.from_json(data) return if data.nil? address = new address.street = data["Street"] address.number = data["Number"] address.complement = data["Complement"] address.zip_code = data["ZipCode"] address.city = data["City"] address.state = data["State"] address.country = data["Country"] address end |
Instance Method Details
#as_json(options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cielo/api30/address.rb', line 41 def as_json(={}) { Street: @street, Number: @number, Complement: @complement, ZipCode: @zip_code, City: @city, State: @state, Country: @country } end |
#to_json(*options) ⇒ Object
21 22 23 24 25 |
# File 'lib/cielo/api30/address.rb', line 21 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |