Class: Ankoder::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/ankoder/account.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

count, create, #destroy, destroy, destroy_all, disconnect!, establish_connection!, #include_ankoder_object, #initialize, method_missing, #method_missing, path, path=, #save, #save!, session, session=, update

Constructor Details

This class inherits a constructor from Ankoder::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ankoder::Base

Class Method Details

.find(*args) ⇒ Object



28
29
30
# File 'lib/ankoder/account.rb', line 28

def self.find(*args)
  new(Ankoder::response(Browser::get(self.path, self.session).body))
end

Instance Method Details

#idObject



24
25
26
# File 'lib/ankoder/account.rb', line 24

def id
  ""
end

#new_record?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/ankoder/account.rb', line 3

def new_record?
  false
end

#reloadObject



20
21
22
# File 'lib/ankoder/account.rb', line 20

def reload
  @attributes = Account.find.attributes
end

#update_attributes(attributes = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ankoder/account.rb', line 7

def update_attributes(attributes={})
  attributes.delete "account"
  attributes.keys.each do |k|
    attributes.merge!("user[#{k.to_s}]" => attributes[k])
    attributes.delete k
  end

  if Account.update(id, attributes)
    reload
    true
  end
end