Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.org and Modified share command #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ goohubは,Google Calendarとの認証を行い,予定の取得や送信を
また,Google Calendar上の予定をユーザが指定したルールによって予定を書き換え,特定のメディア(Google Calendar, Slack, メール)に送信する機能をもつ.

* Requirements
+ Ruby 2.1.5 ~
+ bundler 1.15.14 ~
+ Ruby 2.7.0 ~
+ bundler 2.1.2 ~

Rubyとbundlerのインストールについては,以下を参考にすること.
+ [[https://www.ruby-lang.org/ja/documentation/installation/][Rubyのインストール方法]]
Expand All @@ -19,7 +19,7 @@ $ bundler -v # check bundler version
* Installation and Setup
1. Clone code
#+BEGIN_SRC sh
$ git clone [email protected]:kjtbw/goohub.git
$ git clone [email protected]:nomlab/goohub.git
#+END_SRC

2. Install gems
Expand Down
2 changes: 1 addition & 1 deletion goohub.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "sinatra-contrib"
spec.add_development_dependency "sinatra-cross_origin"

spec.add_development_dependency "bundler", "~> 1.13"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
end
12 changes: 10 additions & 2 deletions lib/goohub/command/share.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,16 @@ def parse_event(event)
e.summary = event.summary
e.location = event.location
e.description = event.description
e.dtstart = event.start.date_time
e.dtend = event.end.date_time
if event.start.date_time
e.dtstart = event.start.date_time
else
e.start = event.start.date
end
if event.start.date_time
e.dtend = event.end.date_time
else
e.end = event.end.date
end
return e
end
end# class GoohubCLI
41 changes: 30 additions & 11 deletions lib/goohub/expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def parse_event(event)
@sentence_items["description"] = event.description
@sentence_items["id"] = event.id
@sentence_items["start_time"] = event.dtstart
@sentence_items["start_date"] = event.start
@sentence_items["end_time"] = event.dtend
@sentence_items["end_date"] = event.end
@sentence_items["location"] = event.location
@sentence_items
end
Expand All @@ -282,17 +284,34 @@ def convert_sentence
end

def convert_google_event
event =
Google::Apis::CalendarV3::Event.new({
summary: @sentence_items["summary"],
start: {
date_time: @sentence_items["start_time"],
},
end: {
date_time: @sentence_items["end_time"],
},
location: @sentence_items["location"]
})
if @sentence_items["start_time"]&&@sentence_items["end_time"]
event =
Google::Apis::CalendarV3::Event.new({
summary: @sentence_items["summary"],
start: {
date_time: @sentence_items["start_time"],
},
end: {
date_time: @sentence_items["end_time"],
},
location: @sentence_items["location"]
})
elsif @sentence_items["start_date"]&&@sentence_items["end_date"]
event =
Google::Apis::CalendarV3::Event.new({
summary: @sentence_items["summary"],
start: {
date: @sentence_items["start_date"]
},
end: {
date: @sentence_items["end_date"]
},
location: @sentence_items["location"]
})
else
puts("Error: Event Paramater")
exit
end
event
end

Expand Down
2 changes: 1 addition & 1 deletion lib/goohub/resource/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Goohub
module Resource
class Event < Base

attr_accessor :id, :summary, :location, :description, :dtstart, :dtend
attr_accessor :id, :summary, :location, :description, :dtstart, :dtend, :start, :end
def initialize(raw_resource)
@raw_resource = raw_resource
@id = raw_resource.id
Expand Down