rubyhexagon 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ module Rubyhexagon
20
20
  # A class to interact with the e621 web interface.
21
21
  #
22
22
  # @author Maxine Michalski
23
+ # @api public
23
24
  # @since 1.4.0
24
25
  class User
25
26
  # @author Maxine Michalski
@@ -27,7 +28,8 @@ module Rubyhexagon
27
28
  # Fetch data for user
28
29
  #
29
30
  # @param user [Hash|E621::User] User data to fetch from
30
- #
31
+ # @example Get user information
32
+ # E621::User.show(id: 1) #=> E621::User
31
33
  # @return [E621::User]
32
34
  def self.show(user)
33
35
  unless (user.is_a?(Hash) && user[:id].is_a?(Integer)) ||
@@ -38,6 +40,13 @@ module Rubyhexagon
38
40
  new(E621::API.fetch(:user, :show, user))
39
41
  end
40
42
 
43
+ # @author Maxine Michalski
44
+ #
45
+ # Fetch a list of users
46
+ #
47
+ # @example Get list of users
48
+ # E621::User.list(name: 'purple') #=> Array<E621::User>
49
+ # @return [E621::User]
41
50
  def self.list(query)
42
51
  raise ArgumentError, 'A Hash is required' unless query.is_a?(Hash)
43
52
  E621::API.fetch(:user, :index, query).map do |user|
@@ -45,6 +54,12 @@ module Rubyhexagon
45
54
  end
46
55
  end
47
56
 
57
+ # @author Maxine Michalski
58
+ #
59
+ # User information
60
+ # @example Get User Information
61
+ # user.show #=> E621::User
62
+ # @return [E621::User]
48
63
  def show
49
64
  E621::User.new(E621::API.fetch(:user, :show, id: @id))
50
65
  end
@@ -20,35 +20,59 @@ module Rubyhexagon
20
20
  # Class to hold information about an artist on e621
21
21
  #
22
22
  # @author Maxine Michalski
23
+ # @api public
23
24
  # @since 1.0.0
24
25
  class Artist
26
+ # Artist ID
27
+ # @example Get artist ID
28
+ # artist.id #=> Integer
25
29
  # @return [Integer] id of artist
26
30
  attr_reader :id
27
31
 
32
+ # Artist name
33
+ # @example Get artist name
34
+ # artist.name #=> String
28
35
  # @return [String] name of artist
29
36
  attr_reader :name
30
37
 
38
+ # Alternative names for artist
39
+ # @example Get alternative names for artist
40
+ # artist.other_names #=> [] or Array<String>
31
41
  # @return [Array<String>] alternative names for artist
32
42
  attr_reader :other_names
33
43
 
44
+ # Group name for artist
45
+ # @example Get group name for artist
46
+ # artist.group_name #=> String
34
47
  # @return [String] group name for artist
35
48
  attr_reader :group_name
36
49
 
50
+ # URLs to find artist
51
+ # @example Get parsed URIs for artist
52
+ # artist.urls #=> Array<URI> or []
37
53
  # @return [Array<URI>] links to find artist
38
54
  attr_reader :urls
39
55
 
56
+ # Version of artist information
57
+ # @example Get version of this artist's information
58
+ # artist.version #=> Integer
40
59
  # @return [Integer] version of artist information
41
60
  attr_reader :version
42
61
 
62
+ # Updating user for this artist
63
+ # @example Get the user, who last updated this artist
64
+ # artist.updater #=> E621::User
43
65
  # @return [E621::User] updating user
44
66
  attr_reader :updater
45
67
 
46
68
  # @author Maxine Michalski
47
69
  #
48
- # Initializer for Artist.
70
+ # Initializer for Artist
49
71
  #
50
72
  # @param artist [Hash] artist data
51
- #
73
+ # @example Get an artist instance
74
+ # E621::Artist.new(id: 1) #=> E621::Artist instance
75
+ # E621::Artist.new(name: 'artist') #=> E621::Artist instance
52
76
  # @return the object
53
77
  def initialize(artist)
54
78
  unless artist.is_a?(Hash)
@@ -72,7 +96,8 @@ module Rubyhexagon
72
96
  # @author Maxine Michalski
73
97
  #
74
98
  # Comparison method for artists
