skydrive 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8dd29de148895797d3e7940429482ab71fffe3f8
4
+ data.tar.gz: 423f8fb0f4dcee7445107e63b503129909f297ae
5
+ SHA512:
6
+ metadata.gz: b55e670e67eaecf4461b7db75d2a0c802532f195af8bbeb8669cf7e58204c64b213483495698a49f44a293c18d5775976abb89b0a903b7e0e8736f66517865c6
7
+ data.tar.gz: b29844c21ec9b74a0072ddd350c48e53e70a18eb972dc66f058cc7facf326534ef3597a41b5e7b5de2ddb278a345a8f1521ac89cb86d491410ce6421ffae89aa
data/Gemfile CHANGED
@@ -1,11 +1,13 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  group :osx do
4
4
  gem "growl"
5
+ gem 'terminal-notifier'
6
+ gem 'terminal-notifier-guard'
5
7
  end
6
8
 
7
9
  group :linux do
8
- gem "rb-inotify", "~> 0.8.8"
10
+ gem "rb-inotify", '~> 0.9'
9
11
  gem "libnotify"
10
12
  end
11
13
 
@@ -21,6 +21,7 @@ module Skydrive
21
21
  require 'skydrive/photo'
22
22
  require 'skydrive/album'
23
23
  require 'skydrive/audio'
24
+ require 'skydrive/video'
24
25
  require 'skydrive/error'
25
26
  require 'skydrive/comment'
26
27
  require 'skydrive/notebook'
@@ -2,30 +2,6 @@ module Skydrive
2
2
  # A user's audio file in SkyDrive.
3
3
  class Audio < Skydrive::File
4
4
 
5
- # The size, in bytes, of the audio
6
- # @return [Integer]
7
- def size
8
- object["size"]
9
- end
10
-
11
- # The number of comments associated with the audio
12
- # @return [Integer]
13
- def comments_count
14
- object["comments_count"]
15
- end
16
-
17
- # A value that indicates whether comments are enabled for the audio
18
- # @return [Boolean]
19
- def comments_enabled
20
- object["comments_enabled"]
21
- end
22
-
23
- # The URL to use to download the audio from SkyDrive
24
- # @return [String]
25
- def source
26
- object["source"]
27
- end
28
-
29
5
  # The audio's title
30
6
  # @return [String]
31
7
  def title
@@ -68,18 +44,5 @@ module Skydrive
68
44
  object["picture"]
69
45
  end
70
46
 
71
- # The link that can be used to download the audio file
72
- # @return [String]
73
- def download_link
74
- url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"]
75
- end
76
-
77
- # Download the audio file
78
- def download
79
- uri = URI(download_link)
80
- response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}")
81
- response.parsed_response
82
- end
83
-
84
47
  end
85
48
  end
@@ -48,7 +48,7 @@ module Skydrive
48
48
  # Get the acting user
49
49
  # @return [Hash]
50
50
  def me
51
- response = self.class.get("/me").parsed_response
51
+ response = JSON.load(self.class.get("/me").parsed_response)
52
52
  end
53
53
 
54
54
  # Refresh the access token
@@ -16,7 +16,7 @@ module Skydrive
16
16
 
17
17
  # A value that indicates whether comments are enabled for the file
18
18
  # @return [Boolean]
19
- def comments_enabled
19
+ def comments_enabled?
20
20
  object["comments_enabled"]
21
21
  end
22
22
 
@@ -103,7 +103,7 @@ module Skydrive
103
103
  end
104
104
 
105
105
  # Make a comment about the object
106
- # @params [Hash] options
106
+ # @param [Hash] options
107
107
  # @option options [String] :message The comment
108
108
  def comment options={}
109
109
  client.post("/#{id}/comments", options)
@@ -1,7 +1,7 @@
1
1
  module Skydrive
2
2
  # The basic operations
3
3
  module Operations
4
-
4
+
5
5
  # Your home folder
6
6
  # @return [Skydrive::Folder]
7
7
  def my_skydrive
@@ -120,6 +120,11 @@ module Skydrive
120
120
  response = put("/#{object_id}", options)
121
121
  end
122
122
 
123
+ # Get an object by its id
124
+ # @param [String] id The id of the object you want
125
+ def get_skydrive_object_by_id id
126
+ response = get("/#{id}")
127
+ end
123
128
 
124
129
  alias :update_folder :update_skydrive_object
125
130
  alias :update_album :update_skydrive_object
@@ -169,7 +174,7 @@ module Skydrive
169
174
  # Comment about an object
170
175
  # @param [String] object_id ID of the object
171
176
  # @param [Hash] options
172
- # @options options [String] :message The comment message
177
+ # @option options [String] :message The comment message
173
178
  def create_comment object_id, options={}
174
179
  response = post("/#{object_id}/comments", options)
175
180
  end
@@ -1,17 +1,91 @@
1
1
  module Skydrive
2
2
  # A user's photo in SkyDrive.
3
3
  class Photo < Skydrive::File
