Class: Conexa::CostCenter

Inherits:
Model show all
Defined in:
lib/conexa/resources/cost_center.rb

Overview

CostCenter resource (Centro de Custo)

Examples:

Find a cost center

center = Conexa::CostCenter.find(11)
center.name  # => "Marketing"

List cost centers

centers = Conexa::CostCenter.all(limit: 50)

Constant Summary

Constants inherited from ConexaObject

Conexa::ConexaObject::RESOURCES

Instance Attribute Summary collapse

Attributes inherited from ConexaObject

#attributes

Class Method Summary collapse

Methods inherited from Model

all, #class_name, class_name, #create, create, #destroy, destroy, extract_page_size_or_params, #fetch, find_by, find_by_id, #id, #primary_key, primary_key_attribute, #primary_key_name, #save, #set_primary_key, underscored_class_name

Methods included from Deprecatable

#deprecate

Methods inherited from ConexaObject

#==, #[]=, convert, #empty?, #initialize, #respond_to_missing?, #to_hash, #unsaved_attributes

Constructor Details

This class inherits a constructor from Conexa::ConexaObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Conexa::ConexaObject

Instance Attribute Details

#cost_center_idInteger (readonly)

Returns Cost center ID (also accessible as #id).

Returns:

  • (Integer)

    Cost center ID (also accessible as #id)



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/conexa/resources/cost_center.rb', line 20

class CostCenter < Model
  primary_key_attribute :cost_center_id

  class << self
    def url(*params)
      ["/costCenters", *params].join '/'
    end

    def show_url(*params)
      ["/costCenter", *params].join '/'
    end
  end
end

#is_activeBoolean (readonly)

Returns Whether the cost center is active.

Returns:

  • (Boolean)

    Whether the cost center is active



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/conexa/resources/cost_center.rb', line 20

class CostCenter < Model
  primary_key_attribute :cost_center_id

  class << self
    def url(*params)
      ["/costCenters", *params].join '/'
    end

    def show_url(*params)
      ["/costCenter", *params].join '/'
    end
  end
end

#nameString (readonly)

Returns Cost center name.

Returns:

  • (String)

    Cost center name



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/conexa/resources/cost_center.rb', line 20

class CostCenter < Model
  primary_key_attribute :cost_center_id

  class << self
    def url(*params)
      ["/costCenters", *params].join '/'
    end

    def show_url(*params)
      ["/costCenter", *params].join '/'
    end
  end
end

Class Method Details

.show_url(*params) ⇒ Object



28
29
30
# File 'lib/conexa/resources/cost_center.rb', line 28

def show_url(*params)
  ["/costCenter", *params].join '/'
end

.url(*params) ⇒ Object



24
25
26
# File 'lib/conexa/resources/cost_center.rb', line 24

def url(*params)
  ["/costCenters", *params].join '/'
end