75
- #
99
+ # @example Compare two tags, that are unequal
100
+ # Tag.new(id: 1) == Tag.new(id: 2) #=> false
76
101
  # @return [TrueClass, FalseClass]
77
102
  def ==(other)
78
103
  return false unless other.is_a?(Artist)
@@ -82,23 +107,58 @@ module Rubyhexagon
82
107
  # @author Maxine Michalski
83
108
  #
84
109
  # Check if this artist is active
85
- #
86
- # @return [TrueClass] artist is active
87
- # @return [FalseClass] artist is not active
110
+ # @example Is artist active?
111
+ # artist.active? #=> true or false
112
+ # @return [TrueClass|FalseClass] depending on active status
88
113
  def active?
89
114
  @is_active
90
115
  end
91
116
 
117
+ # @author Maxine Michalski
118
+ #
119
+ # Turn object into a hash representation of itself
120
+ #
121
+ # @example Turn a User into a Hash
122
+ # Tag.new(id: 1).to_hash #=> { id: 1 }
123
+ # @return [Hash]
124
+ def to_hash
125
+ hash = {}
126
+ instance_variables.each do |i|
127
+ hash.store(i.to_s.sub(/^@/, '').to_sym, instance_variable_get(i))
128
+ end
129
+ hash
130
+ end
131
+
92
132
  private
93
133
 
134
+ # @author Maxine Michalski
135
+ #
136
+ # Setup other names for artist
137
+ #
138
+ # @param names [String] comma separated list of names
139
+ # @api private
140
+ # @return [Array<String>]
94
141
  def setup_other_names(names)
95
142
  @other_names = names.split(',')
96
143
  end
97
144
 
145
+ # @author Maxine Michalski
146
+ #
147
+ # Parsed URI to find artist
148
+ #
149
+ # @param urls [Array<String>] urls to parse
150
+ # @api private
151
+ # @return [Array<URI>]
98
152
  def setup_urls(urls)
99
153
  @urls = urls.map { |u| URI.parse(u) }
100
154
  end
101
155
 
156
+ # @author Maxine Michalski
157
+ #
158
+ # Setup updating user
159
+ # @param updater [Integer] ID of the user who last updated
160
+ # @api private
161
+ # @return [E621::User]
102
162
  def setup_updater_id(updater)
103
163
  @updater = E621::User.new(id: updater)
104
164
  end
@@ -21,22 +21,3 @@
21
21
  # @author Maxine Michalski
22
22
  # @since 1.0.0
23
23
  class InvalidIDError < StandardError; end
24
-
25
- # Error class to show that an object misses an important parameter
26
- #
27
- # @author Maxine Michalski
28
- # @since 1.0.0
29
- class ObjectNotFilledError < StandardError; end
30
-
31
- module Rubyhexagon
32
- # Error class to denote that API access was not permitted.
33
- #
34
- # @author Maxine Michalski
35
- # @since 1.6.0
36
- class AccessDenied < StandardError; end
37
- # Error class that is raised by attempting write access.
38
- #
39
- # @author Maxine Michalski
40
- # @since 2.0.0
41
- class APIWriteError < StandardError; end
42
- end
@@ -21,30 +21,57 @@ module Rubyhexagon
21
21
  # more Ruby like manner.
22
22
  #
23
23
  # @author Maxine Michalski
24
+ # @api public
24
25
  # @since 1.4.0
25
26
  class Pool
27
+ # Pool ID
28
+ # @example Get pool ID
29
+ # pool.id #=> Integer
26
30
  # @return [Integer] returns this pool's ID
27
31
  attr_reader :id
28
32
 
33
+ # Pool name
34
+ # @example Get pool name
35
+ # pool.name #=> String
29
36
  # @return [String] returns name of current pool
30
37
  attr_reader :name
31
38
 
39
+ # Pool creation time
40
+ # @example Get pool creation time
41
+ # pool.created_at #=> Time
32
42
  # @return [Time] returns creation time
33
43
  attr_reader :created_at
34
44
 
45
+ # Time of last update to pool
46
+ # @example Get last update time of pool
47
+ # pool.updated_at #=> Time
35
48
  # @return [Time] returns time of last update
36
49
  attr_reader :updated_at
37
50
 
51
+ # Pool description
52
+ # @example Get pool description
53
+ # pool.description #=> String
38
54
  # @return [String] returns a description of the current pool