4
- # The link that can be used to download the photo
4
+
5
+ # The number of tags on the photo
6
+ # @return [Integer]
7
+ def tags_count
8
+ object["tags_count"]
9
+ end
10
+
11
+ # Whether tags are enabled for the photo
12
+ # @return [Integer]
13
+ def tags_enabled?
14
+ object["tags_enabled"]
15
+ end
16
+
17
+
18
+ # A URL of the photo's picture.
5
19
  # @return [String]
6
- def download_link
7
- url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"]
20
+ def picture
21
+ object["picture"]
22
+ end
23
+
24
+ # Info about various sizes of the photos
25
+ # @return [Array<Hash>]
26
+ def images
27
+ object["images"]
28
+ end
29
+
30
+ # Time when the photo was taken
31
+ # @return [Time]
32
+ def when_taken
33
+ Time.new object["when_taken"] if object["when_taken"]
34
+ end
35
+
36
+ # Height of the photo in pixels
37
+ # @return [Integer]
38
+ def height
39
+ object["height"]
8
40
  end
9
41
 
10
- # Download the photo
11
- def download
12
- uri = URI(download_link)
13
- response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}")
14
- response.parsed_response
42
+ # Width of the photo in pixels
43
+ # @return [Integer]
44
+ def width
45
+ object["width"]
15
46
  end
47
+
48
+ # The location where the photo was taken.
49
+ # @return [Hash]
50
+ def location
51
+ object["location"]
52
+ end
53
+
54
+ # The manufacturer of the camera that took the photo.
55
+ # @return [String]
56
+ def camera_make
57
+ object["camera_make"]
58
+ end
59
+
60
+ # The brand and model number of the camera that took the photo.
61
+ # @return [String]
62
+ def camera_model
63
+ object["camera_model"]
64
+ end
65
+
66
+ # The f-number that the photo was taken at
67
+ # @return [Float]
68
+ def focal_ratio
69
+ object["focal_ratio"]
70
+ end
71
+
72
+ # The focal length that the photo was taken at
73
+ # @return [Float]
74
+ def focal_length
75
+ object["focal_length"]
76
+ end
77
+
78
+ # The numerator of the shutter speed that the photo was taken at
79
+ # @return [Integer]
80
+ def exposure_numerator
81
+ object["exposure_numerator"]
82
+ end
83
+
84
+ # The denominator of the shutter speed that the photo was taken at
85
+ # @return [Integer]
86
+ def exposure_denominator
87
+ object["exposure_denominator"]
88
+ end
89
+
16
90
  end
17
91
  end
@@ -4,49 +4,50 @@ module Skydrive
4
4
  # User's home directory
5
5
  # @return [Skydrive::Folder]
6
6
  def skydrive
7
- response = get("/#{id}/skydrive")
7
+ response = client.get("/#{id}/skydrive")
8
+ Skydrive::Folder.new(client, response)
8
9
  end
9
10
 
10
11
  # User's camera_roll folder
11
12
  # @return [Skydrive::Folder]
12
13
  def camera_roll
13
- response = get("/#{id}/skydrive/camera_roll")
14
+ response = client.get("/#{id}/skydrive/camera_roll")
14
15
  end
15
16
 
16
17
  # User's documents
17
18
  # @return [Skydrive::Folder]
18
19
  def documents
19
- response = get("/#{id}/skydrive/my_documents")
20
+ response = client.get("/#{id}/skydrive/my_documents")
20
21
  end
21
22
 
22
23
  # User's default album
23
24
  # @return [Skydrive::Album]
24
25
  def photos
25
- response = get("/#{id}/skydrive/my_photos")
26
+ response = client.get("/#{id}/skydrive/my_photos")
26
27
  end
27
28
 
28
29
  # User's public documents
29
30
  # @return [Skydrive::Folder]
30
31
  def public_documents
31
- response = get("/#{id}/skydrive/public_documents")
32
+ response = client.get("/#{id}/skydrive/public_documents")
32
33
  end
33
34
 
34
35
  # User's shared items
35
36
  # @return [Skydrive::Collection]
36
37
  def shared_stuff
37
- response = get("/#{id}/skydrive/shared")
38
+ response = client.get("/#{id}/skydrive/shared")
38
39
  end
39
40
 
40
41
  # User's recent documents
41
42
  # @return [Skydrive::Collection]
42
43
  def recent_documents
43
- response = get("/#{id}/skydrive/recent_docs")
44
+ response = client.get("/#{id}/skydrive/recent_docs")
44
45
  end
45
46
 
46
47
  # User's total and remaining storage quota
47
48
  # @return [Hash] contains keys quota and available
48
49
  def storage_quota
49
- response = get("/#{id}/skydrive/quota")
50
+ response = client.get("/#{id}/skydrive/quota")
50
51
  end
51
52
 
52
53
  end
@@ -1,5 +1,5 @@
1
1
  # Skydrive base module
2
2
  module Skydrive
3
3
  # The gem version
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
@@ -1,17 +1,5 @@
1
1
  module Skydrive
2
2
  # A user's video in SkyDrive.
3
3
  class Video < Skydrive::File
4
- # The link that can be used to download the video file
5
- # @return [String]
6
- def download_link
7
- url = client.get("/#{id}/content", :download => true, :suppress_redirects => true)["location"]
8
- end
9
-
10
- # Download the video file
11
- def download
12
- uri = URI(download_link)
13
- response = HTTParty.get("http://#{uri.host}#{uri.path}?#{uri.query}")
14
- response.parsed_response
15
- end
16
4
  end
17
5
  end
@@ -19,10 +19,11 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'httparty', '>= 0.11.0'
20
20
  gem.add_dependency 'activesupport'
21
21
  gem.add_dependency 'httmultiparty'
22
- gem.add_dependency 'oauth2'
22
+ gem.add_dependency 'oauth2', ">= 0.9.2"
23
23
  gem.add_development_dependency "rspec"
24
24
  gem.add_development_dependency "rake"
25
25
  gem.add_development_dependency "rb-inotify"
26
+ gem.add_development_dependency "rb-fsevent", "~> 0.9"
26
27
  gem.add_development_dependency "guard"
27
28
  gem.add_development_dependency "guard-rspec"
28
29
  gem.add_development_dependency "simplecov"
@@ -0,0 +1,81 @@
1
+ require 'spec_helper'
2
+ describe Skydrive::Audio do
3
+
4
+ let :audio do
5
+ JSON.load %{
6
+ {
7
+ "id" : "file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E\!144",
8
+ "from" : {
9
+ "name" : "Stig Struve-Christensen",
10
+ "id" : "a6b2a7e8f2515e5e"
11
+ },
12
+ "name" : "SampleAudio.mp3",
13
+ "description" : null,
14
+ "parent_id" : "folder.a6b2a7e8f2515e5e",
15
+ "size" : 8414449,
16
+ "upload_location" : "https://apis.live.net/v5.0/file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!144/content/",
17
+ "comments_count" : 0,
18
+ "comments_enabled" : false,
19
+ "is_embeddable" : false,
20
+ "source" : "http://storage.live.com/s1p60U8Xs4UzIXTScrTioalE-ZaVFiDQBA15MS2BwcsuNjfG64Z2fw-DAjXnPuqC47YR40_xAoPD8aRGhtna9ZFZ9_oO4BTz4CWF973DTXMxc5U3TntcQ9qEA/SampleAudio.mp3:Binary",
21
+ "link" : "https://skydrive.live.com/redir.aspx?cid\u003d22688711f5410e6c\u0026page\u003dview\u0026resid\u003d22688711F5410E6C!582\u0026parid\u003d22688711F5410E6C!581",
22
+ "type" : "audio",
23
+ "title" : "My Sample Audio",
24
+ "artist" : "My Favorite Artist",
25
+ "album" : "My Favorite Album",
26
+ "album_artist" : "My Favorite Artist",
27
+ "genre" : "Easy Listening",
28
+ "duration" : 225000,
29
+ "picture" : "https://storage.live.com/items/A6B2A7E8F2515E5E!144:MobileReady/SampleAudio.mp3?psid=1&ck=0&ex=720",
30
+ "shared_with" : {
31
+ "access" : "Just me"
32
+ },
33
+ "created_time" : "2012-09-23T22:00:57+0000",
34
+ "updated_time" : "2012-09-03T22:00:57+0000"
35
+ }
36
+ }
37
+ end
38
+
39
+ subject {Skydrive::Audio.new(skydrive_test_client, audio)}
40
+ describe '#title' do
41
+ it "should return the title of the audio" do
42
+ subject.title.should == audio["title"]
43
+ end
44
+ end
45
+
46
+ describe '#artist' do
47
+ it "should return the artist's name for the audio" do
48
+ subject.artist.should == audio["artist"]
49
+ end
50
+ end
51
+
52
+ describe '#album' do
53
+ it "should return the album name" do
54
+ subject.album.should == audio["album"]
55
+ end
56
+ end
57
+
58
+ describe '#album_artist' do
59
+ it "should return the name of the album artist" do
60
+ subject.album_artist.should == audio["album_artist"]
61
+ end
62
+ end
63
+
64
+ describe '#genre' do
65
+ it "should return the genre of the audio" do
66
+ subject.genre.should == audio["genre"]
67
+ end
68
+ end
69
+
70
+ describe '#duration' do
71
+ it "should return the duration of the audio" do
72
+ subject.duration.should == audio["duration"]
73
+ end
74
+ end
75
+
76
+ describe '#picture' do
77
+ it "should return the url to view the audio's picture on SkyDrive" do
78
+ subject.picture.should == audio["picture"]
79
+ end
80
+ end
81
+ end
@@ -13,14 +13,19 @@ describe Skydrive::Comment do
13
13
  })
14
14
  end
15
15
 
16
- subject {skydrive_test_client}
16
+ subject { Skydrive::Comment.new(skydrive_test_client, comment)}
17
17
 
