Class: Pluggy::Resources::Category

Inherits:
APIResource show all
Defined in:
lib/pluggy/resources/misc.rb

Overview

A transaction category. Two-level hierarchy: a category with no parentId is a root.

Constant Summary

Constants inherited from PluggyObject

PluggyObject::ISO8601, PluggyObject::RESERVED, PluggyObject::TEMPORAL_KEYS

Instance Attribute Summary

Attributes inherited from PluggyObject

#client

Instance Method Summary collapse

Methods inherited from PluggyObject

#==, #[], #as_json, declared_fields, define_field, #each_pair, fields, #hash, #initialize, #inspect, #key?, #keys, #method_missing, nested, nested_types, #read, #respond_to_missing?, #to_h, #to_json, #values

Constructor Details

This class inherits a constructor from Pluggy::PluggyObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pluggy::PluggyObject

Instance Method Details

#childrenObject



38
39
40
# File 'lib/pluggy/resources/misc.rb', line 38

def children
  ensure_client!.categories.list(parent_id: self["id"])
end

#parentObject



42
43
44
45
# File 'lib/pluggy/resources/misc.rb', line 42

def parent
  parent_id = self["parentId"]
  parent_id && ensure_client!.categories.retrieve(parent_id)
end

#root?Boolean

Returns:

  • (Boolean)


36
# File 'lib/pluggy/resources/misc.rb', line 36

def root? = self["parentId"].nil?