upload_image 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/upload/{image_forrest.rb → image_forest.rb} +8 -11
- data/lib/upload/version.rb +1 -1
- data/lib/upload_image.rb +1 -1
- data/upload_image.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2d9084dddec129195bfcf7bfea4fca05217bbe2
|
4
|
+
data.tar.gz: d839083369906b95cb17797df7ebacfc92063f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3afa2f55cbc80aba74fff79adb283322b4a570ab4c8028cb03871bbe7753a9d22970e05a71655609f90be5c293e66d56e6902efedd65bce0e52283fa7e6768
|
7
|
+
data.tar.gz: e75159736be3b0f37912a41d0223729aa8f4e4f9cbdf7818b23f097709b59d3e6cf87231288a7c227752ba15a4259cb6a3b1a0434fc2be0e5569a16e69f584d3
|
data/README.md
CHANGED
@@ -1,37 +1,34 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
|
3
3
|
module Upload
|
4
|
-
class
|
4
|
+
class ImageForest
|
5
5
|
HOST = "http://uploads.im/api"
|
6
6
|
|
7
|
-
attr_reader :image
|
7
|
+
attr_reader :image
|
8
8
|
|
9
|
-
# Public: Init a
|
9
|
+
# Public: Init a ImageForest Object
|
10
10
|
#
|
11
11
|
# path - Image's path, right now must be an absolute path
|
12
12
|
#
|
13
13
|
# Example
|
14
14
|
#
|
15
15
|
# path = '/Users/kevin/Desktop/image.jpeg'
|
16
|
-
#
|
16
|
+
# image_forest = ImageForest.new(path)
|
17
17
|
#
|
18
|
-
# Returns an
|
18
|
+
# Returns an ImageForest object
|
19
19
|
#
|
20
20
|
# TODO:
|
21
21
|
# - path can be a relative path
|
22
22
|
# - how about upload a list of images (idea)
|
23
|
-
def initialize(path
|
23
|
+
def initialize(path)
|
24
24
|
@image = Image.new(path)
|
25
|
-
@thumb_width = thumb_width
|
26
25
|
end
|
27
26
|
|
28
27
|
# Public: upload an image to HOST
|
29
28
|
#
|
30
|
-
# - Default thumb_width is 500
|
31
|
-
#
|
32
29
|
# Example
|
33
30
|
#
|
34
|
-
# Upload::
|
31
|
+
# Upload::ImageForest.new(path).upload
|
35
32
|
#
|
36
33
|
# Returns an Response object
|
37
34
|
# Can be Response::Failure and Response::Success
|
@@ -42,7 +39,7 @@ module Upload
|
|
42
39
|
def upload
|
43
40
|
return Response::Failure.new(nil, message: "File is not exist") unless @image.exist?
|
44
41
|
|
45
|
-
response = RestClient.post HOST, thumb_width:
|
42
|
+
response = RestClient.post HOST, thumb_width: '500', upload: @image.file
|
46
43
|
|
47
44
|
if response.code == 200
|
48
45
|
Response::Success.new(response)
|
data/lib/upload/version.rb
CHANGED
data/lib/upload_image.rb
CHANGED
data/upload_image.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upload_image
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duy Khoa
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.8'
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- bin/console
|
69
69
|
- bin/setup
|
70
70
|
- lib/upload/image.rb
|
71
|
-
- lib/upload/
|
71
|
+
- lib/upload/image_forest.rb
|
72
72
|
- lib/upload/response.rb
|
73
73
|
- lib/upload/response/failure.rb
|
74
74
|
- lib/upload/response/success.rb
|