Class: Checkoff::Internal::ProjectHashes

Inherits:
Object
  • Object
show all
Defined in:
lib/checkoff/internal/project_hashes.rb

Overview

Builds on the standard API representation of an Asana project with some convenience keys.

Instance Method Summary collapse

Constructor Details

#initialize(_deps = {}) ⇒ ProjectHashes

Returns a new instance of ProjectHashes.

Parameters:

  • _deps (Hash) (defaults to: {})


9
# File 'lib/checkoff/internal/project_hashes.rb', line 9

def initialize(_deps = {}); end

Instance Method Details

#project_to_h(project_obj, project: :not_specified) ⇒ Hash

Parameters:

  • project_obj (Asana::Resources::Project)
  • project (String, Symbol<:not_specified, :my_tasks>) (defaults to: :not_specified)

Returns:

  • (Hash)


15
16
17
18
19
20
21
# File 'lib/checkoff/internal/project_hashes.rb', line 15

def project_to_h(project_obj, project: :not_specified)
  project = project_obj.name if project == :not_specified
  project_hash = { **project_obj.to_h, 'project' => project }
  project_hash['unwrapped'] = {}
  unwrap_custom_fields(project_hash)
  project_hash
end