upload_image 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/upload/image_forrest.rb +7 -4
- data/lib/upload/version.rb +1 -1
- data/upload_image.gemspec +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc2c849dfedbfd4fe881381039d0520c99b50150
|
4
|
+
data.tar.gz: f948d3ccc1952120fd1e43f8e273951262a467fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 225015e70e875e0a9ab0eb5857f60ab6ca39e80d4d4849342723de4c505a78172cc6957236c8e11365b65ae2367ad1598a721918dbfa1f1bf70a982af6836a0f
|
7
|
+
data.tar.gz: 385ac11d1c9a4069c35859ec59273293402da893f1bb79a3131d6bbb47b18ff418c31562fc445719d90663900885021785b85251e69569cf14df99a33bf0e906
|
data/lib/upload/image_forrest.rb
CHANGED
@@ -4,7 +4,7 @@ module Upload
|
|
4
4
|
class ImageForrest
|
5
5
|
HOST = "http://uploads.im/api"
|
6
6
|
|
7
|
-
attr_reader :image
|
7
|
+
attr_reader :image, :thumb_width
|
8
8
|
|
9
9
|
# Public: Init a ImageForrest Object
|
10
10
|
#
|
@@ -20,15 +20,18 @@ module Upload
|
|
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, thumb_width = "500")
|
24
24
|
@image = Image.new(path)
|
25
|
+
@thumb_width = thumb_width
|
25
26
|
end
|
26
27
|
|
27
28
|
# Public: upload an image to HOST
|
28
29
|
#
|
30
|
+
# - Default thumb_width is 500
|
31
|
+
#
|
29
32
|
# Example
|
30
33
|
#
|
31
|
-
# Upload::ImageForrest.new(path).upload
|
34
|
+
# Upload::ImageForrest.new(path).upload("700")
|
32
35
|
#
|
33
36
|
# Returns an Response object
|
34
37
|
# Can be Response::Failure and Response::Success
|
@@ -39,7 +42,7 @@ module Upload
|
|
39
42
|
def upload
|
40
43
|
return Response::Failure.new(nil, message: "File is not exist") unless @image.exist?
|
41
44
|
|
42
|
-
response = RestClient.post HOST, thumb_width:
|
45
|
+
response = RestClient.post HOST, thumb_width: thumb_width, upload: @image.file
|
43
46
|
|
44
47
|
if response.code == 200
|
45
48
|
Response::Success.new(response)
|
data/lib/upload/version.rb
CHANGED
data/upload_image.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duy Khoa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.8'
|
48
|
-
type: :
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -95,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.5.1
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: A tiny gem to upload image to upload.im
|
102
102
|
test_files: []
|
103
|
-
has_rdoc:
|