18
- before :each do
19
- stub_request(:get, "https://apis.live.net/v5.0/comment.22688711f5410e6c.22688711f0410e6c!818.22688711F5410E6C!979?access_token=access_token").to_return(:status => 200, :body => comment.to_json, :headers => {})
20
- @comment = skydrive_test_client.get("/comment.22688711f5410e6c.22688711f0410e6c!818.22688711F5410E6C!979")
18
+ it "should return the message associated with the comment" do
19
+ subject.message.should eql "A lighthouse built on some rocks."
21
20
  end
22
21
 
23
- it "should return the message associated with the comment" do
24
- @comment.message.should eql "A lighthouse built on some rocks."
22
+ it "should return comment as the type" do
23
+ subject.type.should == "comment"
24
+ end
25
+
26
+ it "should delete the comment" do
27
+ stub_request(:delete, "https://apis.live.net/v5.0/comment.22688711f5410e6c.22688711f0410e6c!818.22688711F5410E6C!979?access_token=access_token").
28
+ to_return(:status => 204, :body => "", :headers => {})
29
+ subject.delete.should be_true
25
30
  end
26
31
  end
@@ -37,4 +37,44 @@ describe Skydrive::File do
37
37
  subject.from.should be_a(Skydrive::User)
38
38
  end
39
39
  end
40
+
41
+ describe '#size' do
42
+ it "should return the size of the file in bytes" do
43
+ subject.size.should == file["size"]
44
+ end
45
+ end
46
+
47
+ describe '#comments_count' do
48
+ it "should return the count of comments associated with the file" do
49
+ subject.comments_count.should == file["comments_count"]
50
+ end
51
+ end
52
+
53
+ describe '#comments_enabled?' do
54
+ it "should return whether comments are enabled for the file" do
55
+ subject.should be_comments_enabled
56
+ end
57
+ end
58
+
59
+ describe '#source' do
60
+ it "should return the URL to use to download the file from SkyDrive" do
61
+ subject.source.should == file["source"]
62
+ end
63
+ end
64
+
65
+ describe '#download_link' do
66
+ it "should give the download link for the file" do
67
+ stub_request(:get, "https://apis.live.net/v5.0/file.22688711f5410e6c.22688711F5410E6C!942/content?access_token=access_token&download=true&suppress_redirects=true").to_return(:status => 200, :body => {"location" => "http://dummylocation.com"}.to_json, :headers => {})
68
+ subject.download_link.should == "http://dummylocation.com"
69
+ end
70
+ end
71
+
72
+ describe '#download' do
73
+ it "should download the file" do
74
+ stub_request(:get, "https://apis.live.net/v5.0/file.22688711f5410e6c.22688711F5410E6C!942/content?access_token=access_token&download=true&suppress_redirects=true").to_return(:status => 200, :body => {"location" => "http://dummylocation.com/path?dummy_param=value"}.to_json, :headers => {})
75
+ stub_request(:get, "http://dummylocation.com/path?dummy_param=value").
76
+ to_return(:status => 200, :body => "\322\204\371\225Q", :headers => {})
77
+ subject.download.should == "\322\204\371\225Q"
78
+ end
79
+ end
40
80
  end
@@ -35,7 +35,7 @@ describe Skydrive::Oauth::Client do
35
35
  :headers => {
36
36
  'Accept' => '*/*',
37
37
  'Content-Type' => 'application/x-www-form-urlencoded',
38
- 'User-Agent' => 'Faraday v0.8.7'
38
+ 'User-Agent' => "Faraday v#{Gem.loaded_specs['faraday'].version}"
39
39
  }