39
55
  attr_reader :description
40
56
 
57
+ # Number of posts, inside pool
58
+ # @example Get number of posts, pool has
59
+ # pool.post_count #=> Integer
41
60
  # @return [Integer] returns number of posts inside pool
42
61
  attr_reader :post_count
43
62
 
63
+ # User who created pool
64
+ # @example Get user that created pool
65
+ # pool.creator #=> E621::User
44
66
  # @return [E621::User] returns the user, who has created this pool
45
67
  attr_reader :creator
46
68
 
47
- # @return [Array<Post>] returns an array of posts, that belong to this pool
69
+ # Posts of pool
70
+ #
71
+ # @example Get posts of pool
72
+ # pool.posts #=> Array<E621::Post>
73
+ # @return [Array<E621::Post>] returns an array of posts, that belong to
74
+ # this pool
48
75
  attr_reader :posts
49
76
 
50
77
  # @author Maxine Michalski
@@ -52,7 +79,8 @@ module Rubyhexagon
52
79
  # Initializer for Pool objects
53
80
  #
54
81
  # @param pool [Hash] Pool information
55
- #
82
+ # @example Get new pool instance
83
+ # E621::Pool.new(id: 1) #=> E621::Pool instance
56
84
  # @return the object
57
85
  def initialize(pool)
58
86
  raise ArgumentError, "#{pool.class} is not a Hash" unless pool.is_a?(Hash)
@@ -76,8 +104,9 @@ module Rubyhexagon
76
104
  # @author Maxine Michalski
77
105
  #
78
106
  # Returns locking status
79
- #
80
- # @return [TrueClass,FalseClass]
107
+ # @example Test if pool is locked
108
+ # pool.locked? #=> true or false
109
+ # @return [TrueClass|FalseClass]
81
110
  def locked?
82
111
  @is_locked
83
112
  end
@@ -85,8 +114,9 @@ module Rubyhexagon
85
114
  # @author Maxine Michalski
86
115
  #
87
116
  # Returns active status
88
- #
89
- # @return [TrueClass,FalseClass]
117
+ # @example Test if pool is active or not
118
+ # pool.active? #=> true or false
119
+ # @return [TrueClass|FalseClass]
90
120
  def active?
91
121
  @is_active
92
122
  end
@@ -96,10 +126,26 @@ module Rubyhexagon
96
126
  # Comparison method for Pool objects
97
127
  #
98
128
  # @param other [Object] other object to compare
99
- #
100
- # @return [TrueClass,FalseClass]
129
+ # @example Comapring two unequal pools
130
+ # Pool.new(id: 1) == Pool.new(id: 2) #=> false
131
+ # @return [TrueClass|FalseClass]
101
132
  def ==(other)
102
133
  other.is_a?(Pool) && @id == other.id && @updated_at == other.updated_at
103
134
  end
135
+
136
+ # @author Maxine Michalski
137
+ #
138
+ # Turn object into a hash representation of itself
139
+ #
140
+ # @example Turn a User into a Hash
141
+ # E621::Pool.new(id: 1).to_hash #=> { id: 1 }
142
+ # @return [Hash]
143
+ def to_hash
144
+ hash = {}
145
+ instance_variables.each do |i|
146
+ hash.store(i.to_s.sub(/^@/, '').to_sym, instance_variable_get(i))
147
+ end
148
+ hash
149
+ end
104
150
  end
105
151
  end
@@ -21,73 +21,130 @@ module Rubyhexagon
21
21
  # more Ruby like manner.
22
22
  #
23
23
  # @author Maxine Michalski
24
+ # @api public
24
25
  # @since 1.0.0
25
26
  class Post
27
+ # Post ID
28
+ # @example Get post id
29
+ # post.id #=> Integer
26
30
  # @return [Integer] id of post information
27
31
  attr_reader :id
28
32
 
33
+ # Post author
34
+ # @example Get post creator
35
+ # post.author #=> E621::User
29
36
  # @return [E621::User] user object of who uploaded this post
30
37
  attr_reader :author
31
38
 
39
+ # Time post was created at
40
+ # @example Get creation time
41
+ # post.created_at #=> Time
32
42
  # @return [Time] creation time of post
33
43
  attr_reader :created_at
34
44
 
