upload_image 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5483fa578f38ce8b4e8f869b2e2ee42c60c2b16
4
- data.tar.gz: de22b2a226c5f36eacded6a5f139d3d4fdff9e53
3
+ metadata.gz: fc2c849dfedbfd4fe881381039d0520c99b50150
4
+ data.tar.gz: f948d3ccc1952120fd1e43f8e273951262a467fa
5
5
  SHA512:
6
- metadata.gz: fc82c708ee951023c87d88714317e4a1d64ab1073537a05b66abeda81bd996ce38efa0e1b474ed08c9d9a1f1f40eb2fad28ea618e63a6c7bbfe67bf1a8800983
7
- data.tar.gz: 02f7d7a8460b6302c1633a57717440bf3d6e24e344686dbec986c849c2ad5cce9b9ec28c4e7187d1384d6abb3fbcd4d72f231fa516886833cf84ca9d3809223e
6
+ metadata.gz: 225015e70e875e0a9ab0eb5857f60ab6ca39e80d4d4849342723de4c505a78172cc6957236c8e11365b65ae2367ad1598a721918dbfa1f1bf70a982af6836a0f
7
+ data.tar.gz: 385ac11d1c9a4069c35859ec59273293402da893f1bb79a3131d6bbb47b18ff418c31562fc445719d90663900885021785b85251e69569cf14df99a33bf0e906
@@ -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: '500', upload: @image.file
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)
@@ -1,3 +1,3 @@
1
1
  module UploadImage
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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_development_dependency "rest-client", "~> 1.8"
24
+ spec.add_runtime_dependency "rest-client", "~> 1.8"
25
25
  end
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.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: 2015-11-22 00:00:00.000000000 Z
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: :development
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.4.6
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: