squash_uploader 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/squash/uploader.rb +14 -6
  2. metadata +19 -19
@@ -49,11 +49,11 @@ module Squash
49
49
  # when opening a connection to the Squash server.
50
50
  # @option options [Fixnum] :read_timeout (15) The number of seconds to wait
51
51
  # when waiting for data from the Squash server.
52
- # @option options [true, false] :skip_verification (false) If `true`, SSL peer
53
- # verification will not be performed.
54
- # @option options [Array<Class>] :success ([Net::HTTPSuccess]) A list of
55
- # subclasses of `Net::HTTPResponse` that are considered successful and will
56
- # not raise an exception.
52
+ # @option options [true, false] :skip_verification (false) If `true`, SSL
53
+ # peer verification will not be performed.
54
+ # @option options [Array<Class, Fixnum>] :success ([Net::HTTPSuccess]) A
55
+ # list of subclasses of `Net::HTTPResponse` or response codes that are
56
+ # considered successful and will not raise an exception.
57
57
 
58
58
  def initialize(host, options={})
59
59
  @host = host
@@ -100,7 +100,15 @@ module Squash
100
100
  request.body = body
101
101
  response = session.request(request)
102
102
 
103
- if options[:success].none? { |cl| response.kind_of?(cl) }
103
+ if options[:success].none? { |cl|
104
+ if cl.kind_of?(Class)
105
+ response.kind_of?(cl)
106
+ elsif cl.kind_of?(Fixnum) || cl.kind_of?(String)
107
+ response.code.to_i == cl.to_i
108
+ else
109
+ raise ArgumentError, "Unknown :success value #{cl}"
110
+ end
111
+ }
104
112
  raise "Unexpected response from Squash host: #{response.code}"
105
113
  end
106
114
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squash_uploader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Morgan
@@ -15,10 +15,9 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-07 00:00:00 Z
18
+ date: 2013-01-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
21
  requirement: &id001 !ruby/object:Gem::Requirement
23
22
  none: false
24
23
  requirements:
@@ -28,11 +27,11 @@ dependencies:
28
27
  segments:
29
28
  - 0
30
29
  version: "0"
31
- type: :runtime
32
- name: json
33
30
  version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
31
+ name: json
35
32
  prerelease: false
33
+ type: :runtime
34
+ - !ruby/object:Gem::Dependency
36
35
  requirement: &id002 !ruby/object:Gem::Requirement
37
36
  none: false
38
37
  requirements:
@@ -42,11 +41,11 @@ dependencies:
42
41
  segments:
43
42
  - 0
44
43
  version: "0"
45
- type: :development
46
- name: rspec
47
44
  version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
45
+ name: rspec
49
46
  prerelease: false
47
+ type: :development
48
+ - !ruby/object:Gem::Dependency
50
49
  requirement: &id003 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
@@ -56,11 +55,11 @@ dependencies:
56
55
  segments:
57
56
  - 0
58
57
  version: "0"
59
- type: :development
60
- name: yard
61
58
  version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
59
+ name: yard
63
60
  prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
64
63
  requirement: &id004 !ruby/object:Gem::Requirement
65
64
  none: false
66
65
  requirements:
@@ -70,11 +69,11 @@ dependencies:
70
69
  segments:
71
70
  - 0
72
71
  version: "0"
73
- type: :development
74
- name: redcarpet
75
72
  version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
73
+ name: redcarpet
77
74
  prerelease: false
75
+ type: :development
76
+ - !ruby/object:Gem::Dependency
78
77
  requirement: &id005 !ruby/object:Gem::Requirement
79
78
  none: false
80
79
  requirements:
@@ -84,9 +83,10 @@ dependencies:
84
83
  segments:
85
84
  - 0
86
85
  version: "0"
87
- type: :development
88
- name: jeweler
89
86
  version_requirements: *id005
87
+ name: jeweler
88
+ prerelease: false
89
+ type: :development
90
90
  description: Shared library amongst all gems relating to Squash that handles communication with a Squash install.
91
91
  email: tim@squareup.com
92
92
  executables: []