Class: Podio::ContractPrice

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/contract_price.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes, #error_code, #error_message, #error_parameters, #error_propagate

Instance Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Instance Method Details

#emp_network?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/podio/models/contract_price.rb', line 22

def emp_network?
  items['emp_network'].present?
end

#emp_network_employeesObject



10
11
12
# File 'lib/podio/models/contract_price.rb', line 10

def emp_network_employees
  users.select { |u| u['items']['emp_network'].present? }
end

#itemsObject



30
31
32
33
34
35
36
37
38
# File 'lib/podio/models/contract_price.rb', line 30

def items
  if @items.nil?
    @items = {}
    self[:items].each do |key, attributes|
      @items[key] = Podio::ContractPriceItem.new(attributes)
    end
  end
  @items
end

#premium_employeesObject



6
7
8
# File 'lib/podio/models/contract_price.rb', line 6

def premium_employees
  users.select { |u| u['items']['employee'].present? }
end

#premium_employees?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/podio/models/contract_price.rb', line 14

def premium_employees?
  items['employee'].present?
end

#total_for_emp_networkObject



26
27
28
# File 'lib/podio/models/contract_price.rb', line 26

def total_for_emp_network
  items['emp_network']['sub_total']
end

#total_for_premium_employeesObject



18
19
20
# File 'lib/podio/models/contract_price.rb', line 18

def total_for_premium_employees
  items['employee']['sub_total']
end