45
+ # Post status
46
+ # @example Get post status
47
+ # post.status #=> Symbol
35
48
  # @return [Symbol] status of post, can be :active, :flagged, :pending or
36
49
  # :deleted
37
50
  attr_reader :status
38
51
 
52
+ # Post sources
53
+ # @example Get post sources
54
+ # post.sources #=> Array<String>
39
55
  # @return [Array<String>] array of sources. This can contain URI in string
40
56
  # form
41
57
  attr_reader :sources
42
58
 
59
+ # Post artists
60
+ #
61
+ # @example Get post artists
62
+ # post.artists #=> Array<E621::Artist>
43
63
  # @return [Array<E621::Artist>] array of artists, that work on the image
44
64
  # in this post
45
65
  attr_reader :artists
46
66
 
47
- # @return [String] description that's associated with this post
67
+ # Post desciption
68
+ # @example Get post description
69
+ # post.description #=> String|nil
70
+ # @return [String|NilClass] description that's associated with this post
48
71
  attr_reader :description
49
72
 
73
+ # Count of users who favorited this post
74
+ # @example Get favorite count
75
+ # post.fav_count #=> Integer
50
76
  # @return [Integer] number of people, who favorited this post
51
77
  attr_reader :fav_count
52
78
 
79
+ # Post score
80
+ # @example Get score assigned to post
81
+ # post.score #=> Integer
53
82
  # @return [Integer] vote score this post holds
54
83
  attr_reader :score
55
84
 
85
+ # Post rating
86
+ # @example Get post rating
87
+ # post.rating #=> Symbol
56
88
  # @return [Symbol] rating of this post. Can be one of :safe,
57
89
  # :questionable, :explicit
58
90
  attr_reader :rating
59
91
 
92
+ # Post parent
93
+ # @example Get parent of post
94
+ # post.parent #=> E621::Post or nil
60
95
  # @return [E621:post] parent of this post
61
96
  # @return [NilClass]
62
97
  attr_reader :parent
63
98
 
99
+ # Post children
100
+ # @example Get post's children
101
+ # post.children #=> [] or Array<E621::Post>
64
102
  # @return [Array<E621::Post>] Array of child posts
65
103
  attr_reader :children
66
104
 
105
+ # Post MD5 checksum
106
+ # @example Get post's MD5 checksum
107
+ # post.md5 #=> String
67
108
  # @return [String] MD5 checksum associated with this post
68
109
  attr_reader :md5
69
110
 
111
+ # Image of post
112
+ # @example Get post's image
113
+ # post.image #=> E621::Image
70
114
  # @return [E621::Image] file content of this post
71
115
  attr_reader :image
72
116
 
117
+ # Sample of post
118
+ # @example Get post's image
119
+ # post.sample #=> E621::Sample
73
120
  # @return [E621::Sample] sample data in E621::Sample format
74
121
  attr_reader :sample
75
122
 
123
+ # Preview of post
124
+ # @example Get post's image
125
+ # post.preview #=> E621::Preview
76
126
  # @return [E621::Preview] preview data in E621::Preview format
77
127
  attr_reader :preview
78
128
 
129
+ # Deletion reason of post, if any
130
+ # @example Get deletion reason of post
131
+ # post.delreason #=> String or nil
79
132
  # @return [String|NilClass] reason for deletion, if deleted
80
133
  attr_reader :delreason
81
134
 
135
+ # Tags of post
136
+ # @example Get tags of post, without web interaction
137
+ # post.tags #=> Array<E621::Tag>
82
138
  # @return [Array<E621::Tag>] tags of this post
83
139
  attr_reader :tags
84
140
 
85
141
  # @author Maxine Michalski
86
142
  #
87
- # Initializer for Post.
143
+ # Initializer for Post
88
144
  #
89
145
  # @param post [Hash] post data
90
- #
146
+ # @example Get new post instance
147
+ # E621::Post.new(id: 1) #=> E621::Post instance
91
148
  # @return the object
92
149
  def initialize(post)
93
150
  raise ArgumentError, "#{post.class} is not a Hash" unless post.is_a?(Hash)
@@ -109,30 +166,45 @@ module Rubyhexagon
109
166
 
110
167
  # @author Maxine Michalski
111
168
  #