40
40
  ).to_return(
41
41
  :status => 200, :body => {
@@ -31,14 +31,14 @@ describe Skydrive::Object do
31
31
  subject.id.should == "folder.8c8ce076ca27823f.8C8CE076CA27823F!142"
32
32
  end
33
33
 
34
- it "should return the owner user of the object" do
35
- subject.from.should be_a(Skydrive::User)
36
- end
37
-
38
34
  it "should return the name of the object" do
39
35
  subject.name.should == "My Sample Folder in Album 1"
40
36
  end
41
37
 
38
+ it "should return the owner user of the object" do
39
+ subject.from.should be_a(Skydrive::User)
40
+ end
41
+
42
42
  it "should return the description of the object" do
43
43
  subject.description.should == ""
44
44
  end
@@ -79,4 +79,63 @@ describe Skydrive::Object do
79
79
  subject.to_hash.should == folder
80
80
  end
81
81
 
82
+ it "should delete the object" do
83
+ stub_request(:delete, "https://apis.live.net/v5.0/folder.8c8ce076ca27823f.8C8CE076CA27823F!142?access_token=access_token").to_return(:status => 204, :body => "", :headers => {})
84
+ subject.delete.should == true
85
+ end
86
+
87
+ describe '#comments' do
88
+
89
+ let :comments do
90
+ JSON.load(%{{
91
+ "data": [
92
+ {
93
+ "id": "comment.22688711f5410e6c.22688711f0410e6c!818.22688711F5410E6C!979",
94
+ "from": {
95
+ "name": "Roberto Tamburello",
96
+ "id": "8c8ce076ca27823f"
97
+ },
98
+ "message": "A lighthouse built on some rocks.",
99
+ "created_time": "2011-04-21T23:21:28+0000"
100
+ }
101
+ ]
102
+ }})
103
+ end
104
+ before :each do
105
+ stub_request(:get, "https://apis.live.net/v5.0/folder.8c8ce076ca27823f.8C8CE076CA27823F!142/comments?access_token=access_token").to_return(:status => 200, :body => comments.to_json, :headers => {})
106
+ end
107
+
108
+ it "should return a collection" do
109
+ subject.comments.should be_a Skydrive::Collection
110
+ end
111
+
112
+ it "should get the comments associated with the object" do
113
+ subject.comments.items.should each { |item|
114
+ item.should be_a Skydrive::Comment
115
+ }
116
+ end
117
+ end
118
+
119
+ describe '#comment' do
120
+ let :comment do
121
+ JSON.load(%{
122
+ {
123
+ "id": "comment.22688711f5410e6c.22688711f0410e6c!818.22688711F5410E6C!979",
124
+ "from": {
125
+ "name": "Roberto Tamburello",
126
+ "id": "8c8ce076ca27823f"
127
+ },
128
+ "message": "A lighthouse built on some rocks.",
129
+ "created_time": "2011-04-21T23:21:28+0000"
130
+ }
131
+ })
132
+
133
+ end
134
+ it 'should add a comment for the object' do
135
+ stub_request(:post, "https://apis.live.net/v5.0/folder.8c8ce076ca27823f.8C8CE076CA27823F!142/comments?access_token=access_token").with({:messge => "hello"}).to_return(:status => 200, :body => comment.to_json, :headers => {})
136
+ subject.comment.should be_a Skydrive::Comment
137
+ end
138
+
139
+ end
140
+
82
141
  end
@@ -0,0 +1,254 @@
1
+ require 'spec_helper'
2
+ describe Skydrive::Photo do
3
+ let :photo do
4
+ JSON.load %{
5
+ {
6
+ "id": "file.de57f4126ed7e411.DE57F4126ED7E411!128",
7
+ "from": {
8
+ "name": "Nuno Bento",
9
+ "id": "de57f4126ed7e411"
10
+ },
11
+ "name": "Maui-2012_0034.JPG",
12
+ "description": null,
13
+ "parent_id": "folder.de57f4126ed7e411.DE57F4126ED7E411!126",
14
+ "size": 561683,
15
+ "comments_count": 1,
16
+ "comments_enabled": true,
17
+ "tags_count": 0,
18
+ "tags_enabled": true,
19
+ "is_embeddable": true,
20
+ "picture": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:Thumbnail",
21
+ "source": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:HighRes",
22
+ "upload_location": "https://apis.live.net/v5.0/file.de57f4126ed7e411.DE57F4126ED7E411!128/content/",
23
+ "images": [
24
+ {
25
+ "height": 450,
26
+ "width": 600,
27
+ "source": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:WebReady",
28
+ "type": "normal"
29
+ }, {
30
+ "height": 132,
31
+ "width": 176,
32
+ "source": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:MobileReady",
33
+ "type": "album"
34
+ }, {
35
+ "height": 72,
36
+ "width": 96,
37
+ "source": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:Thumbnail",
38
+ "type": "thumbnail"
39
+ }, {
40
+ "height": 1200,
41
+ "width": 1600,
42
+ "source": "http://storage.live.com/s1pKk5vzd-gdPanbzKYhB0nQGn8wGq5DSgqvrgIHU1NTXA4e2-spGkAhQjW1d9pcgKAGLB4NsEsSvDoREmdx5w-JiFrinEJJuEoz08Ws_IFupkX2bPSvy5qmths9ijwvDrXi1OBCWk9GW9Kt-qNNOAA9g/Maui09_0034.JPG:HighRes",
43
+ "type": "full"
44
+ }
45
+ ],
46
+ "link": "https://skydrive.live.com/redir.aspx?cid\u003dde57f4126ed7e411\u0026page\u003dview\u0026resid\u003dDE57F4126ED7E411!128\u0026parid\u003dDE57F4126ED7E411!126",
47
+ "when_taken": "2008-03-24T23:41:53+0000",
48
+ "height": 1200,
49
+ "width": 1600,
50
+ "type": "photo",
51
+ "location": {
52
+ "latitude": 47.65316,
53
+ "longitude": -122.135911,
54
+ "altitude": 43
55
+ },
56
+ "camera_make": "MyManufacturer",
57
+ "camera_model": "MyModel",
58
+ "focal_ratio": 2.8,
59
+ "focal_length": 3.85,
60
+ "exposure_numerator": 1,
61
+ "exposure_denominator": 15,
62
+ "shared_with": {
63
+ "access": "Everyone (public)"
64
+ },
65
+ "created_time": "2012-12-03T18:14:03+0000",
66
+ "updated_time": "2012-12-03T18:31:01+0000"
67
+ }
68
+ }
69
+ end
70
+
71
+ subject { Skydrive::Photo.new(skydrive_test_client, photo)}
72
+
73
+ describe '#name' do
74
+ it "should return the name of the photo" do
75
+ subject.name.should == photo["name"]
76
+ end
77
+ end
78
+
79
+ describe '#description' do
80
+ it "should return the description of the photo" do
81
+ subject.description.should == photo["description"]
82
+ end
83
+ end
84
+
85
+ describe '#from' do
86
+ it "should return a user" do
87
+ subject.from.should be_a Skydrive::User
88
+ end
89
+
90
+ it "should return the info about the user who uploaded the photo" do
91
+ subject.from.name.should == photo["from"]["name"]
92
+ subject.from.id.should == photo["from"]["id"]
93
+ end
94
+ end
95
+
96
+ describe '#tags_count' do
97
+ it "should give the tags count of the photo" do
98
+ subject.tags_count.should == 0
99
+ end
100
+ end
101
+
102
+ describe '#tags_enabled' do
103
+ it "should return whether tags are enabled for the photo" do
104
+ subject.tags_enabled?.should == true
105
+ end
106
+ end
107
+
108
+ describe '#parent_id' do
109
+ it "should return the parent id of the photo" do
110
+ subject.parent_id.should == photo["parent_id"]
111
+ end
112
+ end
113
+
114
+ describe '#size' do
115
+ it "should return the size of the photo in bytes" do
116
+ subject.size.should == photo["size"]
117
+ end
118
+ end
119
+
120
+ describe '#comments_count' do
121
+ it "should return the comments associated with the photo" do
122
+ subject.comments_count.should == photo["comments_count"]
123
+ end
124
+ end
125
+
126
+ describe '#comments_enabled?' do
127
+ it "should return whether tags are enabled for the photo" do
128
+ subject.comments_enabled?.should == true
129
+ end
130
+ end
131
+
132
+ describe '#is_embeddable? ' do
133
+ it "should return whether the photo can be embedded" do
134
+ subject.is_embeddable?.should == true
135
+ end
136
+ end
137
+
138
+ describe '#picture' do
139
+ it "should return the URL of the photo's picture" do
140
+ subject.picture.should == photo["picture"]
141
+ end
142
+ end
143
+
144
+ describe '#source' do
145
+ it 'should return the download URL for the photo.' do
146
+ subject.source.should == photo["source"]
147
+ end
148
+ end
149
+
150
+ describe 'upload_location' do
151
+ it "should return the photo's upload location" do
152
+ subject.upload_location.should == photo["upload_location"]
153
+ end
154
+ end
155
+
156
+ describe '#images' do
157
+ it "should return info about the photo's sizes" do
158
+ subject.images.should == photo["images"]
159
+ end
160
+
161
+ it "should all have hieght, width, source and type" do
162
+ subject.images.should each { |image|
163
+ image.keys.should =~ ["height", "source", "type", "width"]
164
+ }
165
+ end
166
+ end
167
+
168
+ describe '#link' do
169
+ it "should return the url of the photo hosted in Skydrive" do
170
+ subject.link.should == photo["link"]
171
+ end
172
+ end
173
+
174
+ describe '#when_taken' do
175
+ it "should return the time when the photo was taken" do
176
+ subject.when_taken.should == Time.new(photo["when_taken"])
177
+ end
178
+ end
179
+
180
+ describe '#download_link' do
181
+ it "should give the download link for the photo" do
182
+ stub_request(:get, "https://apis.live.net/v5.0/file.de57f4126ed7e411.DE57F4126ED7E411!128/content?access_token=access_token&download=true&suppress_redirects=true").to_return(:status => 200, :body => {"location" => "http://dummylocation.com"}.to_json, :headers => {})
183
+ subject.download_link.should == "http://dummylocation.com"
184
+ end
185
+ end
186
+
187
+ describe '#height' do
188
+ it "should return the height of the photo" do
189
+ subject.height.should == photo["height"]
190
+ end
191
+ end
192
+
193
+ describe '#width' do
194
+ it "should return the width of the photo" do
195
+ subject.width.should == photo["width"]
196
+ end
197
+ end
198
+
199
+ describe '#location' do
200
+ it "should return the location where the photo was taken" do
201
+ subject.location.should == photo["location"]
202
+ end
203
+ it "should give latitude, longitude and altitude" do
204
+ subject.location.keys.should =~ ['latitude', 'longitude', 'altitude']
205
+ end
206
+ end
207
+
208
+
209
+ describe '#camera_make' do
210
+ it "should return the make of the camera with which the photo was taken" do
211
+ subject.camera_make.should == photo["camera_make"]
212
+ end
213
+ end
214
+
215
+ describe '#camera_model' do
216
+ it "should return the brand and model number of the camera that took the photo." do
217
+ subject.camera_model.should == photo["camera_model"]
218
+ end
219
+ end
220
+
221
+ describe '#focal_ratio' do
222
+ it "should return the f-number that the photo was taken at" do
223
+ subject.focal_ratio.should == photo["focal_ratio"]
224
+ end
225
+ end
226
+
227
+ describe '#focal_length' do
228
+ it "should return the focal length that the photo was taken at" do
229
+ subject.focal_length.should == photo["focal_length"]
230
+ end
231
+ end
232
+
233
+ describe '#exposure_numerator' do
234
+ it "should return the numerator of the shutter speed that the photo was taken at" do
235
+ subject.exposure_numerator.should == photo["exposure_numerator"]
236
+ end
237
+ end
238
+
239
+ describe '#exposure_denominator' do
240
+ it "should return the denominator of the shutter speed that the photo was taken at" do
241
+ subject.exposure_denominator.should == photo["exposure_denominator"]
242
+ end
243
+ end
244
+
245
+ describe '#download' do
246
+ it "should download the photo" do
247
+ stub_request(:get, "https://apis.live.net/v5.0/file.de57f4126ed7e411.DE57F4126ED7E411!128/content?access_token=access_token&download=true&suppress_redirects=true").to_return(:status => 200, :body => {"location" => "http://dummylocation.com/path?dummy_param=value"}.to_json, :headers => {})
248
+ stub_request(:get, "http://dummylocation.com/path?dummy_param=value").
249
+ to_return(:status => 200, :body => "\322\204\371\225Q", :headers => {})
250
+ subject.download.should == "\322\204\371\225Q"
251
+ end
252
+ end
253
+
254
+ end
@@ -5,6 +5,13 @@ describe Skydrive::User do
5
5
  name: "Rony Varghese"
6
6
  })
