Method: Megam::Account.json_create

Defined in:
lib/megam/core/account.rb

.json_create(o) ⇒ Object

Create a Megam::Account from JSON (used by the backgroud job workers)



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/megam/core/account.rb', line 171

def self.json_create(o)
  acct = new
  acct.id(o["id"]) if o.has_key?("id")
  acct.email(o["email"]) if o.has_key?("email")
  acct.api_key(o["api_key"]) if o.has_key?("api_key")
  acct.authority(o["authority"]) if o.has_key?("authority")
  acct.first_name(o["first_name"]) if o.has_key?("first_name")
  acct.last_name(o["last_name"]) if o.has_key?("last_name")
  acct.phone(o["phone"]) if o.has_key?("phone")
  acct.password(o["password"]) if o.has_key?("password")
  acct.password_reset_key(o["password_reset_key"]) if o.has_key?("password_reset_key")
  acct.created_at(o["created_at"]) if o.has_key?("created_at")
  acct.some_msg[:code] = o["code"] if o.has_key?("code")
  acct.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
  acct.some_msg[:msg]= o["msg"] if o.has_key?("msg")
  acct.some_msg[:links] = o["links"] if o.has_key?("links")
  acct
end