google_client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +3 -1
- data/CHANGELOG.md +14 -0
- data/README.md +22 -19
- data/lib/google_client/calendar.rb +11 -2
- data/lib/google_client/event.rb +18 -5
- data/lib/google_client/user.rb +1 -1
- data/lib/google_client/version.rb +1 -1
- data/scripts/create_calendar.rb +18 -0
- data/scripts/create_event.rb +24 -0
- data/scripts/delete_calendar.rb +11 -0
- data/scripts/delete_event.rb +12 -0
- data/scripts/fetch_calendar.rb +13 -0
- data/scripts/fetch_contacts.rb +15 -0
- data/scripts/fetch_events.rb +16 -0
- data/scripts/refresh_token.rb +10 -0
- data/scripts/user_profile.rb +8 -0
- data/spec/calendar_spec.rb +54 -4
- metadata +22 -12
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
# v0.2.0
|
|
3
|
+
|
|
4
|
+
* Script folder with examples of use
|
|
5
|
+
* Feature: added attendee status as a new attribute in the attendees list
|
|
6
|
+
* Feature: fetch event by id
|
|
7
|
+
* User#create_calendar allows an empty Hash as parameter
|
|
8
|
+
* Create event: added parameters attendees and send_event_notifications
|
|
9
|
+
* Create calendar: enable a block as parameter
|
|
10
|
+
|
|
11
|
+
# v0.1.0
|
|
12
|
+
|
|
13
|
+
* First release
|
|
14
|
+
|
data/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
This gem can be used to get access to a specific set of Google APIs.
|
|
3
2
|
|
|
4
3
|
# Installation
|
|
@@ -20,33 +19,37 @@ This gem can be used to get access to a specific set of Google APIs.
|
|
|
20
19
|
* Google Contacts
|
|
21
20
|
* Fetch user contacts
|
|
22
21
|
|
|
22
|
+
Take a look into [CHANGELOG.md](google_client/blob/master/CHANGELOG.md)
|
|
23
|
+
|
|
23
24
|
# Getting started
|
|
24
25
|
|
|
25
26
|
Any request that may be done on behalf of the user needs a valid authentication token:
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# Get user contacts
|
|
31
|
-
contacts = user.contacts
|
|
28
|
+
```ruby
|
|
29
|
+
require "gogole_client"
|
|
30
|
+
user = GoogleClient::User.new "user-authentication-token"
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
# Get user contacts
|
|
33
|
+
contacts = user.contacts
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
# Get user calendars
|
|
36
|
+
calendars = user.calendars
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
# Get a specific user calendar
|
|
39
|
+
calendar = user.calendars("<calendar-id>")
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
:details => "Hello world",
|
|
45
|
-
:timezone => "Spain", :location => "Barcelona"})
|
|
41
|
+
# Fetch calendar events
|
|
42
|
+
events = calendar.events
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
# Create calendar
|
|
45
|
+
calendar = user.create_calendar({:title => "my-new-calendar",
|
|
46
|
+
:details => "Hello world",
|
|
47
|
+
:timezone => "Spain", :location => "Barcelona"})
|
|
48
|
+
|
|
49
|
+
# ...
|
|
50
|
+
```
|
|
48
51
|
|
|
49
|
-
Take a look on the [user.rb](blob/master/lib/google_client/user.rb) file to check the available methods
|
|
52
|
+
Take a look on the [user.rb](google_client/blob/master/lib/google_client/user.rb) file to check the available methods
|
|
50
53
|
|
|
51
54
|
# Roadmap
|
|
52
55
|
|
|
@@ -89,4 +92,4 @@ Take a look on the [user.rb](blob/master/lib/google_client/user.rb) file to chec
|
|
|
89
92
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
90
93
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
91
94
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
92
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
95
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -20,6 +20,7 @@ module GoogleClient
|
|
|
20
20
|
@timezone = params[:timezone]
|
|
21
21
|
@location = params[:location]
|
|
22
22
|
@json_mode = true
|
|
23
|
+
block_given? and yield self
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def to_s
|
|
@@ -78,8 +79,7 @@ module GoogleClient
|
|
|
78
79
|
events = events["feed"]["entry"]
|
|
79
80
|
events.map{ |event| Event.build_event(event, self)}
|
|
80
81
|
elsif args.is_a?(String)
|
|
81
|
-
|
|
82
|
-
#Event.new({:id => args, :calendar => self}).fetch
|
|
82
|
+
Event.new({:id => args, :calendar => self}).fetch
|
|
83
83
|
elsif args.is_a?(Hash)
|
|
84
84
|
if args.is_a?(Hash) && args.has_key?(:id)
|
|
85
85
|
Event.new({:id => args[:id], :calendar => self}).fetch
|
|
@@ -103,6 +103,15 @@ module GoogleClient
|
|
|
103
103
|
:to => (Time.now + time).strftime("%Y-%m-%dT%k:%M:%S").concat(timezone).gsub(/ /,"0")})
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
+
# Create a new event in the calendar
|
|
107
|
+
# ==== Parameters
|
|
108
|
+
# * *params* Hash options
|
|
109
|
+
# * c.send_event_notifications : true | false
|
|
110
|
+
# * c.title : event title (string)
|
|
111
|
+
# * c.description : event detail description (string)
|
|
112
|
+
# * c.start_time : start time (time format)
|
|
113
|
+
# * c.end_time : end time (time format)
|
|
114
|
+
# * c.attendees : array of emails or hashes with :name and :email
|
|
106
115
|
def create_event(params = {})
|
|
107
116
|
event = if block_given?
|
|
108
117
|
Event.create(params.merge({:calendar => self}), &Proc.new)
|
data/lib/google_client/event.rb
CHANGED
|
@@ -13,6 +13,7 @@ module GoogleClient
|
|
|
13
13
|
attr_accessor :end_time
|
|
14
14
|
attr_accessor :location
|
|
15
15
|
attr_accessor :attendees
|
|
16
|
+
attr_accessor :send_event_notifications
|
|
16
17
|
attr_accessor :comments
|
|
17
18
|
|
|
18
19
|
def initialize(params = {})
|
|
@@ -25,7 +26,8 @@ module GoogleClient
|
|
|
25
26
|
@calendar_id = params[:calendar_id]
|
|
26
27
|
@calendar = params[:calendar]
|
|
27
28
|
@comments = params[:comments]
|
|
28
|
-
@attendees = params[:attendees]
|
|
29
|
+
@attendees = params[:attendees].nil? ? [] : params[:attendees].map{|x| x.kind_of?(String) ? {:email => x} : x}
|
|
30
|
+
@send_event_notifications = params[:send_event_notifications]
|
|
29
31
|
|
|
30
32
|
@calendar.nil? or @connection = @calendar.connection
|
|
31
33
|
@json_mode = true
|
|
@@ -33,7 +35,7 @@ module GoogleClient
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def to_s
|
|
36
|
-
"#{self.class.name} => { id: #{@id}, title: #{@title}, description: #{@description}, :start_time => #{@start_time}, :end_time => #{@end_time}, :location => #{@location}, :attendees => #{@attendees} }"
|
|
38
|
+
"#{self.class.name} => { id: #{@id}, title: #{@title}, description: #{@description}, :start_time => #{@start_time}, :end_time => #{@end_time}, :location => #{@location}, :attendees => #{@attendees}, :send_event_notifications => #{@send_event_notifications}, :calendar => #{@calendar} }"
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
def to_hash
|
|
@@ -42,7 +44,9 @@ module GoogleClient
|
|
|
42
44
|
:details => @description,
|
|
43
45
|
:timeZone => @timezone,
|
|
44
46
|
:when => [{:start => @start_time,
|
|
45
|
-
:end => @end_time}]
|
|
47
|
+
:end => @end_time}],
|
|
48
|
+
:attendees => @attendees.map{|x| {:valueString => x[:name], :email => x[:email]}},
|
|
49
|
+
:sendEventNotifications => @send_event_notifications || false
|
|
46
50
|
}.delete_if{|k,v| v.nil?}
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -97,7 +101,7 @@ module GoogleClient
|
|
|
97
101
|
@calendar.nil? and raise Error.new "calendar or calendar_id must be valid in the event"
|
|
98
102
|
@calendar_id = @calendar.id
|
|
99
103
|
end
|
|
100
|
-
data = connection.get "/calendar/feeds/#{@calendar_id}/private/full/#{@id}"
|
|
104
|
+
data = decode_response connection.get "/calendar/feeds/#{@calendar_id}/private/full/#{@id}"
|
|
101
105
|
self.class.build_event data["entry"], @calendar
|
|
102
106
|
end
|
|
103
107
|
|
|
@@ -112,8 +116,17 @@ module GoogleClient
|
|
|
112
116
|
end
|
|
113
117
|
|
|
114
118
|
def build_event(data, calendar = nil)
|
|
119
|
+
data.nil? and return Event.new
|
|
120
|
+
|
|
115
121
|
attendees = data["gd$who"]
|
|
116
|
-
attendees.nil? or attendees = attendees.
|
|
122
|
+
attendees.nil? or attendees = attendees.inject([]) do |values, attendee|
|
|
123
|
+
if attendee.has_key?("gd$attendeeStatus")
|
|
124
|
+
values << { :name => attendee["valueString"],
|
|
125
|
+
:email => attendee["email"],
|
|
126
|
+
:status => attendee["gd$attendeeStatus"]["value"].split("\.").last}
|
|
127
|
+
end
|
|
128
|
+
values
|
|
129
|
+
end
|
|
117
130
|
|
|
118
131
|
start_time = data["gd$when"][0]["startTime"]
|
|
119
132
|
end_time = data["gd$when"][0]["endTime"]
|
data/lib/google_client/user.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
$:.unshift(File.join("../", "lib")).unshift(".")
|
|
2
|
+
|
|
3
|
+
require 'google_client'
|
|
4
|
+
require 'script_config'
|
|
5
|
+
|
|
6
|
+
timezone = "Spain"
|
|
7
|
+
location = "Barcelona"
|
|
8
|
+
|
|
9
|
+
user = GoogleClient::User.new AUTH_TOKEN
|
|
10
|
+
|
|
11
|
+
calendar = user.create_calendar do |c|
|
|
12
|
+
c.title = "google_client"
|
|
13
|
+
c.details = "Calendar created using google_client gem."
|
|
14
|
+
c.timezone = timezone
|
|
15
|
+
c.location = location
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
puts calendar
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
$:.unshift(File.join("../", "lib")).unshift(".")
|
|
2
|
+
|
|
3
|
+
require 'google_client'
|
|
4
|
+
require 'script_config'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
user = GoogleClient::User.new AUTH_TOKEN
|
|
8
|
+
|
|
9
|
+
calendar = user.calendar(CALENDAR_ID)
|
|
10
|
+
|
|
11
|
+
start_time = Time.now.strftime("%Y-%m-%dT%H:%M:%S.000%z")
|
|
12
|
+
start_time = "#{start_time[0..-3]}:#{start_time[-2..-1]}"
|
|
13
|
+
end_time = (Time.now+60).strftime("%Y-%m-%dT%H:%M:%S.000%z")
|
|
14
|
+
end_time = "#{end_time[0..-3]}:#{end_time[-2..-1]}"
|
|
15
|
+
|
|
16
|
+
event = calendar.create_event do |e|
|
|
17
|
+
e.send_event_notifications = true
|
|
18
|
+
e.title = "This is a cool event"
|
|
19
|
+
e.description = "foo => bar"
|
|
20
|
+
e.start_time = start_time
|
|
21
|
+
e.end_time = end_time
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
puts event
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
$:.unshift(File.join("../", "lib")).unshift(".")
|
|
2
|
+
|
|
3
|
+
require 'google_client'
|
|
4
|
+
require 'script_config'
|
|
5
|
+
|
|
6
|
+
user = GoogleClient::User.new AUTH_TOKEN
|
|
7
|
+
|
|
8
|
+
calendar = user.calendar(CALENDAR_ID)
|
|
9
|
+
|
|
10
|
+
event = GoogleClient::Event.new({:id => ARGV.shift, :calendar => calendar})
|
|
11
|
+
|
|
12
|
+
puts event.delete
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
$:.unshift(File.join("../", "lib")).unshift(".")
|
|
3
|
+
|
|
4
|
+
require 'google_client'
|
|
5
|
+
require 'script_config'
|
|
6
|
+
require 'pry'
|
|
7
|
+
|
|
8
|
+
user = GoogleClient::User.new AUTH_TOKEN
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
puts user.contacts
|
|
12
|
+
rescue GoogleClient::AuthenticationError => ex
|
|
13
|
+
puts "Invalid token"
|
|
14
|
+
end
|
|
15
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
$:.unshift(File.join("../", "lib")).unshift(".")
|
|
3
|
+
|
|
4
|
+
require 'google_client'
|
|
5
|
+
require 'script_config'
|
|
6
|
+
require 'pry'
|
|
7
|
+
|
|
8
|
+
user = GoogleClient::User.new AUTH_TOKEN
|
|
9
|
+
|
|
10
|
+
calendar = user.calendar(CALENDAR_ID)
|
|
11
|
+
|
|
12
|
+
if ARGV.empty?
|
|
13
|
+
puts calendar.forthcoming_events(36000)
|
|
14
|
+
else
|
|
15
|
+
puts calendar.events(ARGV.shift)
|
|
16
|
+
end
|
data/spec/calendar_spec.rb
CHANGED
|
@@ -11,8 +11,7 @@ describe GoogleClient::Calendar do
|
|
|
11
11
|
GoogleClient::Calendar.new({:user => user, :id => CALENDAR_ID})
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
describe "while initializing" do
|
|
15
|
-
|
|
14
|
+
describe "while initializing" do
|
|
16
15
|
it "should set the OAuth credentials properly" do
|
|
17
16
|
user.oauth_credentials.should eql(USER_TOKEN)
|
|
18
17
|
end
|
|
@@ -21,13 +20,64 @@ describe GoogleClient::Calendar do
|
|
|
21
20
|
|
|
22
21
|
describe "while fetching events" do
|
|
23
22
|
it "should fetch all the calendar events when no param is provided" do
|
|
24
|
-
|
|
23
|
+
http_connection = double("HttpConnection")
|
|
24
|
+
response = double("HttpResponse")
|
|
25
|
+
response.stub(:code) { 200 }
|
|
26
|
+
response.stub(:body) { "{\"version\":\"1.0\",\"encoding\":\"UTF-8\",\"feed\":\
|
|
27
|
+
{\"xmlns\":\"http://www.w3.org/2005/Atom\",\"xmlns$openSearch\":\"http://a9.com/-/spec/opensearchrss/1.0/\",\
|
|
28
|
+
\"xmlns$gCal\":\"http://schemas.google.com/gCal/2005\",\"xmlns$gd\":\"http://schemas.google.com/g/2005\",\
|
|
29
|
+
\"id\":{\"$t\":\"http://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full\"},\
|
|
30
|
+
\"updated\":{\"$t\":\"2011-11-13T22:11:56.000Z\"},\"category\":[{\"scheme\":\"http://schemas.google.com/g/2005#kind\",\
|
|
31
|
+
\"term\":\"http://schemas.google.com/g/2005#event\"}],\"title\":{\"$t\":\"connfurence\",\"type\":\"text\"},\
|
|
32
|
+
\"subtitle\":{\"$t\":\"This calendar must be used by the user to create conference events.\",\"type\":\"text\"},\
|
|
33
|
+
\"link\":[{\"rel\":\"alternate\",\"type\":\"text/html\",\
|
|
34
|
+
\"href\":\"https://www.google.com/calendar/embed?src=md8goqfs0pkpfbq0rintm786e4@group.calendar.google.com\"},\
|
|
35
|
+
{\"rel\":\"http://schemas.google.com/g/2005#feed\",\"type\":\"application/atom+xml\",\
|
|
36
|
+
\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full\"},\
|
|
37
|
+
{\"rel\":\"http://schemas.google.com/g/2005#post\",\"type\":\"application/atom+xml\",\
|
|
38
|
+
\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full\"},\
|
|
39
|
+
{\"rel\":\"http://schemas.google.com/g/2005#batch\",\"type\":\"application/atom+xml\",\
|
|
40
|
+
\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full/batch\"},\
|
|
41
|
+
{\"rel\":\"self\",\"type\":\"application/atom+xml\",\
|
|
42
|
+
\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/\
|
|
43
|
+
full?alt=json&max-results=25&start-min=2011-11-14T00%3A12%3A29%2B02%3A00&start-max=2011-11-14T10%3A12%3A29%2B02%3A00\"}],\
|
|
44
|
+
\"author\":[{\"name\":{\"$t\":\"connfurence\"}}],\"generator\":{\"$t\":\"Google Calendar\",\"version\":\"1.0\",\
|
|
45
|
+
\"uri\":\"http://www.google.com/calendar\"},\"openSearch$totalResults\":{\"$t\":1},\"openSearch$startIndex\":\
|
|
46
|
+
{\"$t\":1},\"openSearch$itemsPerPage\":{\"$t\":25},\"gCal$timezone\":{\"value\":\"Asia/Jerusalem\"},\"gCal$timesCleaned\":\
|
|
47
|
+
{\"value\":0},\"gd$where\":{\"valueString\":\"Tel Aviv\"},\"entry\":[{\"id\":{\"$t\":\
|
|
48
|
+
\"http://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full/001q3b6f0n268mea33o59dopvs\"}\
|
|
49
|
+
,\"published\":{\"$t\":\"2011-11-13T22:11:55.000Z\"},\"updated\":{\"$t\":\"2011-11-13T22:11:55.000Z\"},\
|
|
50
|
+
\"category\":[{\"scheme\":\"http://schemas.google.com/g/2005#kind\",\"term\":\"http://schemas.google.com/g/2005#event\"}],\
|
|
51
|
+
\"title\":{\"$t\":\"This is a cool event\",\"type\":\"text\"},\"content\":{\"$t\":\"foo =\u003e bar\",\"type\":\"text\"},\
|
|
52
|
+
\"link\":[{\"rel\":\"alternate\",\"type\":\"text/html\",\"href\":\"https://www.google.com/calendar/event?eid=MDAxcTNiNmYwbjI2OG1lYTMzbzU5ZG9wdnMgbWQ4Z29xZnMwcGtwZmJxMHJpbnRtNzg2ZTRAZw\",\"title\":\"alternate\"},{\"rel\":\"self\",\"type\":\"application/atom+xml\",\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full/001q3b6f0n268mea33o59dopvs\"},{\"rel\":\"edit\",\"type\":\"application/atom+xml\",\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full/001q3b6f0n268mea33o59dopvs/63456905515\"}],\"author\":[{\"name\":{\"$t\":\"juandebravo@gmail.com\"},\"email\":{\"$t\":\"juandebravo@gmail.com\"}}],\"gd$comments\":{\"gd$feedLink\":{\"href\":\"https://www.google.com/calendar/feeds/md8goqfs0pkpfbq0rintm786e4%40group.calendar.google.com/private/full/001q3b6f0n268mea33o59dopvs/comments\"}},\"gd$eventStatus\":{\"value\":\"http://schemas.google.com/g/2005#event.confirmed\"},\"gd$where\":[{}],\"gd$who\":[{\"email\":\"md8goqfs0pkpfbq0rintm786e4@group.calendar.google.com\",\"rel\":\"http://schemas.google.com/g/2005#event.organizer\",\"valueString\":\"connfurence\"}],\"gd$when\":[{\"endTime\":\"2011-11-14T00:13:07.000+02:00\",\"startTime\":\"2011-11-14T00:12:07.000+02:00\"}],\"gd$transparency\":{\"value\":\"http://schemas.google.com/g/2005#event.opaque\"},\"gd$visibility\":{\"value\":\"http://schemas.google.com/g/2005#event.default\"},\"gCal$anyoneCanAddSelf\":{\"value\":\"false\"},\"gCal$guestsCanInviteOthers\":{\"value\":\"true\"},\"gCal$guestsCanModify\":{\"value\":\"false\"},\"gCal$guestsCanSeeGuests\":{\"value\":\"true\"},\"gCal$sequence\":{\"value\":0},\"gCal$uid\":{\"value\":\"001q3b6f0n268mea33o59dopvs@google.com\"}}]}}"}
|
|
53
|
+
|
|
54
|
+
http_connection.stub(:get).with("/calendar/feeds/#{CALENDAR_ID}/private/full") {
|
|
55
|
+
response
|
|
56
|
+
}
|
|
57
|
+
calendar.stub(:connection) { http_connection }
|
|
58
|
+
|
|
59
|
+
events = calendar.events
|
|
60
|
+
events.length.should == 1
|
|
61
|
+
event = events[0]
|
|
62
|
+
event.should be_instance_of GoogleClient::Event
|
|
63
|
+
event.id.should == "001q3b6f0n268mea33o59dopvs"
|
|
64
|
+
event.title.should == "This is a cool event"
|
|
65
|
+
event.description.should == "foo => bar"
|
|
66
|
+
event.start_time.should == "2011-11-14T00:12:07.000+02:00"
|
|
67
|
+
event.end_time.should == "2011-11-14T00:13:07.000+02:00"
|
|
25
68
|
end
|
|
26
69
|
end
|
|
27
70
|
|
|
28
71
|
describe "while deleting a calendar" do
|
|
29
72
|
it "should delete the calendar when a valid id is set" do
|
|
30
|
-
|
|
73
|
+
http_connection = double("HttpConnection")
|
|
74
|
+
response = double("HttpResponse")
|
|
75
|
+
response.stub(:code) { 200 }
|
|
76
|
+
http_connection.stub(:delete).with("/calendar/feeds/default/owncalendars/full/#{CALENDAR_ID}") {
|
|
77
|
+
response
|
|
78
|
+
}
|
|
79
|
+
calendar.stub(:connection) { http_connection }
|
|
80
|
+
calendar.delete.should be_true
|
|
31
81
|
end
|
|
32
82
|
end
|
|
33
83
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-11-
|
|
12
|
+
date: 2011-11-13 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &2156255200 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *2156255200
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: addressable
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &2156251080 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: '0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *2156251080
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rake
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &2156250640 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ! '>='
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: '0'
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *2156250640
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rspec
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &2156250220 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,10 +54,10 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *2156250220
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
59
|
name: webmock
|
|
60
|
-
requirement: &
|
|
60
|
+
requirement: &2156249780 !ruby/object:Gem::Requirement
|
|
61
61
|
none: false
|
|
62
62
|
requirements:
|
|
63
63
|
- - ! '>='
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
version: '0'
|
|
66
66
|
type: :development
|
|
67
67
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *2156249780
|
|
69
69
|
description: This gem is a wrapper on top of the Google API that allows a developer
|
|
70
70
|
to handle calendars, events, contacts on behalf of the user.
|
|
71
71
|
email:
|
|
@@ -75,6 +75,7 @@ extensions: []
|
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
77
|
- .rspec
|
|
78
|
+
- CHANGELOG.md
|
|
78
79
|
- Gemfile
|
|
79
80
|
- README.md
|
|
80
81
|
- Rakefile
|
|
@@ -93,6 +94,15 @@ files:
|
|
|
93
94
|
- lib/google_client/profile.rb
|
|
94
95
|
- lib/google_client/user.rb
|
|
95
96
|
- lib/google_client/version.rb
|
|
97
|
+
- scripts/create_calendar.rb
|
|
98
|
+
- scripts/create_event.rb
|
|
99
|
+
- scripts/delete_calendar.rb
|
|
100
|
+
- scripts/delete_event.rb
|
|
101
|
+
- scripts/fetch_calendar.rb
|
|
102
|
+
- scripts/fetch_contacts.rb
|
|
103
|
+
- scripts/fetch_events.rb
|
|
104
|
+
- scripts/refresh_token.rb
|
|
105
|
+
- scripts/user_profile.rb
|
|
96
106
|
- spec/calendar_spec.rb
|
|
97
107
|
- spec/contact_spec.rb
|
|
98
108
|
- spec/event_spec.rb
|