class Cielo::API30::Address

Customer's address.

@attr [String] street the customer's address @attr [String] number the customer's address number @attr [String] complement any complement of customer's address @attr [String] zip_code the zip code of customer's address @attr [String] city the city of customer's address @attr [String] state the state of customer's address @attr [String] country the country of customer's address

Attributes

city[RW]
complement[RW]
country[RW]
number[RW]
state[RW]
street[RW]
zip_code[RW]

Public Class Methods

from_json(data) click to toggle source
# 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

Public Instance Methods

as_json(options={}) click to toggle source
# File lib/cielo/api30/address.rb, line 41
def as_json(options={})
  {
    Street: @street,
    Number: @number,
    Complement: @complement,
    ZipCode: @zip_code,
    City: @city,
    State: @state,
    Country: @country
  }
end
to_json(*options) click to toggle source
# File lib/cielo/api30/address.rb, line 21
def to_json(*options)
  hash = as_json(*options)
  hash.reject! {|k,v| v.nil?}
  hash.to_json(*options)
end