open_auth2 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,116 @@
1
+ require 'open_auth2'
2
+ require 'spec_helper'
3
+
4
+ describe OpenAuth2::Config do
5
+ subject { described_class.new }
6
+
7
+ it 'overwrites default values' do
8
+ overwrite_response_type
9
+ subject.response_type.should == :overwritten
10
+ end
11
+
12
+ context '#initialize' do
13
+ subject do
14
+ described_class.new do |c|
15
+ c.client_id = :set_in_new
16
+ end
17
+ end
18
+
19
+ it 'sets default as provider' do
20
+ subject.provider.should == :default
21
+ end
22
+
23
+ it 'accepts a block to set config' do
24
+ subject.client_id.should == :set_in_new
25
+ end
26
+ end
27
+
28
+ context '#configure' do
29
+ it 'accepts a block to set/overwrite config' do
30
+ subject.configure do |c|
31
+ c.client_id = :set_in_configure
32
+ end
33
+
34
+ subject.client_id.should == :set_in_configure
35
+ end
36
+ end
37
+
38
+ context '#provider=' do
39
+ before do
40
+ subject.provider = :facebook
41
+ end
42
+
43
+ it 'sets provider' do
44
+ subject.provider.should == :facebook
45
+ end
46
+
47
+ it 'sets provider_string' do
48
+ subject.provider_string.should == 'facebook'
49
+ end
50
+
51
+ let(:facebook_const) do
52
+ OpenAuth2::Provider::Facebook
53
+ end
54
+
55
+ it 'sets provider_const' do
56
+ subject.provider_const.should == facebook_const
57
+ end
58
+
59
+ it 'copies over options from provider' do
60
+ subject.authorize_url.should == 'https://graph.facebook.com'
61
+ end
62
+
63
+ it 'keeps non-overlapping default options' do
64
+ subject.response_type.should == 'code'
65
+ end
66
+
67
+ it 'overwrites overlapping default options' do
68
+ subject.refresh_token_name.should == 'fb_exchange_token'
69
+ end
70
+
71
+ it 'raises UnknownProvider if arg is not in list of providers' do
72
+ expect do
73
+ subject.provider = :unknown
74
+ end.to raise_error(OpenAuth2::UnknownProvider)
75
+ end
76
+
77
+ it 'provides list of known providers with UnknownProvider' do
78
+ # mimicking beh. of users including their own provider
79
+ module OpenAuth2::Provider module UserDefined end end
80
+
81
+ expect do
82
+ subject.provider = :unknown
83
+ end.to raise_error(OpenAuth2::UnknownProvider)
84
+ end
85
+ end
86
+
87
+ let(:overwrite_response_type) do
88
+ subject.configure do |c|
89
+ c.response_type = :overwritten
90
+ end
91
+ end
92
+
93
+ context '#reset_provider' do
94
+ it 'resets locally set values' do
95
+ overwrite_response_type
96
+ subject.reset_provider
97
+
98
+ subject.response_type.should == 'code'
99
+ end
100
+
101
+ let(:set_to_fb_and_reset) do
102
+ subject.provider = :facebook
103
+ subject.reset_provider
104
+ end
105
+
106
+ it 'resets provider to default' do
107
+ set_to_fb_and_reset
108
+ subject.provider.should == :default
109
+ end
110
+
111
+ it 'resets all config to default values' do
112
+ set_to_fb_and_reset
113
+ subject.authorize_url.should == nil
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,82 @@
1
+ require 'open_auth2'
2
+ require 'spec_helper'
3
+
4
+ describe 'Facebook Client' do
5
+ let(:config) do
6
+ OpenAuth2::Config.new do |c|
7
+ c.provider = :facebook
8
+ c.client_id = Creds::Facebook::ClientId
9
+ c.client_secret = Creds::Facebook::ClientSecret
10
+ c.code = Creds::Facebook::Code
11
+ c.redirect_uri = 'http://localhost:9393/'
12
+ c.scope = ['offline_access', 'publish_stream']
13
+ end
14
+ end
15
+
16
+ subject { OpenAuth2::Client.new(config) }
17
+
18
+ context '#get' do
19
+ it 'makes public request' do
20
+ VCR.use_cassette('fb/cocacola') do
21
+ request = subject.get(:path => '/cocacola')
22
+ request.status.should == 200
23
+ end
24
+ end
25
+
26
+ it 'makes private request if #access_token' do
27
+ subject.configure do |c|
28
+ c.access_token = Creds::Facebook::AccessToken
29
+ end
30
+
31
+ VCR.use_cassette('fb/me') do
32
+ request = subject.get(:path => '/me/likes')
33
+ request.status.should == 200
34
+ end
35
+ end
36
+ end
37
+
38
+ context '#run_request' do
39
+ it 'makes public GET request' do
40
+ VCR.use_cassette('fb/cocacola') do
41
+ request = subject.run_request(:verb => :get, :path => '/cocacola',
42
+ :body => nil , :header => nil)
43
+ request.status.should == 200
44
+ end
45
+ end
46
+
47
+ it 'makes private GET request' do
48
+ VCR.use_cassette('fb/me') do
49
+ path = "/me/likes?access_token=#{Creds::Facebook::AccessToken}"
50
+ request = subject.run_request(:verb => :get, :path => path,
51
+ :body => nil , :header => nil)
52
+ request.status.should == 200
53
+ end
54
+ end
55
+ end
56
+
57
+ context '#post' do
58
+ before do
59
+ subject.configure do |c|
60
+ c.access_token = Creds::Facebook::AccessToken
61
+ end
62
+ end
63
+
64
+ let(:post_url) do
65
+ "/me/feed?message='From OpenAuth2'"
66
+ end
67
+
68
+ let(:body) do
69
+ "{\"message\":\"From OpenAuth2\"}"
70
+ end
71
+
72
+ xit 'makes request' do
73
+ VCR.use_cassette('fb/post') do
74
+ content_type = 'application/json'
75
+ request = subject.post(:path => post_url,
76
+ :body => body,
77
+ :content_type => content_type)
78
+ request.status.should == 200
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,92 @@
1
+ require 'open_auth2'
2
+ require 'spec_helper'
3
+
4
+ describe 'Facebook Token' do
5
+ let(:config) do
6
+ OpenAuth2::Config.new do |c|
7
+ c.provider = :facebook
8
+ c.client_id = Creds::Facebook::ClientId
9
+ c.client_secret = Creds::Facebook::ClientSecret
10
+ c.code = Creds::Facebook::Code
11
+ c.redirect_uri = 'http://localhost:9393/'
12
+ c.scope = ['offline_access', 'publish_stream']
13
+ end
14
+ end
15
+
16
+ subject do
17
+ OpenAuth2::Token.new(config)
18
+ end
19
+
20
+ context '#build_code_url' do
21
+ it 'returns url' do
22
+ url = "https://www.facebook.com/dialog/oauth?response_type=code&client_id=225722397503003&redirect_uri=http%3A%2F%2Flocalhost%3A9393%2F&scope=offline_access%2Cpublish_stream"
23
+
24
+ subject.build_code_url.should == url
25
+ end
26
+
27
+ it 'accepts params' do
28
+ url = "https://www.facebook.com/dialog/oauth?response_type=code&client_id=225722397503003&redirect_uri=http%3A%2F%2Flocalhost%3A9393%2F&scope=publish_stream"
29
+
30
+ subject.build_code_url(:scope => 'publish_stream').should == url
31
+ end
32
+ end
33
+
34
+ context '#get' do
35
+ let(:get_token) do
36
+ VCR.use_cassette('fb/access_token') do
37
+ subject.get
38
+ end
39
+ end
40
+
41
+ let(:time) do
42
+ Time.local(2012, 12, 21)
43
+ end
44
+
45
+ before do
46
+ Timecop.freeze(time) do
47
+ get_token
48
+ end
49
+ end
50
+
51
+ it 'requests OAuth server for access token' do
52
+ get_token.status.should == 200
53
+ end
54
+
55
+ it 'sets #access_token' do
56
+ subject.access_token.should == Creds::Facebook::AccessToken
57
+ end
58
+
59
+ it 'sets #refresh_token' do
60
+ subject.refresh_token.should == Creds::Facebook::AccessToken
61
+ end
62
+
63
+ it 'sets #token_arrived_at' do
64
+ subject.token_arrived_at.should == time
65
+ end
66
+
67
+ it 'returns nil for #token_expired?' do
68
+ subject.token_expired?.should == nil
69
+ end
70
+ end
71
+
72
+ context '#refresh' do
73
+ let(:refresh_token) do
74
+ config.configure do |c|
75
+ c.refresh_token = Creds::Facebook::AccessToken
76
+ end
77
+
78
+ VCR.use_cassette('fb/refresh_token') do
79
+ subject.refresh
80
+ end
81
+ end
82
+
83
+ it 'requests OAuth server to refresh access token' do
84
+ refresh_token.status.should == 200
85
+ end
86
+
87
+ it 'sets new #access_token' do
88
+ refresh_token
89
+ subject.access_token.should == Creds::Facebook::AccessToken
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,18 @@
1
+ module Creds
2
+ module Facebook
3
+ ClientId = '225722397503003'
4
+ ClientSecret = 'c5ede842aaa3a3f377ca56464acc37fe'
5
+ Code = 'AQB2Z6BvTFr9_VhMiP6eVLCIxUb26ym6mjuie4h2rbxGyN3QjMzVB_mozUfTCqJpH4Ta7MeRRxF7-sWQ9wdwR6iic6Mbb5hTtg1bj2nHBo85iCPfel4q-Blf3mp8xv0aKGw6mgYVMBfW1MhJC4qDgKE8pTgi7230Vgthjs7LWKBIcDJtonjUAFldhcKVrPZSx90'
6
+ AccessToken = 'AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD'
7
+ end
8
+
9
+ module Google
10
+ ClientId = '77848792642.apps.googleusercontent.com'
11
+ ClientSecret = '8oPMGGpIzZLwaW89pIcx78mB'
12
+ Code = '4/2jmx49tYiahM2MzvM_W75S7Zd92i'
13
+ AccessToken = 'ya29.AHES6ZRXhZRQLYkdqVoHz9qxzTkNVhElBAQitCdJq816PQ'
14
+ RefreshToken = '1/gUwId5-5ZHpM5G3Qooj67RDQI07zgzlJQwPjErLRzEg'
15
+
16
+ NewAccessToken = 'ya29.AHES6ZR2V9Y9vZnTC4YFHChTetjwML1mDLZRSmiBx-XT9g'
17
+ end
18
+ end
@@ -0,0 +1,36 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://graph.facebook.com:443/oauth/access_token
6
+ body:
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ accept:
11
+ - application/json
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ access-control-allow-origin:
18
+ - ! '*'
19
+ cache-control:
20
+ - private, no-cache, no-store, must-revalidate
21
+ content-type:
22
+ - text/plain; charset=UTF-8
23
+ expires:
24
+ - Sat, 01 Jan 2000 00:00:00 GMT
25
+ pragma:
26
+ - no-cache
27
+ x-fb-rev:
28
+ - '514925'
29
+ x-fb-debug:
30
+ - P9I9NADR2jvZfeNcVamI71Cay4CB4KBqBXQYcJ4YYws=
31
+ date:
32
+ - Sat, 25 Feb 2012 21:49:01 GMT
33
+ content-length:
34
+ - '127'
35
+ body: access_token=AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD
36
+ http_version: '1.1'
@@ -0,0 +1,68 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://graph.facebook.com:443/cocacola
6
+ body:
7
+ headers:
8
+ accept-encoding:
9
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: !binary |-
14
+ T0s=
15
+ headers:
16
+ !binary "YWNjZXNzLWNvbnRyb2wtYWxsb3ctb3JpZ2lu":
17
+ - !binary |-
18
+ Kg==
19
+ !binary "Y2FjaGUtY29udHJvbA==":
20
+ - !binary |-
21
+ cHJpdmF0ZSwgbm8tY2FjaGUsIG5vLXN0b3JlLCBtdXN0LXJldmFsaWRhdGU=
22
+ !binary "Y29udGVudC10eXBl":
23
+ - !binary |-
24
+ dGV4dC9qYXZhc2NyaXB0OyBjaGFyc2V0PVVURi04
25
+ !binary "ZXRhZw==":
26
+ - !binary |-
27
+ IjRkNDBlYzNhZDNjZjk0NmU2ZTdkYTFkYzM4MjFkZjJjZWI0N2FmYzYi
28
+ !binary "ZXhwaXJlcw==":
29
+ - !binary |-
30
+ U2F0LCAwMSBKYW4gMjAwMCAwMDowMDowMCBHTVQ=
31
+ !binary "cHJhZ21h":
32
+ - !binary |-
33
+ bm8tY2FjaGU=
34
+ !binary "eC1mYi1yZXY=":
35
+ - !binary |-
36
+ NTE0OTI1
37
+ !binary "Y29udGVudC1lbmNvZGluZw==":
38
+ - !binary |-
39
+ Z3ppcA==
40
+ !binary "eC1mYi1kZWJ1Zw==":
41
+ - !binary |-
42
+ dzAzV3B1V0tkS1BiT244ZEcxM3dkZEZhMG9kd3R5Y2FvaUI1blUwMVViTT0=
43
+ !binary "ZGF0ZQ==":
44
+ - !binary |-
45
+ U2F0LCAyNSBGZWIgMjAxMiAyMjowMjo0MyBHTVQ=
46
+ !binary "Y29udGVudC1sZW5ndGg=":
47
+ - !binary |-
48
+ NzIx
49
+ body: !binary |-
50
+ H4sIAAAAAAAAA3VTTY/TMBD9K6NcuGTThrRN2htaBILTSsCtUjVx3MTUsS3b
51
+ 2RAh/jvP7cLuCpFD4tjjeR8z8zNTXXbINut6v6vWTbXeZnlmeJTYvLeC7+6t
52
+ Zmw5JeLk0+4QozscV8eV8/astCz4Upxb0ZnCyHhcDU/bd3y5C0ZsjqtyWzf7
53
+ +vQC4lSWTV2Xb6uyPoXiu+sBoJW5vMw+z3NxZiFbay+FsONxJRIdcaOj1UWG
54
+ 7FDtm3Ld7PZ5JjjK3voFKT5Y2x1XrXyUnntE5ZkKJze1WoVBQmz0k8yzWbZB
55
+ xVeCEuRfkISJq1OQ/smOl/hnO5kuJcvKptkhrpNBeOWisiY55yX4dKQMpfP0
56
+ fRc1m8g5fZTW9wqLdqH3vqDPdjD0paAHObbSR2ty+ms8zRzorHyIZM9n6ZES
57
+ G0wJPjKy/lFJHOkzC9u+CfQwsB9ZLAlgVD+U6V8kDIufHM0qDiTYt9Zcec54
58
+ g8rRHM1rbIcD86ykzsnLXgVE/6ESPXdyZH+5id1XxKZL0FhvScWrhFYmFsHq
59
+ qyWpMguFiNzXYGTzKqJ46TAOkr4ZVKajLykiFPTpmnif01ecPfO7t6NjA5my
60
+ Z0Nnz0YMKuBea2NEO/VkHVoglST8J/NrwaPqBxg9S9AOZL3qFW5G+y8nFG+K
61
+ 1yhn3aQZ9BcaIHSEGUk0ekwvNBkFqYF1QV9tx0tOi53gO9gq6H6WAt2PyseJ
62
+ NW7d7HHsU9Gv2LP1uivQZdzaKaK/Xhvx4WlM6AH9Tio1CMZES5GkpxxA9fAb
63
+ imSgMNg5mYMPOWmdlvDOjsQ+9fQzHvQ8ShqkdrB05EuyHi9lYMg8oN8gE1gx
64
+ CUvcNMbz1v4/M41VnDpM111VFU2526N+TYUnxZn+6bDcrotm02w2a4Ts6l9p
65
+ jM3J2QCNtykVgxQXVCE71E2eRdb46U9XG04iDUF22O6adVX/+g1sWrgEyQQA
66
+ AA==
67
+ http_version: !binary |-
68
+ MS4x
@@ -0,0 +1,36 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://graph.facebook.com:443/me/likes?access_token=AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD
6
+ body:
7
+ headers:
8
+ accept-encoding:
9
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ access-control-allow-origin:
16
+ - ! '*'
17
+ cache-control:
18
+ - private, no-cache, no-store, must-revalidate
19
+ content-type:
20
+ - text/javascript; charset=UTF-8
21
+ etag:
22
+ - ! '"c60f2e60a5df83da5585ebda43b554fcf98a0486"'
23
+ expires:
24
+ - Sat, 01 Jan 2000 00:00:00 GMT
25
+ pragma:
26
+ - no-cache
27
+ x-fb-rev:
28
+ - '514925'
29
+ x-fb-debug:
30
+ - KrTg1q4nx3Apmj1vpbKXn0k7W3EmEsfq0rt2uQLSJ/g=
31
+ date:
32
+ - Sat, 25 Feb 2012 22:08:52 GMT
33
+ content-length:
34
+ - '370'
35
+ body: ! '{"data":[{"name":"EmiBalbuena.com","category":"Personal website","id":"197230593668050","created_time":"2011-10-06T22:00:02+0000"}],"paging":{"next":"https:\/\/graph.facebook.com\/me\/likes?access_token=AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD&limit=5000&offset=5000&__after_id=197230593668050"}}'
36
+ http_version: '1.1'
@@ -0,0 +1,34 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://graph.facebook.com:443/me/feed?message=%27From%20OpenAuth2%27&access_token=AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD
6
+ body:
7
+ headers:
8
+ content-type:
9
+ - application/json
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ access-control-allow-origin:
16
+ - ! '*'
17
+ cache-control:
18
+ - private, no-cache, no-store, must-revalidate
19
+ content-type:
20
+ - text/javascript; charset=UTF-8
21
+ expires:
22
+ - Sat, 01 Jan 2000 00:00:00 GMT
23
+ pragma:
24
+ - no-cache
25
+ x-fb-rev:
26
+ - '518267'
27
+ x-fb-debug:
28
+ - 1+GpoD6kWif2JDnTaD/XeITjokumXXb6BbGmwAciEiA=
29
+ date:
30
+ - Sat, 03 Mar 2012 01:37:49 GMT
31
+ content-length:
32
+ - '40'
33
+ body: ! '{"id":"100002930317357_200068986767444"}'
34
+ http_version: '1.1'
@@ -0,0 +1,36 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://graph.facebook.com:443/oauth/access_token
6
+ body:
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ accept:
11
+ - application/json
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ access-control-allow-origin:
18
+ - ! '*'
19
+ cache-control:
20
+ - private, no-cache, no-store, must-revalidate
21
+ content-type:
22
+ - text/plain; charset=UTF-8
23
+ expires:
24
+ - Sat, 01 Jan 2000 00:00:00 GMT
25
+ pragma:
26
+ - no-cache
27
+ x-fb-rev:
28
+ - '514925'
29
+ x-fb-debug:
30
+ - oAZnBNFMltYkzFalaO5iH4uo5Jcc0fnhK7QFGrcMfvI=
31
+ date:
32
+ - Sat, 25 Feb 2012 21:56:05 GMT
33
+ content-length:
34
+ - '127'
35
+ body: access_token=AAADNSxdSLhsBALUJwhyMDYVTCV07ZAUyXIGwm2Bb9G5oudfZCYz2TcZB23ZABbFKTShb6JZC0aUVEsNfTMTRrqVWIrVyxNf4pElZAZCUWnd9QZDZD
36
+ http_version: '1.1'
@@ -0,0 +1,38 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://accounts.google.com:443/o/oauth2/token
6
+ body:
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ accept:
11
+ - application/json
12
+ response: !ruby/struct:VCR::Response
13
+ status: !ruby/struct:VCR::ResponseStatus
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ cache-control:
18
+ - no-cache, no-store, max-age=0, must-revalidate
19
+ pragma:
20
+ - no-cache
21
+ expires:
22
+ - Fri, 01 Jan 1990 00:00:00 GMT
23
+ date:
24
+ - Sat, 03 Mar 2012 00:36:32 GMT
25
+ content-type:
26
+ - application/json
27
+ x-content-type-options:
28
+ - nosniff
29
+ x-frame-options:
30
+ - SAMEORIGIN
31
+ x-xss-protection:
32
+ - 1; mode=block
33
+ server:
34
+ - GSE
35
+ body: ! "{\n \"access_token\" : \"ya29.AHES6ZRXhZRQLYkdqVoHz9qxzTkNVhElBAQitCdJq816PQ\",\n
36
+ \ \"token_type\" : \"Bearer\",\n \"expires_in\" : 3600,\n \"refresh_token\"
37
+ : \"1/gUwId5-5ZHpM5G3Qooj67RDQI07zgzlJQwPjErLRzEg\"\n}"
38
+ http_version: '1.1'
@@ -0,0 +1,50 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://www.googleapis.com:443/calendar/v3/users/me/calendarList?access_token=ya29.AHES6ZRXhZRQLYkdqVoHz9qxzTkNVhElBAQitCdJq816PQ
6
+ body:
7
+ headers:
8
+ accept-encoding:
9
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ expires:
16
+ - Sat, 03 Mar 2012 00:43:30 GMT
17
+ date:
18
+ - Sat, 03 Mar 2012 00:43:30 GMT
19
+ cache-control:
20
+ - private, max-age=0, must-revalidate, no-transform
21
+ etag:
22
+ - ! '"05UDIdu8MZ4l75GrR4XASfYyuJA/zOhVd4w0MdY1DcWnD1I5Aw6EG1A"'
23
+ content-type:
24
+ - application/json; charset=UTF-8
25
+ x-content-type-options:
26
+ - nosniff
27
+ x-frame-options:
28
+ - SAMEORIGIN
29
+ x-xss-protection:
30
+ - 1; mode=block
31
+ server:
32
+ - GSE
33
+ body: ! "{\n \"kind\": \"calendar#calendarList\",\n \"etag\": \"\\\"05UDIdu8MZ4l75GrR4XASfYyuJA/RlR_v1har4GKp7r_0Pat7Cwxutc\\\"\",\n
34
+ \"items\": [\n {\n \"kind\": \"calendar#calendarListEntry\",\n \"etag\":
35
+ \"\\\"05UDIdu8MZ4l75GrR4XASfYyuJA/Xy22eQFbkRyL-kXKKp9gXUGjeVU\\\"\",\n \"id\":
36
+ \"#contacts@group.v.calendar.google.com\",\n \"summary\": \"Contacts' birthdays
37
+ and events\",\n \"description\": \"Your contacts' birthdays and anniversaries\",\n
38
+ \ \"timeZone\": \"America/Los_Angeles\",\n \"colorId\": \"12\",\n \"selected\":
39
+ true,\n \"accessRole\": \"reader\"\n },\n {\n \"kind\": \"calendar#calendarListEntry\",\n
40
+ \ \"etag\": \"\\\"05UDIdu8MZ4l75GrR4XASfYyuJA/gHhWepcSR_7BG-SE_f3YmpNqHhA\\\"\",\n
41
+ \ \"id\": \"en.usa#holiday@group.v.calendar.google.com\",\n \"summary\":
42
+ \"US Holidays\",\n \"description\": \"US Holidays\",\n \"timeZone\": \"America/Los_Angeles\",\n
43
+ \ \"colorId\": \"9\",\n \"selected\": true,\n \"accessRole\": \"reader\"\n
44
+ \ },\n {\n \"kind\": \"calendar#calendarListEntry\",\n \"etag\": \"\\\"05UDIdu8MZ4l75GrR4XASfYyuJA/_btzWSa3jrAuPbrE6wq47gM7i5U\\\"\",\n
45
+ \ \"id\": \"openauth2@gmail.com\",\n \"summary\": \"openauth2@gmail.com\",\n
46
+ \ \"timeZone\": \"America/Los_Angeles\",\n \"colorId\": \"15\",\n \"selected\":
47
+ true,\n \"accessRole\": \"owner\",\n \"defaultReminders\": [\n {\n \"method\":
48
+ \"email\",\n \"minutes\": 10\n },\n {\n \"method\": \"popup\",\n
49
+ \ \"minutes\": 10\n }\n ]\n }\n ]\n}\n"
50
+ http_version: '1.1'
@@ -0,0 +1,44 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://www.googleapis.com:443/calendar/v3/calendars/openauth2@gmail.com/events?access_token=ya29.AHES6ZRXhZRQLYkdqVoHz9qxzTkNVhElBAQitCdJq816PQ
6
+ body:
7
+ headers:
8
+ content-type:
9
+ - application/json
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ cache-control:
16
+ - no-cache, no-store, max-age=0, must-revalidate
17
+ pragma:
18
+ - no-cache
19
+ expires:
20
+ - Fri, 01 Jan 1990 00:00:00 GMT
21
+ date:
22
+ - Sat, 03 Mar 2012 00:48:55 GMT
23
+ etag:
24
+ - ! '"05UDIdu8MZ4l75GrR4XASfYyuJA/Q05qQm43RGRKaEVBQUFBQUFBQUFBQT09"'
25
+ content-type:
26
+ - application/json; charset=UTF-8
27
+ x-content-type-options:
28
+ - nosniff
29
+ x-frame-options:
30
+ - SAMEORIGIN
31
+ x-xss-protection:
32
+ - 1; mode=block
33
+ server:
34
+ - GSE
35
+ body: ! "{\n \"kind\": \"calendar#event\",\n \"etag\": \"\\\"05UDIdu8MZ4l75GrR4XASfYyuJA/Q05qQm43RGRKaEVBQUFBQUFBQUFBQT09\\\"\",\n
36
+ \"id\": \"htblfka4hqckqtiirnriam72e4\",\n \"status\": \"confirmed\",\n \"htmlLink\":
37
+ \"https://www.google.com/calendar/event?eid=aHRibGZrYTRocWNrcXRpaXJucmlhbTcyZTQgb3BlbmF1dGgyQG0\",\n
38
+ \"created\": \"2012-03-03T00:48:55.000Z\",\n \"updated\": \"2012-03-03T00:48:55.000Z\",\n
39
+ \"summary\": \"From OpenAuth2\",\n \"creator\": {\n \"email\": \"openauth2@gmail.com\"\n
40
+ },\n \"organizer\": {\n \"email\": \"openauth2@gmail.com\"\n },\n \"start\":
41
+ {\n \"dateTime\": \"2012-01-20T09:00:00-08:00\"\n },\n \"end\": {\n \"dateTime\":
42
+ \"2012-01-20T09:25:00-08:00\"\n },\n \"iCalUID\": \"htblfka4hqckqtiirnriam72e4@google.com\",\n
43
+ \"sequence\": 0,\n \"reminders\": {\n \"useDefault\": true\n }\n}\n"
44
+ http_version: '1.1'