7
7
  }
8
+
9
+ let(:skydrive){ YAML.load(%{
10
+ id: "123456"
11
+ name: "Rony Varghese"
12
+ })
13
+
14
+ }
8
15
  subject { Skydrive::User.new(skydrive_test_client, user)}
9
16
  it "should return the id of the user" do
10
17
  subject.id.should == "123456"
@@ -13,4 +20,9 @@ describe Skydrive::User do
13
20
  it "should return the name of the user" do
14
21
  subject.name.should == "Rony Varghese"
15
22
  end
23
+
24
+ it "should return the user's skydrive home folder" do
25
+ stub_request(:get, "https://apis.live.net/v5.0/123456/skydrive?access_token=access_token").to_return(:status => 200, :body => skydrive.to_json, :headers => {})
26
+ subject.skydrive.should == 1
27
+ end
16
28
  end
@@ -0,0 +1,4 @@
1
+ require "spec_helper"
2
+
3
+ describe Skydrive::Video do
4
+ end
metadata CHANGED
@@ -1,286 +1,265 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skydrive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
4
+ version: 0.1.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rony Varghese
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.11.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.11.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activesupport
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: httmultiparty
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: oauth2
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
- version: '0'
61
+ version: 0.9.2
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
- version: '0'
68
+ version: 0.9.2
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rb-inotify
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rb-fsevent
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.9'
126
125
  - !ruby/object:Gem::Dependency
