Class: RailsMug::Model::Album
- Defined in:
- lib/RailsMug/model/album.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#backprinting ⇒ Object
readonly
The text to be printed on the back of prints purchased from this album.
-
#boutique_packaging ⇒ Object
readonly
Enable boutique packaging for orders from this album.
-
#can_rank ⇒ Object
readonly
Allow images from this album to be ranked using PhotoRank.
-
#category ⇒ Object
readonly
The category that this album belongs to.
-
#clean ⇒ Object
readonly
Hide the Description and LastUpdated for this album on the homepage and category pages.
-
#color_correction ⇒ Object
readonly
The color correction setting for this album (0 - No, 1 - Yes, 2 - Inherit).
-
#comments ⇒ Object
readonly
Allow visitors to leave comments on this album.
-
#community ⇒ Object
readonly
The community that this album belongs to.
-
#description ⇒ Object
readonly
The description for this album.
-
#exif ⇒ Object
readonly
Allow EXIF data to be viewed for images from this album.
-
#external ⇒ Object
readonly
Allow images from this album to be linked externally outside SmugMug.
-
#family_edit ⇒ Object
readonly
Allow family to edit the captions and keywords of the images in this album.
-
#filenames ⇒ Object
readonly
Show filename for images uploaded with no caption to this album.
-
#friend_edit ⇒ Object
readonly
Allow friends to edit the captions and keywords of the images in this album.
-
#geography ⇒ Object
readonly
Enable mapping features for this album.
-
#guest_upload_url ⇒ Object
readonly
The URL to allow guests to upload to this gallery.
-
#header ⇒ Object
readonly
Default this album to the standard SmugMug appearance.
-
#hide_owner ⇒ Object
readonly
Hide the owner of this album.
-
#highlight ⇒ Object
readonly
The highlight image for this album Key, Type.
-
#id ⇒ Object
readonly
The Id for this album.
-
#image_count ⇒ Object
readonly
The number of images in this album.
-
#images ⇒ Object
Returns the value of attribute images.
-
#key ⇒ Object
readonly
The key for this album.
-
#keywords ⇒ Object
readonly
The meta keyword string for this album.
-
#sub_category ⇒ Object
readonly
The sub category that this album belongs to.
-
#title ⇒ Object
readonly
The title for this album.
-
#url ⇒ Object
readonly
The URL for this album.
Instance Method Summary collapse
-
#add_image(image) ⇒ Object
Add image to album.
-
#get_photos ⇒ Object
Retrieve a list of images for an album.
-
#to_json ⇒ Object
Display Album in JSON format.
Methods inherited from Record
Constructor Details
This class inherits a constructor from RailsMug::Record
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
58 59 60 |
# File 'lib/RailsMug/model/album.rb', line 58 def access_token @access_token end |
#backprinting ⇒ Object (readonly)
The text to be printed on the back of prints purchased from this album
15 16 17 |
# File 'lib/RailsMug/model/album.rb', line 15 def backprinting @backprinting end |
#boutique_packaging ⇒ Object (readonly)
Enable boutique packaging for orders from this album
17 18 19 |
# File 'lib/RailsMug/model/album.rb', line 17 def boutique_packaging @boutique_packaging end |
#can_rank ⇒ Object (readonly)
Allow images from this album to be ranked using PhotoRank
19 20 21 |
# File 'lib/RailsMug/model/album.rb', line 19 def can_rank @can_rank end |
#category ⇒ Object (readonly)
The category that this album belongs to
9 10 11 |
# File 'lib/RailsMug/model/album.rb', line 9 def category @category end |
#clean ⇒ Object (readonly)
Hide the Description and LastUpdated for this album on the homepage and category pages
21 22 23 |
# File 'lib/RailsMug/model/album.rb', line 21 def clean @clean end |
#color_correction ⇒ Object (readonly)
The color correction setting for this album (0 - No, 1 - Yes, 2 - Inherit)
23 24 25 |
# File 'lib/RailsMug/model/album.rb', line 23 def color_correction @color_correction end |
#comments ⇒ Object (readonly)
Allow visitors to leave comments on this album
25 26 27 |
# File 'lib/RailsMug/model/album.rb', line 25 def comments @comments end |
#community ⇒ Object (readonly)
The community that this album belongs to.
27 28 29 |
# File 'lib/RailsMug/model/album.rb', line 27 def community @community end |
#description ⇒ Object (readonly)
The description for this album
29 30 31 |
# File 'lib/RailsMug/model/album.rb', line 29 def description @description end |
#exif ⇒ Object (readonly)
Allow EXIF data to be viewed for images from this album
31 32 33 |
# File 'lib/RailsMug/model/album.rb', line 31 def exif @exif end |
#external ⇒ Object (readonly)
Allow images from this album to be linked externally outside SmugMug
33 34 35 |
# File 'lib/RailsMug/model/album.rb', line 33 def external @external end |
#family_edit ⇒ Object (readonly)
Allow family to edit the captions and keywords of the images in this album
35 36 37 |
# File 'lib/RailsMug/model/album.rb', line 35 def family_edit @family_edit end |
#filenames ⇒ Object (readonly)
Show filename for images uploaded with no caption to this album
37 38 39 |
# File 'lib/RailsMug/model/album.rb', line 37 def filenames @filenames end |
#friend_edit ⇒ Object (readonly)
Allow friends to edit the captions and keywords of the images in this album
39 40 41 |
# File 'lib/RailsMug/model/album.rb', line 39 def friend_edit @friend_edit end |
#geography ⇒ Object (readonly)
Enable mapping features for this album
41 42 43 |
# File 'lib/RailsMug/model/album.rb', line 41 def geography @geography end |
#guest_upload_url ⇒ Object (readonly)
The URL to allow guests to upload to this gallery
43 44 45 |
# File 'lib/RailsMug/model/album.rb', line 43 def guest_upload_url @guest_upload_url end |
#header ⇒ Object (readonly)
Default this album to the standard SmugMug appearance. (false - Custom, true - SmugMug)
45 46 47 |
# File 'lib/RailsMug/model/album.rb', line 45 def header @header end |
#hide_owner ⇒ Object (readonly)
Hide the owner of this album.
47 48 49 |
# File 'lib/RailsMug/model/album.rb', line 47 def hide_owner @hide_owner end |
#highlight ⇒ Object (readonly)
The highlight image for this album Key, Type
49 50 51 |
# File 'lib/RailsMug/model/album.rb', line 49 def highlight @highlight end |
#id ⇒ Object (readonly)
The Id for this album
5 6 7 |
# File 'lib/RailsMug/model/album.rb', line 5 def id @id end |
#image_count ⇒ Object (readonly)
The number of images in this album
51 52 53 |
# File 'lib/RailsMug/model/album.rb', line 51 def image_count @image_count end |
#images ⇒ Object
Returns the value of attribute images.
57 58 59 |
# File 'lib/RailsMug/model/album.rb', line 57 def images @images end |
#key ⇒ Object (readonly)
The key for this album
7 8 9 |
# File 'lib/RailsMug/model/album.rb', line 7 def key @key end |
#keywords ⇒ Object (readonly)
The meta keyword string for this album
53 54 55 |
# File 'lib/RailsMug/model/album.rb', line 53 def keywords @keywords end |
#sub_category ⇒ Object (readonly)
The sub category that this album belongs to
11 12 13 |
# File 'lib/RailsMug/model/album.rb', line 11 def sub_category @sub_category end |
#title ⇒ Object (readonly)
The title for this album
13 14 15 |
# File 'lib/RailsMug/model/album.rb', line 13 def title @title end |
#url ⇒ Object (readonly)
The URL for this album
55 56 57 |
# File 'lib/RailsMug/model/album.rb', line 55 def url @url end |
Instance Method Details
#add_image(image) ⇒ Object
Add image to album
97 98 99 100 |
# File 'lib/RailsMug/model/album.rb', line 97 def add_image image self.images = [] if self.images.nil? self.images << image end |
#get_photos ⇒ Object
Retrieve a list of images for an album
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/RailsMug/model/album.rb', line 78 def get_photos response = self.access_token.get("/api/json/1.3.0/?method=smugmug.images.get&AlbumID=#{self.id}&AlbumKey=#{self.key}") json_response = JSON.parse(response.body) raise RailsMug::AlbumError, "SmugMug images.get Error: #{json_response['code']} - #{json_response['message']}" if json_response['stat'] == "fail" json_response['Album']['Images'].each do |img| img = RailsMug::Model::Image.new( :id => img['id'], :key => img['Key'] ) img.get_photo_info @access_token self.add_image img end end |
#to_json ⇒ Object
Display Album in JSON format
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/RailsMug/model/album.rb', line 63 def to_json ret = { :id => self.id, :key => self.key, :category => self.category, :sub_category => self.sub_category, :title => self.title, :images => self.images } end |