faraday 0.9.0.rc7 → 0.9.0

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: ca7a6a74fd366e7546ba28ccb1c27483fdfb6447
4
- data.tar.gz: 991320c247d7c297118ab9bbf66c4abbfe141ec5
3
+ metadata.gz: 0e442daff424089e143751d7cb1d684c169bf4fc
4
+ data.tar.gz: ba1dd50171576d5064350e48b8869364c0710a26
5
5
  SHA512:
6
- metadata.gz: 54db2e8aeeae9dae10066a17642533230a58ef76ea25036428dbf053af9b9ed0fe98f83acaa36bdeaf3e84c30ccb679410ed9e1203b3133ce0de94f1febbae8b
7
- data.tar.gz: e6fad8763e2b855fcc9341d314776bfebe162d070be92b566b48eec569732ce35718d0a4a4d920f46fd8e82c6ce308d4c4e176a13678a147f14cd55c73aef7b3
6
+ metadata.gz: 80c7a955f7d0a2217fcde0be2760649b9e5fc2d950929b118383ba61ea7282410b224315e289b40fec12be13898b0b00551e441704462ac39269368a8f9d5931
7
+ data.tar.gz: cdef47ebdb9519d0e45e7511326ed1368fa520ad314a4055ea154187193c967f8821573705161e3bbca5d3cbbf40f219071223ba8d24821c5dd89e37ddd16a9e
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ group :test do
12
12
  gem 'httpclient', '>= 2.2'
13
13
  gem 'leftright', '>= 0.9', :require => false
14
14
  gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
15
- gem 'minitest', '~> 5.0.5'
15
+ gem 'minitest', '>= 5.0.5'
16
16
  gem 'net-http-persistent', '>= 2.5', :require => false
17
17
  gem 'patron', '>= 0.4.2', :platforms => :ruby
18
18
  gem 'rack-test', '>= 0.6', :require => 'rack/test'
@@ -14,7 +14,7 @@ require 'forwardable'
14
14
  # conn.get '/'
15
15
  #
16
16
  module Faraday
17
- VERSION = "0.9.0.rc7"
17
+ VERSION = "0.9.0"
18
18
 
19
19
  class << self
20
20
  # Public: Gets or sets the root path that Faraday is being loaded from.
@@ -9,6 +9,7 @@ module Faraday
9
9
 
10
10
  # Public
11
11
  def each
12
+ return to_enum(:each) unless block_given?
12
13
  members.each do |key|
13
14
  yield(key.to_sym, send(key))
14
15
  end
@@ -41,6 +42,11 @@ module Faraday
41
42
  value
42
43
  end
43
44
 
45
+ # Public
46
+ def clear
47
+ members.each { |member| delete(member) }
48
+ end
49
+
44
50
  # Public
45
51
  def merge(value)
46
52
  dup.update(value)
@@ -68,9 +74,44 @@ module Faraday
68
74
 
69
75
  # Public
70
76
  def keys
71
- members.reject { |m| send(m).nil? }
77
+ members.reject { |member| send(member).nil? }
78
+ end
79
+
80
+ # Public
81
+ def empty?
82
+ keys.empty?
83
+ end
84
+
85
+ # Public
86
+ def each_key
87
+ return to_enum(:each_key) unless block_given?
88
+ keys.each do |key|
89
+ yield(key)
90
+ end
91
+ end
92
+
93
+ # Public
94
+ def key?(key)
95
+ keys.include?(key)
72
96
  end
73
97
 
98
+ alias has_key? key?
99
+
100
+ # Public
101
+ def each_value
102
+ return to_enum(:each_value) unless block_given?
103
+ values.each do |value|
104
+ yield(value)
105
+ end
106
+ end
107
+
108
+ # Public
109
+ def value?(value)
110
+ values.include?(value)
111
+ end
112
+
113
+ alias has_value? value?
114
+
74
115
  # Public
75
116
  def to_hash
76
117
  hash = {}
@@ -84,9 +125,9 @@ module Faraday
84
125
  # Internal
85
126
  def inspect
86
127
  values = []