127
126
  name: guard
128
127
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
128
  requirements:
131
- - - ! '>='
129
+ - - '>='
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  type: :development
135
133
  prerelease: false
136
134
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
135
  requirements:
139
- - - ! '>='
136
+ - - '>='
140
137
  - !ruby/object:Gem::Version
141
138
  version: '0'
142
139
  - !ruby/object:Gem::Dependency
143
140
  name: guard-rspec
144
141
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
142
  requirements:
147
- - - ! '>='
143
+ - - '>='
148
144
  - !ruby/object:Gem::Version
149
145
  version: '0'
150
146
  type: :development
151
147
  prerelease: false
152
148
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
149
  requirements:
155
- - - ! '>='
150
+ - - '>='
156
151
  - !ruby/object:Gem::Version
157
152
  version: '0'
158
153
  - !ruby/object:Gem::Dependency
159
154
  name: simplecov
160
155
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
156
  requirements:
163
- - - ! '>='
157
+ - - '>='
164
158
  - !ruby/object:Gem::Version
165
159
  version: '0'
166
160
  type: :development
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
163
  requirements:
171
- - - ! '>='
164
+ - - '>='
172
165
  - !ruby/object:Gem::Version
173
166
  version: '0'
174
167
  - !ruby/object:Gem::Dependency
175
168
  name: metric_abc
176
169
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
170
  requirements:
179
- - - ! '>='
171
+ - - '>='
180
172
  - !ruby/object:Gem::Version
181
173
  version: '0'
182
174
  type: :development
183
175
  prerelease: false
184
176
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
177
  requirements:
187
- - - ! '>='
178
+ - - '>='
188
179
  - !ruby/object:Gem::Version
