httparty 0.13.7 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of httparty might be problematic. Click here for more details.

Files changed (101) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +18 -0
  3. data/.github/workflows/ci.yml +23 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop_todo.yml +1 -1
  6. data/{History → Changelog.md} +220 -59
  7. data/Gemfile +8 -3
  8. data/README.md +8 -7
  9. data/bin/httparty +3 -1
  10. data/docs/README.md +171 -0
  11. data/examples/README.md +34 -12
  12. data/examples/aaws.rb +7 -3
  13. data/examples/body_stream.rb +14 -0
  14. data/examples/crack.rb +1 -1
  15. data/examples/custom_parsers.rb +5 -1
  16. data/examples/delicious.rb +4 -4
  17. data/examples/headers_and_user_agents.rb +7 -3
  18. data/examples/idn.rb +10 -0
  19. data/examples/logging.rb +4 -4
  20. data/examples/microsoft_graph.rb +52 -0
  21. data/examples/multipart.rb +22 -0
  22. data/examples/peer_cert.rb +9 -0
  23. data/examples/stackexchange.rb +1 -1
  24. data/examples/stream_download.rb +26 -0
  25. data/examples/tripit_sign_in.rb +17 -6
  26. data/examples/twitter.rb +2 -2
  27. data/examples/whoismyrep.rb +1 -1
  28. data/httparty.gemspec +7 -5
  29. data/lib/httparty/connection_adapter.rb +86 -20
  30. data/lib/httparty/cookie_hash.rb +10 -8
  31. data/lib/httparty/decompressor.rb +92 -0
  32. data/lib/httparty/exceptions.rb +8 -2
  33. data/lib/httparty/hash_conversions.rb +30 -8
  34. data/lib/httparty/headers_processor.rb +32 -0
  35. data/lib/httparty/logger/apache_formatter.rb +31 -6
  36. data/lib/httparty/logger/curl_formatter.rb +68 -23
  37. data/lib/httparty/logger/logger.rb +5 -1
  38. data/lib/httparty/logger/logstash_formatter.rb +61 -0
  39. data/lib/httparty/module_inheritable_attributes.rb +6 -4
  40. data/lib/httparty/net_digest_auth.rb +23 -21
  41. data/lib/httparty/parser.rb +25 -14
  42. data/lib/httparty/request/body.rb +98 -0
  43. data/lib/httparty/request/multipart_boundary.rb +13 -0
  44. data/lib/httparty/request.rb +156 -106
  45. data/lib/httparty/response/headers.rb +23 -19
  46. data/lib/httparty/response.rb +92 -13
  47. data/lib/httparty/response_fragment.rb +21 -0
  48. data/lib/httparty/text_encoder.rb +72 -0
  49. data/lib/httparty/utils.rb +13 -0
  50. data/lib/httparty/version.rb +3 -1
  51. data/lib/httparty.rb +98 -34
  52. data/website/css/common.css +1 -1
  53. metadata +34 -113
  54. data/.travis.yml +0 -7
  55. data/features/basic_authentication.feature +0 -20
  56. data/features/command_line.feature +0 -95
  57. data/features/deals_with_http_error_codes.feature +0 -26
  58. data/features/digest_authentication.feature +0 -30
  59. data/features/handles_compressed_responses.feature +0 -27
  60. data/features/handles_multiple_formats.feature +0 -57
  61. data/features/steps/env.rb +0 -27
  62. data/features/steps/httparty_response_steps.rb +0 -52
  63. data/features/steps/httparty_steps.rb +0 -43
  64. data/features/steps/mongrel_helper.rb +0 -127
  65. data/features/steps/remote_service_steps.rb +0 -90
  66. data/features/supports_read_timeout_option.feature +0 -13
  67. data/features/supports_redirection.feature +0 -22
  68. data/features/supports_timeout_option.feature +0 -13
  69. data/spec/fixtures/delicious.xml +0 -23
  70. data/spec/fixtures/empty.xml +0 -0
  71. data/spec/fixtures/google.html +0 -3
  72. data/spec/fixtures/ssl/generate.sh +0 -29
  73. data/spec/fixtures/ssl/generated/1fe462c2.0 +0 -16
  74. data/spec/fixtures/ssl/generated/bogushost.crt +0 -13
  75. data/spec/fixtures/ssl/generated/ca.crt +0 -16
  76. data/spec/fixtures/ssl/generated/ca.key +0 -15
  77. data/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
  78. data/spec/fixtures/ssl/generated/server.crt +0 -13
  79. data/spec/fixtures/ssl/generated/server.key +0 -15
  80. data/spec/fixtures/ssl/openssl-exts.cnf +0 -9
  81. data/spec/fixtures/twitter.csv +0 -2
  82. data/spec/fixtures/twitter.json +0 -1
  83. data/spec/fixtures/twitter.xml +0 -403
  84. data/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
  85. data/spec/httparty/connection_adapter_spec.rb +0 -468
  86. data/spec/httparty/cookie_hash_spec.rb +0 -83
  87. data/spec/httparty/exception_spec.rb +0 -38
  88. data/spec/httparty/hash_conversions_spec.rb +0 -41
  89. data/spec/httparty/logger/apache_formatter_spec.rb +0 -41
  90. data/spec/httparty/logger/curl_formatter_spec.rb +0 -18
  91. data/spec/httparty/logger/logger_spec.rb +0 -38
  92. data/spec/httparty/net_digest_auth_spec.rb +0 -230
  93. data/spec/httparty/parser_spec.rb +0 -173
  94. data/spec/httparty/request_spec.rb +0 -1073
  95. data/spec/httparty/response_spec.rb +0 -241
  96. data/spec/httparty/ssl_spec.rb +0 -74
  97. data/spec/httparty_spec.rb +0 -850
  98. data/spec/spec_helper.rb +0 -59
  99. data/spec/support/ssl_test_helper.rb +0 -47
  100. data/spec/support/ssl_test_server.rb +0 -80
  101. data/spec/support/stub_response.rb +0 -49
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HTTParty
4
+ class TextEncoder
5
+ attr_reader :text, :content_type, :assume_utf16_is_big_endian
6
+
7
+ def initialize(text, assume_utf16_is_big_endian: true, content_type: nil)
8
+ @text = text.dup
9
+ @content_type = content_type
10
+ @assume_utf16_is_big_endian = assume_utf16_is_big_endian
11
+ end
12
+
13
+ def call
14
+ if can_encode?
15
+ encoded_text
16
+ else
17
+ text
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def can_encode?
24
+ ''.respond_to?(:encoding) && charset
25
+ end
26
+
27
+ def encoded_text
28
+ if 'utf-16'.casecmp(charset) == 0
29
+ encode_utf_16
30
+ else
31
+ encode_with_ruby_encoding
32
+ end
33
+ end
34
+
35
+ def encode_utf_16
36
+ if text.bytesize >= 2
37
+ if text.getbyte(0) == 0xFF && text.getbyte(1) == 0xFE
38
+ return text.force_encoding('UTF-16LE')
39
+ elsif text.getbyte(0) == 0xFE && text.getbyte(1) == 0xFF
40
+ return text.force_encoding('UTF-16BE')
41
+ end
42
+ end
43
+
44
+ if assume_utf16_is_big_endian # option
45
+ text.force_encoding('UTF-16BE')
46
+ else
47
+ text.force_encoding('UTF-16LE')
48
+ end
49
+ end
50
+
51
+ def encode_with_ruby_encoding
52
+ # NOTE: This will raise an argument error if the
53
+ # charset does not exist
54
+ encoding = Encoding.find(charset)
55
+ text.force_encoding(encoding.to_s)
56
+ rescue ArgumentError
57
+ text
58
+ end
59
+
60
+ def charset
61
+ return nil if content_type.nil?
62
+
63
+ if (matchdata = content_type.match(/;\s*charset\s*=\s*([^=,;"\s]+)/i))
64
+ return matchdata.captures.first
65
+ end
66
+
67
+ if (matchdata = content_type.match(/;\s*charset\s*=\s*"((\\.|[^\\"])+)"/i))
68
+ return matchdata.captures.first.gsub(/\\(.)/, '\1')
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HTTParty
4
+ module Utils
5
+ def self.stringify_keys(hash)
6
+ return hash.transform_keys(&:to_s) if hash.respond_to?(:transform_keys)
7
+
8
+ hash.each_with_object({}) do |(key, value), new_hash|
9
+ new_hash[key.to_s] = value
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HTTParty
2
- VERSION = "0.13.7"
4
+ VERSION = '0.20.0'
3
5
  end
data/lib/httparty.rb CHANGED
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'net/http'
3
5
  require 'net/https'
4
6
  require 'uri'
5
7
  require 'zlib'
6
8
  require 'multi_xml'
9
+ require 'mime/types'
7
10
  require 'json'
8
11
  require 'csv'
9
- require 'erb'
10
12
 
11
13
  require 'httparty/module_inheritable_attributes'
12
14
  require 'httparty/cookie_hash'
@@ -14,6 +16,11 @@ require 'httparty/net_digest_auth'
14
16
  require 'httparty/version'
15
17
  require 'httparty/connection_adapter'
16
18
  require 'httparty/logger/logger'
19
+ require 'httparty/request/body'
20
+ require 'httparty/response_fragment'
21
+ require 'httparty/decompressor'
22
+ require 'httparty/text_encoder'
23
+ require 'httparty/headers_processor'
17
24
 
18
25
  # @see HTTParty::ClassMethods
19
26
  module HTTParty
@@ -22,8 +29,8 @@ module HTTParty
22
29
  base.send :include, ModuleInheritableAttributes
23
30
  base.send(:mattr_inheritable, :default_options)
24
31
  base.send(:mattr_inheritable, :default_cookies)
25
- base.instance_variable_set("@default_options", {})
26
- base.instance_variable_set("@default_cookies", CookieHash.new)
32
+ base.instance_variable_set(:@default_options, {})
33
+ base.instance_variable_set(:@default_cookies, CookieHash.new)
27
34
  end
28
35
 
29
36
  # == Common Request Options
@@ -37,10 +44,11 @@ module HTTParty
37
44
  # [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
38
45
  # [:+query+:] Query string, or an object that responds to #to_hash representing it. Normalized according to the same rules as :+body+. If you specify this on a POST, you must use an object which responds to #to_hash. See also HTTParty::ClassMethods.default_params.
39
46
  # [:+timeout+:] Timeout for opening connection and reading data.
40
- # [:+local_host:] Local address to bind to before connecting.
41
- # [:+local_port:] Local port to bind to before connecting.
42
- # [:+body_steam:] Allow streaming to a REST server to specify a body_stream.
43
- # [:+stream_body:] Allow for streaming large files without loading them into memory.
47
+ # [:+local_host+:] Local address to bind to before connecting.
48
+ # [:+local_port+:] Local port to bind to before connecting.
49
+ # [:+body_stream+:] Allow streaming to a REST server to specify a body_stream.
50
+ # [:+stream_body+:] Allow for streaming large files without loading them into memory.
51
+ # [:+multipart+:] Force content-type to be multipart
44
52
  #
45
53
  # There are also another set of options with names corresponding to various class methods. The methods in question are those that let you set a class-wide default, and the options override the defaults on a request-by-request basis. Those options are:
46
54
  # * :+base_uri+: see HTTParty::ClassMethods.base_uri.
@@ -72,6 +80,16 @@ module HTTParty
72
80
  default_options[:log_format] = format
73
81
  end
74
82
 
83
+ # Raises HTTParty::ResponseError if response's code matches this statuses
84
+ #
85
+ # class Foo
86
+ # include HTTParty
87
+ # raise_on [404, 500]
88
+ # end
89
+ def raise_on(codes = [])
90
+ default_options[:raise_on] = *codes
91
+ end
92
+
75
93
  # Allows setting http proxy information to be used
76
94
  #
77
95
  # class Foo
@@ -118,7 +136,7 @@ module HTTParty
118
136
  end
119
137
 
120
138
  # Do not send rails style query strings.
121
- # Specically, don't use bracket notation when sending an array
139
+ # Specifically, don't use bracket notation when sending an array
122
140
  #
123
141
  # For a query:
124
142
  # get '/', query: {selected_ids: [1,2,3]}
@@ -147,7 +165,7 @@ module HTTParty
147
165
  # default_params api_key: 'secret', another: 'foo'
148
166
  # end
149
167
  def default_params(h = {})
150
- raise ArgumentError, 'Default params must an object which respond to #to_hash' unless h.respond_to?(:to_hash)
168
+ raise ArgumentError, 'Default params must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
151
169
  default_options[:default_params] ||= {}
152
170
  default_options[:default_params].merge!(h)
153
171
  end
@@ -159,9 +177,9 @@ module HTTParty
159
177
  # include HTTParty
160
178
  # default_timeout 10
161
179
  # end
162
- def default_timeout(t)
163
- raise ArgumentError, 'Timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
164
- default_options[:timeout] = t
180
+ def default_timeout(value)
181
+ validate_timeout_argument(__method__, value)
182
+ default_options[:timeout] = value
165
183
  end
166
184
 
167
185
  # Allows setting a default open_timeout for all HTTP calls in seconds
@@ -170,9 +188,9 @@ module HTTParty
170
188
  # include HTTParty
171
189
  # open_timeout 10
172
190
  # end
173
- def open_timeout(t)
174
- raise ArgumentError, 'open_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
175
- default_options[:open_timeout] = t
191
+ def open_timeout(value)
192
+ validate_timeout_argument(__method__, value)
193
+ default_options[:open_timeout] = value
176
194
  end
177
195
 
178
196
  # Allows setting a default read_timeout for all HTTP calls in seconds
@@ -181,11 +199,24 @@ module HTTParty
181
199
  # include HTTParty
182
200
  # read_timeout 10
183
201
  # end
184
- def read_timeout(t)
185
- raise ArgumentError, 'read_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
186
- default_options[:read_timeout] = t
202
+ def read_timeout(value)
203
+ validate_timeout_argument(__method__, value)
204
+ default_options[:read_timeout] = value
205
+ end
206
+
207
+ # Allows setting a default write_timeout for all HTTP calls in seconds
208
+ # Supported by Ruby > 2.6.0
209
+ #
210
+ # class Foo
211
+ # include HTTParty
212
+ # write_timeout 10
213
+ # end
214
+ def write_timeout(value)
215
+ validate_timeout_argument(__method__, value)
216
+ default_options[:write_timeout] = value
187
217
  end
188
218
 
219
+
189
220
  # Set an output stream for debugging, defaults to $stderr.
190
221
  # The output stream is passed on to Net::HTTP#set_debug_output.
191
222
  #
@@ -203,14 +234,18 @@ module HTTParty
203
234
  # include HTTParty
204
235
  # headers 'Accept' => 'text/html'
205
236
  # end
206
- def headers(h = {})
207
- raise ArgumentError, 'Headers must an object which responds to #to_hash' unless h.respond_to?(:to_hash)
208
- default_options[:headers] ||= {}
209
- default_options[:headers].merge!(h.to_hash)
237
+ def headers(h = nil)
238
+ if h
239
+ raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
240
+ default_options[:headers] ||= {}
241
+ default_options[:headers].merge!(h.to_hash)
242
+ else
243
+ default_options[:headers] || {}
244
+ end
210
245
  end
211
246
 
212
247
  def cookies(h = {})
213
- raise ArgumentError, 'Cookies must an object which respond to #to_hash' unless h.respond_to?(:to_hash)
248
+ raise ArgumentError, 'Cookies must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
214
249
  default_cookies.add_cookies(h)
215
250
  end
216
251
 
@@ -367,6 +402,22 @@ module HTTParty
367
402
  default_options[:ssl_version] = version
368
403
  end
369
404
 
405
+ # Deactivate automatic decompression of the response body.
406
+ # This will require you to explicitly handle body decompression
407
+ # by inspecting the Content-Encoding response header.
408
+ #
409
+ # Refer to docs/README.md "HTTP Compression" section for
410
+ # further details.
411
+ #
412
+ # @example
413
+ # class Foo
414
+ # include HTTParty
415
+ # skip_decompression
416
+ # end
417
+ def skip_decompression(value = true)
418
+ default_options[:skip_decompression] = !!value
419
+ end
420
+
370
421
  # Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
371
422
  # You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
372
423
  # You also can specify a cipher suite here, listed here at openssl.org:
@@ -486,7 +537,7 @@ module HTTParty
486
537
  # Foo.post('http://foo.com/resources', body: {bar: 'baz'})
487
538
  #
488
539
  # # Simple post with full url using :query option,
489
- # # which gets set as form data on the request.
540
+ # # which appends the parameters to the URI.
490
541
  # Foo.post('http://foo.com/resources', query: {bar: 'baz'})
491
542
  def post(path, options = {}, &block)
492
543
  perform_request Net::HTTP::Post, path, options, &block
@@ -528,38 +579,50 @@ module HTTParty
528
579
  perform_request Net::HTTP::Options, path, options, &block
529
580
  end
530
581
 
582
+ # Perform a MKCOL request to a path
583
+ def mkcol(path, options = {}, &block)
584
+ perform_request Net::HTTP::Mkcol, path, options, &block
585
+ end
586
+
587
+ def lock(path, options = {}, &block)
588
+ perform_request Net::HTTP::Lock, path, options, &block
589
+ end
590
+
591
+ def unlock(path, options = {}, &block)
592
+ perform_request Net::HTTP::Unlock, path, options, &block
593
+ end
594
+
531
595
  attr_reader :default_options
532
596
 
533
597
  private
534
598
 
599
+ def validate_timeout_argument(timeout_type, value)
600
+ raise ArgumentError, "#{ timeout_type } must be an integer or float" unless value && (value.is_a?(Integer) || value.is_a?(Float))
601
+ end
602
+
535
603
  def ensure_method_maintained_across_redirects(options)
536
- unless options.has_key? :maintain_method_across_redirects
604
+ unless options.key?(:maintain_method_across_redirects)
537
605
  options[:maintain_method_across_redirects] = true
538
606
  end
539
607
  end
540
608
 
541
609
  def perform_request(http_method, path, options, &block) #:nodoc:
542
610
  options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
543
- process_headers(options)
611
+ HeadersProcessor.new(headers, options).call
544
612
  process_cookies(options)
545
613
  Request.new(http_method, path, options).perform(&block)
546
614
  end
547
615
 
548
- def process_headers(options)
549
- if options[:headers] && headers.any?
550
- options[:headers] = headers.merge(options[:headers])
551
- end
552
- end
553
-
554
616
  def process_cookies(options) #:nodoc:
555
617
  return unless options[:cookies] || default_cookies.any?
556
618
  options[:headers] ||= headers.dup
557
- options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
619
+ options[:headers]['cookie'] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
558
620
  end
559
621
 
560
622
  def validate_format
561
623
  if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format)
562
- raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map(&:to_s).sort.join(', ')}"
624
+ supported_format_names = parser.supported_formats.map(&:to_s).sort.join(', ')
625
+ raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{supported_format_names}"
563
626
  end
564
627
  end
565
628
  end
@@ -617,6 +680,7 @@ module HTTParty
617
680
  end
618
681
 
619
682
  require 'httparty/hash_conversions'
683
+ require 'httparty/utils'
620
684
  require 'httparty/exceptions'
621
685
  require 'httparty/parser'
622
686
  require 'httparty/request'
@@ -8,7 +8,7 @@
8
8
  body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
9
9
  body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
10
10
  /* end of yahoo reset and fonts */
11
-
11
+
12
12
  body {color:#333; background:#4b1a1a; line-height:1.3;}
13
13
  p {margin:0 0 20px;}
14
14
  a {color:#4b1a1a;}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.7
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -9,36 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-23 00:00:00.000000000 Z
12
+ date: 2021-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: json
15
+ name: multi_xml
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '1.8'
20
+ version: 0.5.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '1.8'
27
+ version: 0.5.2
28
28
  - !ruby/object:Gem::Dependency
29
- name: multi_xml
29
+ name: mime-types
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.5.2
34
+ version: '3.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.5.2
41
+ version: '3.0'
42
42
  description: Makes http fun! Also, makes consuming restful web services dead easy.
43
43
  email:
44
44
  - nunemaker@gmail.com
@@ -47,103 +47,72 @@ executables:
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - ".editorconfig"
51
+ - ".github/workflows/ci.yml"
50
52
  - ".gitignore"
51
53
  - ".rubocop.yml"
52
54
  - ".rubocop_todo.yml"
53
55
  - ".simplecov"
54
- - ".travis.yml"
55
56
  - CONTRIBUTING.md
57
+ - Changelog.md
56
58
  - Gemfile
57
59
  - Guardfile
58
- - History
59
60
  - MIT-LICENSE
60
61
  - README.md
61
62
  - Rakefile
62
63
  - bin/httparty
63
64
  - cucumber.yml
65
+ - docs/README.md
64
66
  - examples/README.md
65
67
  - examples/aaws.rb
66
68
  - examples/basic.rb
69
+ - examples/body_stream.rb
67
70
  - examples/crack.rb
68
71
  - examples/custom_parsers.rb
69
72
  - examples/delicious.rb
70
73
  - examples/google.rb
71
74
  - examples/headers_and_user_agents.rb
75
+ - examples/idn.rb
72
76
  - examples/logging.rb
77
+ - examples/microsoft_graph.rb
78
+ - examples/multipart.rb
73
79
  - examples/nokogiri_html_parser.rb
80
+ - examples/peer_cert.rb
74
81
  - examples/rescue_json.rb
75
82
  - examples/rubyurl.rb
76
83
  - examples/stackexchange.rb
84
+ - examples/stream_download.rb
77
85
  - examples/tripit_sign_in.rb
78
86
  - examples/twitter.rb
79
87
  - examples/whoismyrep.rb
80
- - features/basic_authentication.feature
81
- - features/command_line.feature
82
- - features/deals_with_http_error_codes.feature
83
- - features/digest_authentication.feature
84
- - features/handles_compressed_responses.feature
85
- - features/handles_multiple_formats.feature
86
- - features/steps/env.rb
87
- - features/steps/httparty_response_steps.rb
88
- - features/steps/httparty_steps.rb
89
- - features/steps/mongrel_helper.rb
90
- - features/steps/remote_service_steps.rb
91
- - features/supports_read_timeout_option.feature
92
- - features/supports_redirection.feature
93
- - features/supports_timeout_option.feature
94
88
  - httparty.gemspec
95
89
  - lib/httparty.rb
96
90
  - lib/httparty/connection_adapter.rb
97
91
  - lib/httparty/cookie_hash.rb
92
+ - lib/httparty/decompressor.rb
98
93
  - lib/httparty/exceptions.rb
99
94
  - lib/httparty/hash_conversions.rb
95
+ - lib/httparty/headers_processor.rb
100
96
  - lib/httparty/logger/apache_formatter.rb
101
97
  - lib/httparty/logger/curl_formatter.rb
102
98
  - lib/httparty/logger/logger.rb
99
+ - lib/httparty/logger/logstash_formatter.rb
103
100
  - lib/httparty/module_inheritable_attributes.rb
104
101
  - lib/httparty/net_digest_auth.rb
105
102
  - lib/httparty/parser.rb
106
103
  - lib/httparty/request.rb
104
+ - lib/httparty/request/body.rb
105
+ - lib/httparty/request/multipart_boundary.rb
107
106
  - lib/httparty/response.rb
108
107
  - lib/httparty/response/headers.rb
108
+ - lib/httparty/response_fragment.rb
109
+ - lib/httparty/text_encoder.rb
110
+ - lib/httparty/utils.rb
109
111
  - lib/httparty/version.rb
110
112
  - script/release
111
- - spec/fixtures/delicious.xml
112
- - spec/fixtures/empty.xml
113
- - spec/fixtures/google.html
114
- - spec/fixtures/ssl/generate.sh
115
- - spec/fixtures/ssl/generated/1fe462c2.0
116
- - spec/fixtures/ssl/generated/bogushost.crt
117
- - spec/fixtures/ssl/generated/ca.crt
118
- - spec/fixtures/ssl/generated/ca.key
119
- - spec/fixtures/ssl/generated/selfsigned.crt
120
- - spec/fixtures/ssl/generated/server.crt
121
- - spec/fixtures/ssl/generated/server.key
122
- - spec/fixtures/ssl/openssl-exts.cnf
123
- - spec/fixtures/twitter.csv
124
- - spec/fixtures/twitter.json
125
- - spec/fixtures/twitter.xml
126
- - spec/fixtures/undefined_method_add_node_for_nil.xml
127
- - spec/httparty/connection_adapter_spec.rb
128
- - spec/httparty/cookie_hash_spec.rb
129
- - spec/httparty/exception_spec.rb
130
- - spec/httparty/hash_conversions_spec.rb
131
- - spec/httparty/logger/apache_formatter_spec.rb
132
- - spec/httparty/logger/curl_formatter_spec.rb
133
- - spec/httparty/logger/logger_spec.rb
134
- - spec/httparty/net_digest_auth_spec.rb
135
- - spec/httparty/parser_spec.rb
136
- - spec/httparty/request_spec.rb
137
- - spec/httparty/response_spec.rb
138
- - spec/httparty/ssl_spec.rb
139
- - spec/httparty_spec.rb
140
- - spec/spec_helper.rb
141
- - spec/support/ssl_test_helper.rb
142
- - spec/support/ssl_test_server.rb
143
- - spec/support/stub_response.rb
144
113
  - website/css/common.css
145
114
  - website/index.html
146
- homepage: http://jnunemaker.github.com/httparty
115
+ homepage: https://github.com/jnunemaker/httparty
147
116
  licenses:
148
117
  - MIT
149
118
  metadata: {}
@@ -155,63 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
124
  requirements:
156
125
  - - ">="
157
126
  - !ruby/object:Gem::Version
158
- version: 1.9.3
127
+ version: 2.3.0
159
128
  required_rubygems_version: !ruby/object:Gem::Requirement
160
129
  requirements:
161
130
  - - ">="
162
131
  - !ruby/object:Gem::Version
163
132
  version: '0'
164
133
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.2.3
134
+ rubygems_version: 3.0.3
167
135
  signing_key:
168
136
  specification_version: 4
169
137
  summary: Makes http fun! Also, makes consuming restful web services dead easy.
170
- test_files:
171
- - features/basic_authentication.feature
172
- - features/command_line.feature
173
- - features/deals_with_http_error_codes.feature
174
- - features/digest_authentication.feature
175
- - features/handles_compressed_responses.feature
176
- - features/handles_multiple_formats.feature
177
- - features/steps/env.rb
178
- - features/steps/httparty_response_steps.rb
179
- - features/steps/httparty_steps.rb
180
- - features/steps/mongrel_helper.rb
181
- - features/steps/remote_service_steps.rb
182
- - features/supports_read_timeout_option.feature
183
- - features/supports_redirection.feature
184
- - features/supports_timeout_option.feature
185
- - spec/fixtures/delicious.xml
186
- - spec/fixtures/empty.xml
187
- - spec/fixtures/google.html
188
- - spec/fixtures/ssl/generate.sh
189
- - spec/fixtures/ssl/generated/1fe462c2.0
190
- - spec/fixtures/ssl/generated/bogushost.crt
191
- - spec/fixtures/ssl/generated/ca.crt
192
- - spec/fixtures/ssl/generated/ca.key
193
- - spec/fixtures/ssl/generated/selfsigned.crt
194
- - spec/fixtures/ssl/generated/server.crt
195
- - spec/fixtures/ssl/generated/server.key
196
- - spec/fixtures/ssl/openssl-exts.cnf
197
- - spec/fixtures/twitter.csv
198
- - spec/fixtures/twitter.json
199
- - spec/fixtures/twitter.xml
200
- - spec/fixtures/undefined_method_add_node_for_nil.xml
201
- - spec/httparty/connection_adapter_spec.rb
202
- - spec/httparty/cookie_hash_spec.rb
203
- - spec/httparty/exception_spec.rb
204
- - spec/httparty/hash_conversions_spec.rb
205
- - spec/httparty/logger/apache_formatter_spec.rb
206
- - spec/httparty/logger/curl_formatter_spec.rb
207
- - spec/httparty/logger/logger_spec.rb
208
- - spec/httparty/net_digest_auth_spec.rb
209
- - spec/httparty/parser_spec.rb
210
- - spec/httparty/request_spec.rb
211
- - spec/httparty/response_spec.rb
212
- - spec/httparty/ssl_spec.rb
213
- - spec/httparty_spec.rb
214
- - spec/spec_helper.rb
215
- - spec/support/ssl_test_helper.rb
216
- - spec/support/ssl_test_server.rb
217
- - spec/support/stub_response.rb
138
+ test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- notifications:
6
- email: false
7
- bundler_args: --without development
@@ -1,20 +0,0 @@
1
- Feature: Basic Authentication
2
-
3
- As a developer
4
- I want to be able to use a service that requires Basic Authentication
5
- Because that is not an uncommon requirement
6
-
7
- Scenario: Passing no credentials to a page requiring Basic Authentication
8
- Given a restricted page at '/basic_auth.html'
9
- When I call HTTParty#get with '/basic_auth.html'
10
- Then it should return a response with a 401 response code
11
-
12
- Scenario: Passing proper credentials to a page requiring Basic Authentication
13
- Given a remote service that returns 'Authenticated Page'
14
- And that service is accessed at the path '/basic_auth.html'
15
- And that service is protected by Basic Authentication
16
- And that service requires the username 'jcash' with the password 'maninblack'
17
- When I call HTTParty#get with '/basic_auth.html' and a basic_auth hash:
18
- | username | password |
19
- | jcash | maninblack |
20
- Then the return value should match 'Authenticated Page'