Class: Cashboard::Account

Inherits:
Base show all
Defined in:
lib/cashboard/account.rb

Instance Attribute Summary

Attributes inherited from Base

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

authenticate, clear_authentication, create, #delete, #links, list, new_from_url, #to_xml, #update

Methods inherited from TypecastedOpenStruct

attr_typecast, element

Constructor Details

#initialize(hash = {}) ⇒ Account

We get some sub-resources that we need to turn into Cashboard::Structs so we can access their information in a friendly way.



9
10
11
12
13
14
# File 'lib/cashboard/account.rb', line 9

def initialize(hash={})
  super hash
  self.owner = Cashboard::Struct.new(self.owner)
  self.company = Cashboard::Struct.new(self.company)
  self
end

Class Method Details

.resource_nameObject

Account is the only singular resource for the Cashboard API.



4
# File 'lib/cashboard/account.rb', line 4

def self.resource_name; 'account'; end

Instance Method Details

#hrefObject



16
17
18
# File 'lib/cashboard/account.rb', line 16

def href
  "/#{self.class.resource_name}"
end