87
- members.each do |m|
88
- value = send(m)
89
- values << "#{m}=#{value.inspect}" if value
128
+ members.each do |member|
129
+ value = send(member)
130
+ values << "#{member}=#{value.inspect}" if value
90
131
  end
91
132
  values = values.empty? ? ' (empty)' : (' ' << values.join(", "))
92
133
 
@@ -6,6 +6,56 @@ class OptionsTest < Faraday::TestCase
6
6
  options :c => SubOptions
7
7
  end
8
8
 
9
+ def test_clear
10
+ options = SubOptions.new(1)
11
+ assert !options.empty?
12
+ assert options.clear
13
+ assert options.empty?
14
+ end
15
+
16
+ def test_empty
17
+ options = SubOptions.new
18
+ assert options.empty?
19
+ options.sub = 1
20
+ assert !options.empty?
21
+ options.delete(:sub)
22
+ assert options.empty?
23
+ end
24
+
25
+ def test_each_key
26
+ options = ParentOptions.new(1, 2, 3)
27
+ enum = options.each_key
28
+ assert_equal enum.next.to_sym, :a
29
+ assert_equal enum.next.to_sym, :b
30
+ assert_equal enum.next.to_sym, :c
31
+ end
32
+
33
+ def test_key?
34
+ options = SubOptions.new
35
+ assert !options.key?(:sub)
36
+ options.sub = 1
37
+ if RUBY_VERSION >= '1.9'
38
+ assert options.key?(:sub)
39
+ else
40
+ assert options.key?("sub")
41
+ end
42
+ end
43
+
44
+ def test_each_value
45
+ options = ParentOptions.new(1, 2, 3)
46
+ enum = options.each_value
47
+ assert_equal enum.next, 1
48
+ assert_equal enum.next, 2
49
+ assert_equal enum.next, 3
50
+ end
51
+
52
+ def test_value?
53
+ options = SubOptions.new
54
+ assert !options.value?(1)
55
+ options.sub = 1
56
+ assert options.value?(1)
57
+ end
58
+
9
59
  def test_request_proxy_setter
10
60
  options = Faraday::RequestOptions.new
11
61
  assert_nil options.proxy
@@ -48,7 +98,7 @@ class OptionsTest < Faraday::TestCase
48
98
  end
49
99
 
50
100
  def test_from_options
51
- options = ParentOptions.new 1
101
+ options = ParentOptions.new(1)
52
102
 
53
103
  value = ParentOptions.from(options)
54
104
  assert_equal 1, value.a
@@ -56,7 +106,7 @@ class OptionsTest < Faraday::TestCase
56
106
  end
57
107
 
58
108
  def test_from_options_with_sub_object
59
- sub = SubOptions.new 1
109
+ sub = SubOptions.new(1)
60
110
  options = ParentOptions.from :a => 1, :c => sub
61
111
  assert_kind_of ParentOptions, options
62
112
  assert_equal 1, options.a
@@ -115,7 +165,7 @@ class OptionsTest < Faraday::TestCase
115
165
  end
116
166
 
117
167
  def test_update
118
- options = ParentOptions.new 1
168
+ options = ParentOptions.new(1)
119
169
  assert_equal 1, options.a
120
170
  assert_nil options.b
121
171
 
@@ -126,14 +176,14 @@ class OptionsTest < Faraday::TestCase
126
176
  end
127
177
 
128
178
  def test_delete
129
- options = ParentOptions.new 1
179
+ options = ParentOptions.new(1)
130
180
  assert_equal 1, options.a
131
181
  assert_equal 1, options.delete(:a)
132
182
  assert_nil options.a
133
183
  end
134
184
 
135
185
  def test_merge
136
- options = ParentOptions.new 1
186
+ options = ParentOptions.new(1)
137
187
  assert_equal 1, options.a
138
188
  assert_nil options.b
139
189
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.rc7
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -142,9 +142,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - ">"
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
- version: 1.3.1
147
+ version: 1.3.5
148
148
  requirements: []
149
149
  rubyforge_project:
150
150
  rubygems_version: 2.2.0