112
- # Test status with an optional parameter. This is more meant to be used by
113
- # alias methods
169
+ # Test status with an optional parameter
114
170
  #
115
171
  # @param test_var [Symbol] variable under test
116
- #
117
- # @return [TrueClass]
118
- # @return [FalseClass]
172
+ # @api private
173
+ # @example Get rating status
174
+ # post.explicit? #=> true or false
175
+ # @return [TrueClass|FalseClass]
119
176
  def test(test_var = nil)
120
177
  test_var ||= __callee__.to_s.sub(/\?/, '').to_sym
121
178
  test_ar = %i[safe questionable explicit]
122
179
  test_ar.include?(test_var) ? @rating == test_var : @status == test_var
123
180
  end
181
+ # @see test
182
+ # @api public
124
183
  alias active? test
184
+ # @api public
185
+ # @see test
125
186
  alias flagged? test
187
+ # @api public
188
+ # @see test
126
189
  alias pending? test
190
+ # @api public
191
+ # @see test
127
192
  alias deleted? test
193
+ # @api public
194
+ # @see test
128
195
  alias safe? test
196
+ # @api public
197
+ # @see test
129
198
  alias questionable? test
199
+ # @api public
200
+ # @see test
130
201
  alias explicit? test
131
202
 
132
203
  # @author Maxine Michalski
133
204
  #
134
205
  # Show if post has comments or not
135
- #
206
+ # @example Get if post has comments
207
+ # post.comments? #=> true or false
136
208
  # @return [TrueClass|FalseClass]
137
209
  def comments?
138
210
  return false if @has_comments.nil?
@@ -142,7 +214,8 @@ module Rubyhexagon
142
214
  # @author Maxine Michalski
143
215
  #
144
216
  # Show if post has a parent
145
- #
217
+ # @example Has post a parent?
218
+ # post.parent? #=> true or false
146
219
  # @return [TrueClass|FalseClass]
147
220
  def parent?
148
221
  !@parent.nil?
@@ -151,7 +224,8 @@ module Rubyhexagon
151
224
  # @author Maxine Michalski
152
225
  #
153
226
  # Show if post has children
154
- #
227
+ # @example Has post children?
228
+ # post.children? #=> true or false
155
229
  # @return [TrueClass|FalseClass]
156
230
  def children?
157
231
  return false if @has_children.nil?
@@ -161,7 +235,8 @@ module Rubyhexagon
161
235
  # @author Maxine Michalski
162
236
  #
163
237
  # Comparison method for posts
164
- #
238
+ # @example Compare two unequal posts
239
+ # Post.new(id: 1) == Post.new(id: 2) #=> false
165
240
  # @return [TrueClass, FalseClass]
166
241
  def ==(other)
167
242
  other.is_a?(Post) && @id == other.id
@@ -170,19 +245,36 @@ module Rubyhexagon
170
245
  # @author Maxine Michalski
171
246
  #
172
247
  # Has post notes?
173
- #
174
- # @return [TrueClass, FalseClass]
248
+ # @example Post has notes?
249
+ # post.notes? #=> true or false
250
+ # @return [TrueClass|FalseClass]
175
251
  def notes?
176
252
  @has_notes
177
253
  end
178
254
 
255
+ # @author Maxine Michalski
256
+ #
257
+ # Turn object into a hash representation of itself
258
+ #
259
+ # @example Turn a User into a Hash
260
+ # Tag.new(id: 1).to_hash #=> { id: 1 }
261
+ # @return [Hash]
262
+ def to_hash
263
+ hash = {}
264
+ instance_variables.each do |i|
265
+ hash.store(i.to_s.sub(/^@/, '').to_sym, instance_variable_get(i))
266
+ end
267
+ hash
268
+ end
269
+
179
270
  private
180
271
 
181
272
  # @author Maxine Michalski
182
273
  #
183
274
  # Set author information
184
- #
275
+ # @api private
185
276
  # @param post [Hash] post data
277
+ # @return [E621::User]
186
278
  def setup_author(post)
187
279
  return if post[:creator_id].nil?
188
280
  @author = E621::User.new(id: post[:creator_id], name: post[:author])
@@ -191,8 +283,9 @@ module Rubyhexagon
191
283
  # @author Maxine Michalski
192
284
  #
193
285
  # Set rating for post
194
- #
286
+ # @api private
195
287
  # @param rating [String] rating of this post
288
+ # @return [Symbol]
196
289
  def setup_rating(rating)
197
290
  @rating = case rating
198
291
  when 's' then :safe
@@ -205,8 +298,10 @@ module Rubyhexagon
205
298
  #
206
299
  # Set creation time
207
300
  #
301
+ # @api private
208
302
  # @param time [Time] Hash that includes creation time in UNIX Epoch on an
209
- # `:s` key.
303
+ # `:s` key
304
+ # @return [Time]
210
305
  def setup_created_at(time)
211
306
  @created_at = Time.at(time[:s]) unless time.nil?
212
307
  end
@@ -214,8 +309,9 @@ module Rubyhexagon
214
309
  # @author Maxine Michalski
215
310
  #
216
311
  # Set status of post
217
- #
312
+ # @api private
218
313
  # @param status [String] Status of post
314
+ # @return [Symbol]
219
315
  def setup_status(status)
220
316
  @status = status.to_sym unless status.nil?
221
317
  end
@@ -223,8 +319,9 @@ module Rubyhexagon
223
319
  # @author Maxine Michalski
224
320
  #
225
321
  # Set sources of post
226
- #
322
+ # @api private
227
323
  # @param sources [Array<String>] Sources of post
324
+ # @return [Array<String>]
228
325
  def setup_sources(sources)
229
326
  @sources = sources.nil? ? [] : sources
230
327
  end
@@ -234,9 +331,10 @@ module Rubyhexagon
234
331
  # Set parent post
235
332
  #
236
333
  # @param parent [Integer] Parent post ID
237
- #
238
- # @notice A parent post is only set with an ID and further information must
334
+ # @api private
335
+ # @note A parent post is only set with an ID and further information must
239
336
  # be fetched manually.
337
+ # @return [E621::Post|NilClass]
240
338
  def setup_parent_id(parent)
241
339
  @parent = parent.nil? ? nil : E621::Post.new(id: parent)
242
340
  end
@@ -246,9 +344,10 @@ module Rubyhexagon
246
344
  # Set children posts
247
345
  #
248
346
  # @param children [Array<Integer>] Children post IDs
249
- #
250
- # @notice All children are only set with an ID and further information must
347
+ # @api private
348
+ # @note All children are only set with an ID and further information must
251
349
  # be fetched manually.
350
+ # @return [Array<E621::Post>]
252
351
  def setup_children(children)
253
352
  return [] if children.nil?
254
353
  @children = children.split(',').map { |c| E621::Post.new(id: c) }
@@ -259,20 +358,41 @@ module Rubyhexagon
259
358
  # Set post description
260
359
  #
261
360
  # @param description [String] Post description
262
- #
263
- # @notice Empty descriptions are set to nil
361
+ # @api private
362
+ # @note Empty descriptions are set to nil
363
+ # @return [String|NilClass]
264
364
  def setup_description(description)
265
365
  @description = !description.nil? && description.empty? ? nil : description
266
366
  end
267
367
 
368
+ # @author Maxine Michalski
369
+ #
370
+ # Setup artist for post
371
+ #
372
+ # @param artists [Array<String>] array of artist names
373
+ # @api private
374
+ # @return [Array<E621::Artist>]
268
375
  def setup_artist(artists)
269
376
  @artists = artists.map { |a| E621::Artist.new(name: CGI.unescape(a)) }
270
377
  end
271
378
 
379
+ # @author Maxine Michalski
380
+ #
381
+ # Setup tags for post
382
+ # @param tags [String] String that contains tags, separated by spaces
383
+ # @api private
384
+ # @note These tags can only be read by #tags
385
+ # @return [Array<E621::Tag>
272
386
  def setup_tags(tags)
273
387
  @tags = tags.split(' ').map { |t| E621::Tag.new(name: t) }
274
388
  end
275
389
 
390
+ # @author Maxine Michalski
391
+ #
392
+ # Setup files for posts
393
+ # @param post [Hash] post data
394
+ # @api private
395
+ # @return [E621::Post::Image|E621::Post::Sample|E621::Post::Preview]
276
396
  def setup_files(post)
277
397
  return if post[:file_url].nil?
278
398
  @image = Image.new(url: post[:file_url], ext: post[:file_ext],