Class: LWS::Resource::Collection
- Inherits:
-
Generic::Model
- Object
- Spyke::Base
- Generic::Model
- LWS::Resource::Collection
- Defined in:
- lib/lws/apps/resource.rb
Overview
The collection class
A collection has a specific kind and contains a single or set of items. For some collection kinds, there is specific metadata (see #metadata) available.
Defined Under Namespace
Classes: Item, Metadata, VimeoMetadata, WeatherLocationMetadata, YouTubeMetadata
Instance Attribute Summary collapse
-
#account ⇒ LWS::Auth::Account
The account of the user that created the collection.
-
#account_id ⇒ Integer
The ID of the account of the user that created the collection.
-
#company ⇒ LWS::Auth::Company
The company the collection belongs to.
-
#company_id ⇒ Integer
The ID of the company the collection belongs to.
-
#deleted_at ⇒ String?
The timestamp of when the collection was deleted.
-
#description ⇒ String
The description of the collection.
-
#email ⇒ String?
The email address used for email imports.
-
#folder ⇒ Folder
The folder that the collection is filed in.
-
#folder_id ⇒ Integer
The ID of the folder that the collection is filed in.
-
#item_ids ⇒ Array<Integer>
The ID of the items that are part of the collection.
-
#items ⇒ Array<Collection::Item>
The items that are part of the collection.
-
#kind ⇒ "image", ...
The name of the class/kind of the collection.
-
#name ⇒ String
The name of the collection.
-
#preview_url ⇒ String
The URL of a preview of the collection.
-
#processing ⇒ Boolean
Whether the collection is being processed (i.e. it is not ready for use).
-
#uuid ⇒ String
The UUID used for unique file name generation.
Attributes inherited from Generic::Model
#created_at, #id, #updated_at, #url, #url_html
Instance Method Summary collapse
-
#metadata ⇒ Collection::Metadata
Returns the metadata of the collection specific to its kind.
Methods inherited from Generic::Model
#deep_dup, #dig, #reload, #rollback, #save
Instance Attribute Details
#account ⇒ LWS::Auth::Account
Returns the account of the user that created the collection.
54 |
# File 'lib/lws/apps/resource.rb', line 54 belongs_to :account, class_name: "LWS::Auth::Account" |
#account_id ⇒ Integer
Returns the ID of the account of the user that created the collection.
59 |
# File 'lib/lws/apps/resource.rb', line 59 attribute :account_id |
#company ⇒ LWS::Auth::Company
Returns the company the collection belongs to.
63 |
# File 'lib/lws/apps/resource.rb', line 63 belongs_to :company, class_name: "LWS::Auth::Company" |
#company_id ⇒ Integer
Returns the ID of the company the collection belongs to.
67 |
# File 'lib/lws/apps/resource.rb', line 67 attribute :company_id |
#deleted_at ⇒ String?
Returns the timestamp of when the collection was deleted.
71 |
# File 'lib/lws/apps/resource.rb', line 71 attribute :deleted_at |
#description ⇒ String
Returns the description of the collection.
75 |
# File 'lib/lws/apps/resource.rb', line 75 attribute :description |
#email ⇒ String?
Returns the email address used for email imports.
79 |
# File 'lib/lws/apps/resource.rb', line 79 attribute :email |
#folder ⇒ Folder
Returns the folder that the collection is filed in.
83 |
# File 'lib/lws/apps/resource.rb', line 83 belongs_to :folder |
#folder_id ⇒ Integer
Returns the ID of the folder that the collection is filed in.
88 |
# File 'lib/lws/apps/resource.rb', line 88 attribute :folder_id |
#item_ids ⇒ Array<Integer>
Returns the ID of the items that are part of the collection.
93 |
# File 'lib/lws/apps/resource.rb', line 93 attribute :item_ids |
#items ⇒ Array<Collection::Item>
Returns the items that are part of the collection.
98 |
# File 'lib/lws/apps/resource.rb', line 98 has_many :items, class_name: "LWS::Resource::Collection::Item" |
#kind ⇒ "image", ...
This library only supports a subset of the available collection/item kinds.
Returns the name of the class/kind of the
collection.
107 |
# File 'lib/lws/apps/resource.rb', line 107 attribute :kind |
#name ⇒ String
Returns the name of the collection.
111 |
# File 'lib/lws/apps/resource.rb', line 111 attribute :name |
#preview_url ⇒ String
Returns the URL of a preview of the collection.
115 |
# File 'lib/lws/apps/resource.rb', line 115 attribute :preview_url |
#processing ⇒ Boolean
Returns whether the collection is being processed (i.e. it is not ready for use).
120 |
# File 'lib/lws/apps/resource.rb', line 120 attribute :processing |
#uuid ⇒ String
Returns the UUID used for unique file name generation.
124 |
# File 'lib/lws/apps/resource.rb', line 124 attribute :uuid |
Instance Method Details
#metadata ⇒ Collection::Metadata
Returns the metadata of the collection specific to its kind.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/lws/apps/resource.rb', line 129 def case kind # when "feed" # attrs = # attributes["metadata"] # .slice("feed_url", "refresh_interval") # .symbolize_keys # FeedMetadata.new(attrs) when "vimeo" attrs = attributes["metadata"] .slice("video_url") .symbolize_keys VimeoMetadata.new(attrs) when "weather_location" attrs = attributes["metadata"] .slice("city", "country", "description", "feed_url", "forecast_interval", "kind", "lat", "link", "long", "name", "refresh_interval", "regio", "title", "token") .symbolize_keys WeatherLocationMetadata.new(attrs) when "youtube" attrs = attributes["metadata"] .slice("video_url") .symbolize_keys YouTubeMetadata.new(attrs) else Metadata.new end end |