upload_image 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78e861f996fd0124046ad04dfed36acddfccfa35
4
- data.tar.gz: e693f1206acbe16e511dd2a4dae2628b747d0b6b
3
+ metadata.gz: c2d9084dddec129195bfcf7bfea4fca05217bbe2
4
+ data.tar.gz: d839083369906b95cb17797df7ebacfc92063f85
5
5
  SHA512:
6
- metadata.gz: b0d168d1818f27b2a3a0bff15035a0e2892e87b66b692e73a5940edbf43d2432818b91bc5f8ab5fe75cc643b622732df49a268de5a5c86bd48410f2a35e9561f
7
- data.tar.gz: a440a010ae50406c24884f4cd1dd5ddf599b88ab9538f1298a61b0d2c731e8856f01c35d166a7f0a6982fdd1145a4a481d108560faeade62b701f9b0a22b6eab
6
+ metadata.gz: 9e3afa2f55cbc80aba74fff79adb283322b4a570ab4c8028cb03871bbe7753a9d22970e05a71655609f90be5c293e66d56e6902efedd65bce0e52283fa7e6768
7
+ data.tar.gz: e75159736be3b0f37912a41d0223729aa8f4e4f9cbdf7818b23f097709b59d3e6cf87231288a7c227752ba15a4259cb6a3b1a0434fc2be0e5569a16e69f584d3
data/README.md CHANGED
@@ -25,7 +25,7 @@ Or install it yourself as:
25
25
  ```ruby
26
26
  require 'upload_image'
27
27
 
28
- Upload::ImageForrest.new("/path/to/image").upload
28
+ Upload::ImageForest.new("/path/to/image").upload
29
29
  ```
30
30
 
31
31
  ## Development
@@ -1,37 +1,34 @@
1
1
  require 'rest-client'
2
2
 
3
3
  module Upload
4
- class ImageForrest
4
+ class ImageForest
5
5
  HOST = "http://uploads.im/api"
6
6
 
7
- attr_reader :image, :thumb_width
7
+ attr_reader :image
8
8
 
9
- # Public: Init a ImageForrest Object
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
- # image_forrest = ImageForrest.new(path)
16
+ # image_forest = ImageForest.new(path)
17
17
  #
18
- # Returns an ImageForrest object
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, thumb_width = "500")
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::ImageForrest.new(path).upload("700")
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: thumb_width, upload: @image.file
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)
@@ -1,3 +1,3 @@
1
1
  module UploadImage
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/upload_image.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
2
2
 
3
3
  require "upload/version"
4
- require "upload/image_forrest"
4
+ require "upload/image_forest"
5
5
  require "upload/image"
6
6
  require "upload/response"
7
7
 
data/upload_image.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler"
23
23
  spec.add_development_dependency "rake"
24
- spec.add_runtime_dependency "rest-client", "~> 1.8"
24
+ spec.add_development_dependency "rest-client", "~> 1.8"
25
25
  end
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.3
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: :runtime
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/image_forrest.rb
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