A class which encapsulates information about a Plaid category.

Sections
Methods
A
G
I
N
T
Public
Attributes
[R] hierarchy

The Array of String hierarchy. E.g. [“Food and Drink”, “Nightlife”].

[R] id

The String category ID, e.g. “21010006”.

[R] type

The Symbol category type. One of :special, :place, :digital.

Class Public methods
all(client: nil)

Get information about all available categories.

Does a GET /categories call.

client

The Plaid::Client instance used to connect (default: Plaid.client).

Returns

Returns an Array of Category instances.

# File lib/plaid/category.rb, line 42
def self.all(client: nil)
  Connector.new(:categories, client: client).get.map do |category_data|
    new(category_data)
  end
end
get(id, client: nil)

Get information about a given category.

Does a GET /categories/:id call.

id

the String category ID (e.g. “17001013”).

client

The Plaid::Client instance used to connect (default: Plaid.client).

Returns

Returns a Category instance or raises Plaid::NotFoundError if category with given id is not found.

# File lib/plaid/category.rb, line 58
def self.get(id, client: nil)
  new Connector.new(:categories, id, client: client).get
end
Instance Public methods
inspect()

Get a String representation of Category.

Returns

Returns a String.

Also aliased as: to_s
# File lib/plaid/category.rb, line 24
def inspect
  "#<Plaid::Category id=#{id.inspect}, type=#{type.inspect}, "        "hierarchy=#{hierarchy.inspect}>"
end
to_s()

Get a String representation of Category.

Returns

Returns a String.

Alias for: inspect
Internal
Class Public methods
new(fields)

Initialize a Category with given fields.

# File lib/plaid/category.rb, line 15
def initialize(fields)
  @type = fields['type'].to_sym
  @hierarchy = fields['hierarchy']
  @id = fields['id']
end