Class: Kounta::Company

Inherits:
Resource
  • Object
show all
Defined in:
lib/kounta/company.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

coerce, #delete!, has_many, has_many_in_time_range, has_one, #ignored_properties, #new?, #save!, #to_hash

Constructor Details

#initialize(client, hash = {}) ⇒ Company

Returns a new instance of Company.



48
49
50
51
52
53
54
55
56
57
# File 'lib/kounta/company.rb', line 48

def initialize(client, hash = {})
  @client = client

  if hash.empty?
    response = client.perform({ companies: 'me' }, :get).parsed
    super(response)
  else
    super(hash)
  end
end

Instance Method Details

#base_price_listObject



59
60
61
# File 'lib/kounta/company.rb', line 59

def base_price_list
  client.object_from_response(Kounta::PriceList, :get, companies: id, price_lists: 'base')
end

#resource_pathObject



63
64
65
# File 'lib/kounta/company.rb', line 63

def resource_path
  { companies: id }
end