189
180
  version: '0'
190
181
  - !ruby/object:Gem::Dependency
191
182
  name: yard
192
183
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
184
  requirements:
195
- - - ! '>='
185
+ - - '>='
196
186
  - !ruby/object:Gem::Version
197
187
  version: '0'
198
188
  type: :development
199
189
  prerelease: false
200
190
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
191
  requirements:
203
- - - ! '>='
192
+ - - '>='
204
193
  - !ruby/object:Gem::Version
205
194
  version: '0'
206
195
  - !ruby/object:Gem::Dependency
207
196
  name: ci_reporter
208
197
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
198
  requirements:
211
- - - ! '>='
199
+ - - '>='
212
200
  - !ruby/object:Gem::Version
213
201
  version: '0'
214
202
  type: :development
215
203
  prerelease: false
216
204
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
205
  requirements:
219
- - - ! '>='
206
+ - - '>='
220
207
  - !ruby/object:Gem::Version
221
208
  version: '0'
222
209
  - !ruby/object:Gem::Dependency
223
210
  name: simplecov-rcov
224
211
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
212
  requirements:
227
- - - ! '>='
213
+ - - '>='
228
214
  - !ruby/object:Gem::Version
229
215
  version: '0'
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
219
  requirements:
235
- - - ! '>='
220
+ - - '>='
236
221
  - !ruby/object:Gem::Version
237
222
  version: '0'
238
223
  - !ruby/object:Gem::Dependency
239
224
  name: rdiscount
240
225
  requirement: !ruby/object:Gem::Requirement
241
- none: false
242
226
  requirements:
243
- - - ! '>='
227
+ - - '>='
244
228
  - !ruby/object:Gem::Version
245
229
  version: '0'
246
230
  type: :development
247
231
  prerelease: false
248
232
  version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
233
  requirements:
251
- - - ! '>='
234
+ - - '>='
252
235
  - !ruby/object:Gem::Version
253
236
  version: '0'
254
237
  - !ruby/object:Gem::Dependency
255
238
  name: webmock
256
239
  requirement: !ruby/object:Gem::Requirement
257
- none: false
258
240
  requirements:
259
- - - ! '>='
241
+ - - '>='
260
242
  - !ruby/object:Gem::Version
261
243
  version: '0'
262
244
  type: :development
263
245
  prerelease: false
264
246
  version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
247
  requirements:
267
- - - ! '>='
248
+ - - '>='
268
249
  - !ruby/object:Gem::Version
269
250
  version: '0'
270
251
  - !ruby/object:Gem::Dependency
271
252
  name: rspec_multi_matchers
272
253
  requirement: !ruby/object:Gem::Requirement
273
- none: false
274
254
  requirements:
275
- - - ! '>='
255
+ - - '>='
276
256
  - !ruby/object:Gem::Version
277
257
  version: '0'
278
258
  type: :development
279
259
  prerelease: false
280
260
  version_requirements: !ruby/object:Gem::Requirement
281
- none: false
282
261
  requirements:
283
- - - ! '>='
262
+ - - '>='
284
263
  - !ruby/object:Gem::Version
285
264
  version: '0'
286
265
  description: Simple ruby client library for Skydrive cloud storage service with OAuth2
@@ -328,30 +307,30 @@ files:
328
307
  - spec/skydrive/operations_spec.rb
329
308
  - spec/skydrive/photo_spec.rb
330
309
  - spec/skydrive/user_spec.rb
310
+ - spec/skydrive/video_spec.rb
331
311
  - spec/spec_helper.rb
332
312
  homepage: https://github.com/ronyv89/skydrive
333
313
  licenses: []
314
+ metadata: {}
334
315
  post_install_message:
335
316
  rdoc_options: []
336
317
  require_paths:
337
318
  - lib
338
319
  required_ruby_version: !ruby/object:Gem::Requirement
339
- none: false
340
320
  requirements:
341
- - - ! '>='
321
+ - - '>='
342
322
  - !ruby/object:Gem::Version
343
323
  version: '0'
344
324
  required_rubygems_version: !ruby/object:Gem::Requirement
345
- none: false
346
325
  requirements:
347
- - - ! '>='
326
+ - - '>='
348
327
  - !ruby/object:Gem::Version
349
328
  version: '0'
350
329
  requirements: []
351
330
  rubyforge_project:
352
- rubygems_version: 1.8.24
331
+ rubygems_version: 2.0.6
353
332
  signing_key:
354
- specification_version: 3
333
+ specification_version: 4
355
334
  summary: Ruby client library for Microsoft Skydrive
356
335
  test_files:
357
336
  - spec/skydrive/album_spec.rb
@@ -366,5 +345,6 @@ test_files:
366
345
  - spec/skydrive/operations_spec.rb
367
346
  - spec/skydrive/photo_spec.rb
368
347
  - spec/skydrive/user_spec.rb
348
+ - spec/skydrive/video_spec.rb
369
349
  - spec/spec_helper.rb
370
350
  has_rdoc: