Class: XeroKiwi::Accounting::TrackingCategory
- Inherits:
-
Object
- Object
- XeroKiwi::Accounting::TrackingCategory
- Defined in:
- lib/xero_kiwi/accounting/tracking_category.rb
Overview
Represents a tracking category assignment on a line item or contact.
See: developer.xero.com/documentation/api/accounting/invoices
Constant Summary collapse
- ATTRIBUTES =
{ tracking_category_id: "TrackingCategoryID", tracking_option_id: "TrackingOptionID", name: "Name", option: "Option" }.freeze
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(attrs) ⇒ TrackingCategory
constructor
A new instance of TrackingCategory.
- #inspect ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(attrs) ⇒ TrackingCategory
Returns a new instance of TrackingCategory.
18 19 20 21 22 23 24 |
# File 'lib/xero_kiwi/accounting/tracking_category.rb', line 18 def initialize(attrs) attrs = attrs.transform_keys(&:to_s) @tracking_category_id = attrs["TrackingCategoryID"] @tracking_option_id = attrs["TrackingOptionID"] @name = attrs["Name"] @option = attrs["Option"] end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
30 31 32 |
# File 'lib/xero_kiwi/accounting/tracking_category.rb', line 30 def ==(other) other.is_a?(TrackingCategory) && to_h == other.to_h end |
#hash ⇒ Object
35 |
# File 'lib/xero_kiwi/accounting/tracking_category.rb', line 35 def hash = to_h.hash |
#inspect ⇒ Object
37 38 39 |
# File 'lib/xero_kiwi/accounting/tracking_category.rb', line 37 def inspect "#<#{self.class} name=#{name.inspect} option=#{option.inspect}>" end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/xero_kiwi/accounting/tracking_category.rb', line 26 def to_h ATTRIBUTES.keys.to_h { |key| [key, public_send(key)] } end |