Class: AllHours::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/all_hours/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, api:) ⇒ Client

Returns a new instance of Client.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/all_hours/client.rb', line 22

def initialize data:, api:
  @project_ids = data["project_ids"]
  @id = data["id"]
  @account = data["account"]
  @externalId = data["externalId"]
  @name = data["name"]
  @createdAt = Date.parse data["createdAt"]
  @lineItemMask = data["lineItemMask"]
  @paymentDueDays = data["paymentDueDays"]
  @businessDetails = data["businessDetails"]
  @invoicePublicNotes = data["invoicePublicNotes"]
  @excludedLabels = data["excludedLabels"]
  @status = data["status"]
  @enableResourcePlanner = data["enableResourcePlanner"]
  @favorite = data["favorite"]
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def 
  @account
end

#businessDetailsObject

Returns the value of attribute businessDetails.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def businessDetails
  @businessDetails
end

#createdAtObject

Returns the value of attribute createdAt.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def createdAt
  @createdAt
end

#enableResourcePlannerObject

Returns the value of attribute enableResourcePlanner.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def enableResourcePlanner
  @enableResourcePlanner
end

#excludedLabelsObject

Returns the value of attribute excludedLabels.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def excludedLabels
  @excludedLabels
end

#externalIdObject

Returns the value of attribute externalId.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def externalId
  @externalId
end

#favoriteObject

Returns the value of attribute favorite.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def favorite
  @favorite
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def id
  @id
end

#invoicePublicNotesObject

Returns the value of attribute invoicePublicNotes.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def invoicePublicNotes
  @invoicePublicNotes
end

#lineItemMaskObject

Returns the value of attribute lineItemMask.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def lineItemMask
  @lineItemMask
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def name
  @name
end

#paymentDueDaysObject

Returns the value of attribute paymentDueDays.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def paymentDueDays
  @paymentDueDays
end

#project_idsObject

Returns the value of attribute project_ids.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def project_ids
  @project_ids
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/all_hours/client.rb', line 7

def status
  @status
end

Class Method Details

.all(api:, query: nil) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/all_hours/client.rb', line 39

def self.all api:, query: nil
  data = api.api_call path: "projects", query: {query: query}
  clients = []
  data.each do |client_data|
    clients << Client.new(api: api, data: client_data)
  end

  clients
end