Class: MOCO::PurchaseCategory

Inherits:
BaseEntity show all
Defined in:
lib/moco/entities/purchase_category.rb

Overview

Represents a MOCO purchase category (Ausgaben – Kategorien) Read-only expense categories for organizing purchases

Read-only attributes:

id, name, credit_account, active, created_at, updated_at

Example:

# List all categories
moco.purchase_categories.all

# Use category when creating purchase
moco.purchases.create(
  # ... other fields ...
  items: [{
    title: "Travel",
    total: 250.0,
    tax: 7.7,
    category_id: 123  # from purchase_categories
  }]
)

Note:

Purchase categories are configured in MOCO's admin interface.
This endpoint provides read-only access.

Instance Attribute Summary

Attributes inherited from BaseEntity

#attributes, #client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseEntity

#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update

Constructor Details

This class inherits a constructor from MOCO::BaseEntity

Class Method Details

.entity_pathObject



30
31
32
# File 'lib/moco/entities/purchase_category.rb', line 30

def self.entity_path
  "purchases/categories"
end

Instance Method Details

#to_sObject



34
35
36
# File 'lib/moco/entities/purchase_category.rb', line 34

def to_s
  name.to_s
end