smugmugr 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,567 @@
1
+ # all taken from examples at:
2
+ # http://wiki.smugmug.net/display/API/API+1.2.2
3
+
4
+ # smugmug.albums.get
5
+ def albums_get
6
+ <<-END
7
+ {
8
+ "stat": "ok",
9
+ "method": "smugmug.albums.get",
10
+ "Albums": [
11
+ {
12
+ "id": 1234,
13
+ "Key": "xCXXu",
14
+ "Category": {
15
+ "id": 0,
16
+ "Name": "Other"
17
+ },
18
+ "Title": "My Birthday 2008"
19
+ }
20
+ ]
21
+ }
22
+ END
23
+ end
24
+
25
+ # smugmug.albums.getInfo
26
+ def albums_get_info
27
+ <<-END
28
+ {
29
+ "stat": "ok",
30
+ "method": "smugmug.albums.getInfo",
31
+ "Album": {
32
+ "id": 1234,
33
+ "Key": "xCXXu",
34
+ "Backprinting": "",
35
+ "CanRank": true,
36
+ "Category": {
37
+ "id": 0,
38
+ "Name": "Other"
39
+ },
40
+ "Clean": false,
41
+ "ColorCorrection": 0,
42
+ "Comments": true,
43
+ "Description": "Photos from my party.",
44
+ "EXIF": true,
45
+ "External": false,
46
+ "FamilyEdit": true,
47
+ "FriendEdit": true,
48
+ "Geography": false,
49
+ "Header": true,
50
+ "HideOwner": false,
51
+ "ImageCount": 20,
52
+ "Watermark": {
53
+ "id": 0,
54
+ "Name": "SmugMug"
55
+ }
56
+ }
57
+ }
58
+ END
59
+ end
60
+
61
+ # smugmug.albumtemplates.get
62
+ def album_templates_get
63
+ <<-END
64
+ {
65
+ "stat": "ok",
66
+ "method": "smugmug.albumtemplates.get",
67
+ "AlbumTemplates": [
68
+ {
69
+ "id": 2,
70
+ "AlbumTemplateName": "smugmug default",
71
+ "Backprinting": "",
72
+ "CanRank": true,
73
+ "Clean": false,
74
+ "ColorCorrection": 0,
75
+ "Comments": true,
76
+ "Community": {
77
+ "id": 0
78
+ },
79
+ "EXIF": true,
80
+ "External": true,
81
+ "FamilyEdit": false,
82
+ "FriendEdit": false,
83
+ "Geography": true,
84
+ "Header": false,
85
+ "HideOwner": false,
86
+ "Larges": true,
87
+ "Originals": true,
88
+ "Password": "",
89
+ "PasswordHint": "",
90
+ "Printable": true,
91
+ "ProofDays": 0,
92
+ "Protected": false,
93
+ "Public": true,
94
+ "Share": true,
95
+ "SmugSearchable": true,
96
+ "SortDirection": false,
97
+ "SortMethod": "Position",
98
+ "SquareThumbs": true,
99
+ "Template": {
100
+ "id": 0
101
+ },
102
+ "UnsharpAmount": 0.2,
103
+ "UnsharpRadius": 1,
104
+ "UnsharpSigma": 1,
105
+ "UnsharpThreshold": 0.05,
106
+ "Watermark": {
107
+ "id": 0
108
+ },
109
+ "Watermarking": false,
110
+ "WorldSearchable": true,
111
+ "XLarges": true,
112
+ "X2Larges": true,
113
+ "X3Larges": true
114
+ }
115
+ ]
116
+ }
117
+ END
118
+ end
119
+
120
+ # smugmug.categories.get
121
+ def category_get
122
+ <<-END
123
+ {
124
+ "stat": "ok",
125
+ "method": "smugmug.categories.get",
126
+ "Categories": [
127
+ {
128
+ "id": 0,
129
+ "Name": "Other"
130
+ },
131
+ {
132
+ "id": 1,
133
+ "Name": "Animals"
134
+ },
135
+ {
136
+ "id": 2,
137
+ "Name": "Architecture"
138
+ },
139
+ {
140
+ "id": 3,
141
+ "Name": "Art"
142
+ },
143
+ {
144
+ "id": 4,
145
+ "Name": "Boats"
146
+ },
147
+ {
148
+ "id": 5,
149
+ "Name": "Business"
150
+ }
151
+ ]
152
+ }
153
+ END
154
+ end
155
+
156
+ # smugmug.communities.get
157
+ def communities_get
158
+ <<-END
159
+ {
160
+ "stat": "ok",
161
+ "method": "smugmug.communities.get",
162
+ "Communities": [
163
+ {
164
+ "id": 712,
165
+ "Name": "Australia"
166
+ },
167
+ {
168
+ "id": 17,
169
+ "Name": "DigitalGrin"
170
+ }
171
+ ]
172
+ }
173
+ END
174
+ end
175
+
176
+ # smugmug.family.get
177
+ def family_get
178
+ <<-END
179
+ {
180
+ "stat": "ok",
181
+ "method": "smugmug.family.get",
182
+ "Family": [
183
+ {
184
+ "DisplayName": "Joe Citizen",
185
+ "NickName": "joe",
186
+ "URL": "http://joe.smugmug.com"
187
+ }
188
+ ]
189
+ }
190
+ END
191
+ end
192
+
193
+ # smugmug.friends.get
194
+ def friends_get
195
+ <<-END
196
+ {
197
+ "stat": "ok",
198
+ "method": "smugmug.friends.get",
199
+ "Friends": [
200
+ {
201
+ "DisplayName": "Joe Citizen",
202
+ "NickName": "joe",
203
+ "URL": "http://joe.smugmug.com"
204
+ }
205
+ ]
206
+ }
207
+ END
208
+ end
209
+
210
+ # smugmug.images.get
211
+ def images_get
212
+ <<-END
213
+ {
214
+ "stat": "ok",
215
+ "method": "smugmug.images.get",
216
+ "Album": {
217
+ "id": 1234,
218
+ "Key": "xCXXu",
219
+ "ImageCount": 1,
220
+ "Images": [
221
+ {
222
+ "id": 12345,
223
+ "Key": "nrBE6"
224
+ }
225
+ ]
226
+ }
227
+ }
228
+ END
229
+ end
230
+
231
+ # smugmug.images.getEXIF
232
+ def images_get_exif
233
+ <<-END
234
+ {
235
+ "stat": "ok",
236
+ "method": "smugmug.images.getEXIF",
237
+ "Image": {
238
+ "id": 12345,
239
+ "Key": "nrBE6",
240
+ "Aperture": "f/2.8",
241
+ "CCDWidth": "6mm",
242
+ "ColorSpace": "1",
243
+ "CompressedBitsPerPixel": "5/1",
244
+ "DateTime": "2008-02-05 09:42:12",
245
+ "DateTimeDigitized": "2008-02-05 09:42:12",
246
+ "DateTimeOriginal": "2008-02-05 09:42:12",
247
+ "DigitalZoomRatio": "3072/3072",
248
+ "ExposureBias": "0/3",
249
+ "ExposureMode": 0,
250
+ "ExposureTime": "1/25",
251
+ "Flash": 16,
252
+ "FocalLength": "7700/1000",
253
+ "Make": "Canon",
254
+ "Model": "Canon DIGITAL IXUS 750",
255
+ "SensingMethod": 2,
256
+ "WhiteBalance": 0
257
+ }
258
+ }
259
+ END
260
+ end
261
+
262
+ # smugmug.images.getInfo
263
+ def images_get_info
264
+ <<-END
265
+
266
+ {
267
+ "stat": "ok",
268
+ "method": "smugmug.images.getInfo",
269
+ "Image": {
270
+ "id": 12345,
271
+ "Key": "nrBE6",
272
+ "Album": {
273
+ "id": 1234,
274
+ "Key": "xCXXu",
275
+ "URL": "http://fred.smugmug.com/gallery/1234_xCXXu#12345_nrBE6"
276
+ },
277
+ "Caption": "",
278
+ "Date": "2008-02-05 15:52:56",
279
+ "FileName": "IMG_1234.JPG",
280
+ "Format": "JPG",
281
+ "Height": 2304,
282
+ "Hidden": false,
283
+ "Keywords": "",
284
+ "LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-L.jpg",
285
+ "LastUpdated": "2008-02-05 22:16:52",
286
+ "Latitude": -37.819706,
287
+ "Longitude": 145.202974,
288
+ "MD5Sum": "b1f26944e2fa6e20e88532e471239574",
289
+ "MediumURL": "http://fred.smugmug.com/photos/12345_nrBE6-M.jpg",
290
+ "OriginalURL": "http://fred.smugmug.com/photos/12345_nrBE6-O.jpg",
291
+ "Position": 1,
292
+ "Serial": 0,
293
+ "Size": 7457753,
294
+ "SmallURL": "http://fred.smugmug.com/photos/12345_nrBE6-S.jpg",
295
+ "ThumbURL": "http://fred.smugmug.com/photos/12345_nrBE6-Th.jpg",
296
+ "TinyURL": "http://fred.smugmug.com/photos/12345_nrBE6-Ti.jpg",
297
+ "Watermark": false,
298
+ "Width": 3072,
299
+ "X2LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-X2L.jpg",
300
+ "X3LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-X3L.jpg",
301
+ "XLargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-XL.jpg"
302
+ }
303
+ }
304
+ END
305
+ end
306
+
307
+ # smugmug.images.getURLs
308
+ def images_get_urls
309
+ <<-END
310
+ {
311
+ "stat": "ok",
312
+ "method": "smugmug.images.getURLs",
313
+ "Image": {
314
+ "id": 12345,
315
+ "Key": "nrBE6",
316
+ "Album": {
317
+ "id": 1234,
318
+ "Key": "xCXXu",
319
+ "URL": "http://fred.smugmug.com/gallery/1234_xCXXu#12345_nrBE6"
320
+ },
321
+ "LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-L.jpg",
322
+ "MediumURL": "http://fred.smugmug.com/photos/12345_nrBE6-M.jpg",
323
+ "OriginalURL": "http://fred.smugmug.com/photos/12345_nrBE6-O.jpg",
324
+ "SmallURL": "http://fred.smugmug.com/photos/12345_nrBE6-S.jpg",
325
+ "ThumbURL": "http://fred.smugmug.com/photos/12345_nrBE6-Th.jpg",
326
+ "TinyURL": "http://fred.smugmug.com/photos/12345_nrBE6-Ti.jpg",
327
+ "X2LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-X2L.jpg",
328
+ "X3LargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-X3L.jpg",
329
+ "XLargeURL": "http://fred.smugmug.com/photos/12345_nrBE6-XL.jpg"
330
+ }
331
+ }
332
+ END
333
+ end
334
+
335
+ # smugmug.sharegroups.get
336
+ def sharegroups_get
337
+ <<-END
338
+ {
339
+ "stat": "ok",
340
+ "method": "smugmug.sharegroups.get",
341
+ "ShareGroups": [
342
+ {
343
+ "id": 1234,
344
+ "Tag": "yZl6Z52YFiyc",
345
+ "AlbumCount": 1,
346
+ "Description": "Private albums to share with family",
347
+ "Name": "Family Photos",
348
+ "URL": "http://fred.smugmug.com/share/yZl6Z52YFiyc"
349
+ }
350
+ ]
351
+ }
352
+ END
353
+ end
354
+
355
+ # smugmug.sharegroups.getInfo
356
+ def sharegroups_get_info
357
+ <<-END
358
+ {
359
+ "stat": "ok",
360
+ "method": "smugmug.sharegroups.getInfo",
361
+ "ShareGroup": {
362
+ "id": 1234,
363
+ "Tag": "yZl6Z52YFiyc",
364
+ "AlbumCount": 1,
365
+ "Albums": [
366
+ {
367
+ "id": 1234,
368
+ "Key": "xCXXu",
369
+ "Title": "My Birthday 2008"
370
+ }
371
+ ],
372
+ "Description": "Private albums to share with family",
373
+ "Name": "Family Photos",
374
+ "URL": "http://fred.smugmug.com/share/yZl6Z52YFiyc"
375
+ }
376
+ }
377
+ END
378
+ end
379
+
380
+ # smugmug.subcategories.get
381
+ def subcategories_get
382
+ <<-END
383
+ {
384
+ "stat": "ok",
385
+ "method": "smugmug.subcategories.get",
386
+ "SubCategories": [
387
+ {
388
+ "id": 1234,
389
+ "Name": "Sunrise"
390
+ },
391
+ {
392
+ "id": 2345,
393
+ "Name": "Sunset"
394
+ }
395
+ ]
396
+ }
397
+ END
398
+ end
399
+
400
+ # smugmug.subcategories.getAll
401
+ def subcategories_get_all
402
+ <<-END
403
+ {
404
+ "stat": "ok",
405
+ "method": "smugmug.subcategories.getAll",
406
+ "SubCategories": [
407
+ {
408
+ "id": 1234,
409
+ "Name": "Sunrise",
410
+ "Category": {
411
+ "id": 13
412
+ }
413
+ },
414
+ {
415
+ "id": 2345,
416
+ "Name": "Sunset",
417
+ "Category": {
418
+ "id": 13
419
+ }
420
+ },
421
+ {
422
+ "id": 1000,
423
+ "Name": "Testing",
424
+ "Category": {
425
+ "id": 0
426
+ }
427
+ }
428
+ ]
429
+ }
430
+ END
431
+ end
432
+
433
+ # smugmug.themes.get
434
+ def themes_get
435
+ <<-END
436
+ {
437
+ "stat": "ok",
438
+ "method": "smugmug.themes.get",
439
+ "Themes": [
440
+ {
441
+ "id": 24,
442
+ "Name": "SmugMug Classic",
443
+ "Type": "smugmug"
444
+ },
445
+ {
446
+ "id": 59,
447
+ "Name": "SmugMug Dashed",
448
+ "Type": "smugmug"
449
+ },
450
+ {
451
+ "id": 96,
452
+ "Name": "SmugMug Gradient",
453
+ "Type": "smugmug"
454
+ }
455
+ ]
456
+ }
457
+ END
458
+ end
459
+
460
+ # smugmug.users.getDisplayName
461
+ def users_get_display_name
462
+ <<-END
463
+ {
464
+ "stat": "ok",
465
+ "method": "smugmug.users.getDisplayName",
466
+ "User": {
467
+ "DisplayName": "Joe Citizen"
468
+ }
469
+ }
470
+ END
471
+ end
472
+
473
+ # smugmug.users.getTree
474
+ def users_get_tree
475
+ <<-END
476
+ {
477
+ "stat": "ok",
478
+ "method": "smugmug.users.getTree",
479
+ "Categories": [
480
+ {
481
+ "id": 0,
482
+ "Name": "Other",
483
+ "SubCategories": [
484
+ {
485
+ "id": 1000,
486
+ "Name": "Testing"
487
+ }
488
+ ],
489
+ "Albums": [
490
+ {
491
+ "id": 1234,
492
+ "Key": "xCXXu",
493
+ "Title": "My Birthday 2008"
494
+ }
495
+ ]
496
+ },
497
+ {
498
+ "id": 1,
499
+ "Name": "Animals"
500
+ },
501
+ {
502
+ "id": 2,
503
+ "Name": "Architecture"
504
+ },
505
+ {
506
+ "id": 3,
507
+ "Name": "Art"
508
+ },
509
+ {
510
+ "id": 4,
511
+ "Name": "Boats"
512
+ },
513
+ {
514
+ "id": 13,
515
+ "Name": "Landscapes",
516
+ "SubCategories": [
517
+ {
518
+ "id": 1234,
519
+ "Name": "Sunrise"
520
+ },
521
+ {
522
+ "id": 2345,
523
+ "Name": "Sunset"
524
+ }
525
+ ]
526
+ }
527
+ ]
528
+ }
529
+ END
530
+ end
531
+
532
+ # smugmug.watermarks.get
533
+ def watermarks_get
534
+ <<-END
535
+ {
536
+ "stat": "ok",
537
+ "method": "smugmug.watermarks.get",
538
+ "Watermarks": [
539
+ {
540
+ "id": 1234,
541
+ "Name": "My Custom Watermark"
542
+ }
543
+ ]
544
+ }
545
+ END
546
+ end
547
+
548
+ # smugmug.watermarks.getInfo
549
+ def watermarks_get_info
550
+ <<-END
551
+ {
552
+ "stat": "ok",
553
+ "method": "smugmug.watermarks.getInfo",
554
+ "Watermark": {
555
+ "id": 1234,
556
+ "Name": "My Custom Watermark",
557
+ "Dissolve": 50,
558
+ "Image": {
559
+ "id": 12345,
560
+ "Key": "nrBE6"
561
+ },
562
+ "Pinned": "Center",
563
+ "Thumbs": false
564
+ }
565
+ }
566
+ END
567
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/response_stubs'
3
+
4
+ describe "Session" do
5
+ before(:all) do
6
+ @session = Smugmugr::Session.new(Smugmugr::User.new('fooapikey123'))
7
+ end
8
+
9
+ it 'should encode params passed' do
10
+ params = {:foo => 'bar', :baz => "blingy things"}
11
+ encoded_params = @session.send(:encode_params, params)
12
+ expected = ['foo=bar', 'baz=blingy+things']
13
+ expected.each{|pair|
14
+ expected.include?(encoded_params.pop).should be_true
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/response_stubs'
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require 'mocha'
4
+ require 'active_support'
5
+ require 'json'
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
9
+
10
+ require 'smugmugr'
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/response_stubs'
data/spec/user_spec.rb ADDED
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/response_stubs'
3
+
4
+ describe "User" do
5
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/response_stubs'