Class: Beanie::Document

Inherits:
Api
  • Object
show all
Defined in:
lib/beanie/document.rb

Constant Summary collapse

CATEGORY_UNFILED =
0
CATEGORY_DEBIT_CARD_EXPENSES =
1
CATEGORY_CASH_EXPENSES =
2
CATEGORY_PURCHASE_INVOICES =
3
CATEGORY_SALES_INVOICES =
4
CATEGORY_BANK_STATEMENTS =
5
CATEGORY_CONTRACTS =
6
CATEGORY_MISCELLANEOUS =
7
CATEGORIES =
[
  ["Unfiled", CATEGORY_UNFILED],
  ["Debit Card Expenses", CATEGORY_DEBIT_CARD_EXPENSES],
  ["Cash Expenses", CATEGORY_CASH_EXPENSES],
  ["Purchase Invoices", CATEGORY_PURCHASE_INVOICES],
  ["Sales Invoices", CATEGORY_SALES_INVOICES],
  ["Bank Statements", CATEGORY_BANK_STATEMENTS],
  ["Contracts", CATEGORY_CONTRACTS],
  ["Miscellaneous", CATEGORY_MISCELLANEOUS]
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Api

all, build_url, #construct_path, delete, #extract, #field_name, find, get, #object_name, #populate, post, put, #save!, set_headers

Constructor Details

#initializeDocument

Initialize instance variables



56
57
58
59
60
61
62
63
# File 'lib/beanie/document.rb', line 56

def initialize
  @id = nil
  @bxref = nil
  @mime_type = nil
  @size = nil
  @src_file = nil
  @category = nil
end

Instance Attribute Details

#bxrefObject

Returns the value of attribute bxref.



32
33
34
# File 'lib/beanie/document.rb', line 32

def bxref
  @bxref
end

#categoryObject

Returns the value of attribute category.



32
33
34
# File 'lib/beanie/document.rb', line 32

def category
  @category
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/beanie/document.rb', line 32

def id
  @id
end

#mime_typeObject

Returns the value of attribute mime_type.



32
33
34
# File 'lib/beanie/document.rb', line 32

def mime_type
  @mime_type
end

#sizeObject

Returns the value of attribute size.



32
33
34
# File 'lib/beanie/document.rb', line 32

def size
  @size
end

#src_fileObject

Returns the value of attribute src_file.



32
33
34
# File 'lib/beanie/document.rb', line 32

def src_file
  @src_file
end

Instance Method Details

#category_nameObject

Display a name for the document category



67
68
69
# File 'lib/beanie/document.rb', line 67

def category_name
  CATEGORIES[self.category][0]
end