Class: Gitloggl::Toggle::Cli
- Inherits:
-
Object
- Object
- Gitloggl::Toggle::Cli
- Includes:
- Hooks, Hooks::InstanceHooks
- Defined in:
- lib/gitloggl/toggle/cli.rb
Instance Attribute Summary collapse
-
#date_from ⇒ Object
Returns the value of attribute date_from.
-
#date_to ⇒ Object
Returns the value of attribute date_to.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#token ⇒ Object
Returns the value of attribute token.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
-
#workspace_id ⇒ Object
Returns the value of attribute workspace_id.
Instance Method Summary collapse
-
#initialize(params = {}) {|_self| ... } ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(params = {}) {|_self| ... } ⇒ Cli
Returns a new instance of Cli.
11 12 13 14 |
# File 'lib/gitloggl/toggle/cli.rb', line 11 def initialize(params = {}) params.each { |k, v| public_send("#{k}=", v) } yield(self) if block_given? end |
Instance Attribute Details
#date_from ⇒ Object
Returns the value of attribute date_from.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def date_from @date_from end |
#date_to ⇒ Object
Returns the value of attribute date_to.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def date_to @date_to end |
#project_id ⇒ Object
Returns the value of attribute project_id.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def project_id @project_id end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def token @token end |
#verbose ⇒ Object
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def verbose @verbose end |
#workspace_id ⇒ Object
Returns the value of attribute workspace_id.
9 10 11 |
# File 'lib/gitloggl/toggle/cli.rb', line 9 def workspace_id @workspace_id end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitloggl/toggle/cli.rb', line 16 def run data = request.fetch('data').flat_map { |row| row.fetch('items') } data.map! do |row| OpenStruct.new( title: row.fetch('title').fetch('time_entry'), spent_ms: row.fetch('time') ) end run_hook(:on_done, data) end |