Class: Agile::Events
- Inherits:
-
Thor
- Object
- Thor
- Agile::Events
- Defined in:
- lib/agile/commands/events.rb
Instance Method Summary collapse
- #create ⇒ Object
- #list ⇒ Object
-
#show(date) ⇒ Object
:reek:ControlParameter.
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/agile/commands/events.rb', line 4 def create cli = HighLine.new event_description = cli.ask("description for event: ", String) RestClient.post"#{CONFIG['current_remote']}/api/v1/events/", event_type: type_cli, frequency: frequency_cli, date: date_cli, start_time: start_time_cli, end_time: end_time_cli, desc: event_description, current_user: CONFIG["current_user"] say "Successfully added new event!" end |
#list ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/agile/commands/events.rb', line 15 def list response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/" say "<<Project events>>" JSON.parse(response).each do |event| if event["project_id"] == CONFIG["current_project_id"] info = parse_info(event) puts "#{event['event_type']} starting #{parse_date(event)} at #{info[:start]} and end at #{info[:end]}" end end end |
#show(date) ⇒ Object
:reek:ControlParameter
28 29 30 31 |
# File 'lib/agile/commands/events.rb', line 28 def show(date) response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/" JSON.parse(response).each { |event| puts_info(event) if event["date"] == date } end |