Method: ZipMoney::Shopper#initialize

Defined in:
lib/zip_money/models/shopper.rb

#initialize(attributes = {}) ⇒ Shopper

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/zip_money/models/shopper.rb', line 95

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.has_key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.has_key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.has_key?(:'middle_name')
    self.middle_name = attributes[:'middle_name']
  end

  if attributes.has_key?(:'phone')
    self.phone = attributes[:'phone']
  end

  if attributes.has_key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.has_key?(:'birth_date')
    self.birth_date = attributes[:'birth_date']
  end

  if attributes.has_key?(:'gender')
    self.gender = attributes[:'gender']
  end

  if attributes.has_key?(:'statistics')
    self.statistics = attributes[:'statistics']
  end

  if attributes.has_key?(:'billing_address')
    self.billing_address = attributes[:'billing_address']
  end

end