httparty 0.13.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +18 -0
  3. data/.github/workflows/ci.yml +26 -0
  4. data/.gitignore +4 -0
  5. data/.rubocop.yml +92 -0
  6. data/.rubocop_todo.yml +124 -0
  7. data/CONTRIBUTING.md +23 -0
  8. data/Changelog.md +557 -0
  9. data/Gemfile +15 -3
  10. data/Guardfile +4 -3
  11. data/README.md +24 -25
  12. data/Rakefile +5 -7
  13. data/bin/httparty +20 -14
  14. data/docs/README.md +191 -0
  15. data/examples/README.md +89 -0
  16. data/examples/aaws.rb +10 -6
  17. data/examples/basic.rb +6 -10
  18. data/examples/body_stream.rb +14 -0
  19. data/examples/crack.rb +2 -2
  20. data/examples/custom_parsers.rb +6 -5
  21. data/examples/delicious.rb +8 -8
  22. data/examples/google.rb +2 -2
  23. data/examples/headers_and_user_agents.rb +7 -3
  24. data/examples/idn.rb +10 -0
  25. data/examples/logging.rb +36 -0
  26. data/examples/microsoft_graph.rb +52 -0
  27. data/examples/multipart.rb +22 -0
  28. data/examples/nokogiri_html_parser.rb +0 -3
  29. data/examples/peer_cert.rb +9 -0
  30. data/examples/rescue_json.rb +17 -0
  31. data/examples/rubyurl.rb +3 -3
  32. data/examples/stackexchange.rb +24 -0
  33. data/examples/stream_download.rb +26 -0
  34. data/examples/tripit_sign_in.rb +20 -9
  35. data/examples/twitter.rb +7 -7
  36. data/examples/whoismyrep.rb +1 -1
  37. data/httparty.gemspec +13 -9
  38. data/lib/httparty/connection_adapter.rb +105 -25
  39. data/lib/httparty/cookie_hash.rb +10 -9
  40. data/lib/httparty/decompressor.rb +102 -0
  41. data/lib/httparty/exceptions.rb +8 -2
  42. data/lib/httparty/hash_conversions.rb +39 -19
  43. data/lib/httparty/headers_processor.rb +32 -0
  44. data/lib/httparty/logger/apache_formatter.rb +47 -0
  45. data/lib/httparty/logger/curl_formatter.rb +93 -0
  46. data/lib/httparty/logger/logger.rb +22 -10
  47. data/lib/httparty/logger/logstash_formatter.rb +61 -0
  48. data/lib/httparty/module_inheritable_attributes.rb +6 -4
  49. data/lib/httparty/net_digest_auth.rb +76 -25
  50. data/lib/httparty/parser.rb +28 -15
  51. data/lib/httparty/request/body.rb +105 -0
  52. data/lib/httparty/request/multipart_boundary.rb +13 -0
  53. data/lib/httparty/request.rb +218 -130
  54. data/lib/httparty/response/headers.rb +23 -19
  55. data/lib/httparty/response.rb +99 -15
  56. data/lib/httparty/response_fragment.rb +21 -0
  57. data/lib/httparty/text_encoder.rb +72 -0
  58. data/lib/httparty/utils.rb +13 -0
  59. data/lib/httparty/version.rb +3 -1
  60. data/lib/httparty.rb +191 -83
  61. data/website/css/common.css +1 -1
  62. data/website/index.html +3 -3
  63. metadata +50 -120
  64. data/.travis.yml +0 -7
  65. data/History +0 -303
  66. data/features/basic_authentication.feature +0 -20
  67. data/features/command_line.feature +0 -7
  68. data/features/deals_with_http_error_codes.feature +0 -26
  69. data/features/digest_authentication.feature +0 -20
  70. data/features/handles_compressed_responses.feature +0 -27
  71. data/features/handles_multiple_formats.feature +0 -57
  72. data/features/steps/env.rb +0 -22
  73. data/features/steps/httparty_response_steps.rb +0 -52
  74. data/features/steps/httparty_steps.rb +0 -35
  75. data/features/steps/mongrel_helper.rb +0 -94
  76. data/features/steps/remote_service_steps.rb +0 -74
  77. data/features/supports_redirection.feature +0 -22
  78. data/features/supports_timeout_option.feature +0 -13
  79. data/lib/httparty/core_extensions.rb +0 -32
  80. data/lib/httparty/logger/apache_logger.rb +0 -22
  81. data/lib/httparty/logger/curl_logger.rb +0 -48
  82. data/spec/fixtures/delicious.xml +0 -23
  83. data/spec/fixtures/empty.xml +0 -0
  84. data/spec/fixtures/google.html +0 -3
  85. data/spec/fixtures/ssl/generate.sh +0 -29
  86. data/spec/fixtures/ssl/generated/1fe462c2.0 +0 -16
  87. data/spec/fixtures/ssl/generated/bogushost.crt +0 -13
  88. data/spec/fixtures/ssl/generated/ca.crt +0 -16
  89. data/spec/fixtures/ssl/generated/ca.key +0 -15
  90. data/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
  91. data/spec/fixtures/ssl/generated/server.crt +0 -13
  92. data/spec/fixtures/ssl/generated/server.key +0 -15
  93. data/spec/fixtures/ssl/openssl-exts.cnf +0 -9
  94. data/spec/fixtures/twitter.csv +0 -2
  95. data/spec/fixtures/twitter.json +0 -1
  96. data/spec/fixtures/twitter.xml +0 -403
  97. data/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
  98. data/spec/httparty/connection_adapter_spec.rb +0 -298
  99. data/spec/httparty/cookie_hash_spec.rb +0 -83
  100. data/spec/httparty/exception_spec.rb +0 -23
  101. data/spec/httparty/logger/apache_logger_spec.rb +0 -26
  102. data/spec/httparty/logger/curl_logger_spec.rb +0 -18
  103. data/spec/httparty/logger/logger_spec.rb +0 -22
  104. data/spec/httparty/net_digest_auth_spec.rb +0 -152
  105. data/spec/httparty/parser_spec.rb +0 -165
  106. data/spec/httparty/request_spec.rb +0 -631
  107. data/spec/httparty/response_spec.rb +0 -221
  108. data/spec/httparty/ssl_spec.rb +0 -74
  109. data/spec/httparty_spec.rb +0 -764
  110. data/spec/spec.opts +0 -2
  111. data/spec/spec_helper.rb +0 -37
  112. data/spec/support/ssl_test_helper.rb +0 -47
  113. data/spec/support/ssl_test_server.rb +0 -80
  114. data/spec/support/stub_response.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e2e263bc6000ec32578c99ef814398a9742be7a7
4
- data.tar.gz: 9f8eb0a8ddb0100669e3f08c86fbde96b7c538d7
2
+ SHA256:
3
+ metadata.gz: 9dccd9b1a1fa3f98ca96da312ccdf19371418815a556b1443acac322a8ae4e15
4
+ data.tar.gz: 61f75235d1dcf4e1e38cbab62869aeeff28de9d0dc27fad30c7ca11d6355cd0d
5
5
  SHA512:
6
- metadata.gz: 4e02f9c9aab76af35b66bc0421d7322357a3a180f55cb50434259ce907d9cb536adaef681312fdee37648d8b558731c1c003d5bb57caa0000a187d24377449b3
7
- data.tar.gz: 39286a8c98a2375f4fa60c98fb0ec3a5dd8828760029fcdefa054acce0da38cc20eb113cfbb6759a6df3f7ffaf7a9d62021c17ddb599318cf557ab70fdfedfad
6
+ metadata.gz: e47fce0ce8b6c4fe97ee0335b4f0544bc039755f12f0c2aac9f47e901739fd172390a3dc01f070d6799b1af335293b5d09a66514deb0810dfafc37f25d2f3c81
7
+ data.tar.gz: 9aa37800410a58a60ca751de44eed1026514b26c408a1f890b48a8f0049c814052a70a55343d3798c3d4d59ca9b157257c1fa83240200d283ba374a9b62db2ef
data/.editorconfig ADDED
@@ -0,0 +1,18 @@
1
+ ; This file is for unifying the coding style for different editors and IDEs.
2
+ ; More information at http://EditorConfig.org
3
+
4
+ root = true
5
+ [*]
6
+ end_of_line = lf
7
+ trim_trailing_whitespace = true
8
+
9
+ [**.rb]
10
+ indent_size = 2
11
+ indent_style = spaces
12
+ insert_final_newline = true
13
+
14
+ [**.xml]
15
+ trim_trailing_whitespace = false
16
+
17
+ [**.html]
18
+ trim_trailing_whitespace = false
@@ -0,0 +1,26 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby:
9
+ - 2.3
10
+ - 2.4
11
+ - 2.5
12
+ - 2.6
13
+ - 2.7
14
+ - '3.0' # Quoted, to avoid YAML float 3.0 interplated to "3"
15
+ - 3.1
16
+ - 3.2
17
+ steps:
18
+ - name: Check out repository code
19
+ uses: actions/checkout@v3
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true # Run "bundle install", and cache the result automatically.
25
+ - name: Run Rake
26
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -8,3 +8,7 @@ pkg/
8
8
  *.swp
9
9
  /.bundle
10
10
  .rvmrc
11
+ coverage
12
+ *.gem
13
+ .idea
14
+ .tool-versions
data/.rubocop.yml ADDED
@@ -0,0 +1,92 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # Offense count: 963
4
+ # Cop supports --auto-correct.
5
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
6
+ Style/StringLiterals:
7
+ Enabled: false
8
+
9
+ # Offense count: 327
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
12
+ Style/SpaceInsideHashLiteralBraces:
13
+ Enabled: false
14
+
15
+ # Offense count: 33
16
+ # Cop supports --auto-correct.
17
+ # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
18
+ Style/SpaceInsideBlockBraces:
19
+ Enabled: false
20
+
21
+ # Offense count: 1
22
+ # Cop supports --auto-correct.
23
+ Style/SpaceBeforeSemicolon:
24
+ Enabled: false
25
+
26
+ # Offense count: 20
27
+ # Cop supports --auto-correct.
28
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
29
+ Style/SignalException:
30
+ Enabled: false
31
+
32
+ # Offense count: 1
33
+ # Configuration parameters: Methods.
34
+ Style/SingleLineBlockParams:
35
+ Enabled: false
36
+
37
+ # Offense count: 6
38
+ # Cop supports --auto-correct.
39
+ Style/PerlBackrefs:
40
+ Enabled: false
41
+
42
+ # Offense count: 2
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: AllowAsExpressionSeparator.
45
+ Style/Semicolon:
46
+ Enabled: false
47
+
48
+ # Offense count: 77
49
+ # Cop supports --auto-correct.
50
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
51
+ Style/BracesAroundHashParameters:
52
+ Enabled: false
53
+
54
+ # Offense count: 36
55
+ Style/Documentation:
56
+ Enabled: false
57
+
58
+ # Offense count: 6
59
+ # Cop supports --auto-correct.
60
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
61
+ Style/RegexpLiteral:
62
+ Enabled: false
63
+
64
+ # Offense count: 5
65
+ # Cop supports --auto-correct.
66
+ Style/NumericLiterals:
67
+ MinDigits: 6
68
+
69
+ # Offense count: 4
70
+ # Cop supports --auto-correct.
71
+ Lint/UnusedMethodArgument:
72
+ Enabled: false
73
+
74
+ # Offense count: 11
75
+ # Cop supports --auto-correct.
76
+ Lint/UnusedBlockArgument:
77
+ Enabled: false
78
+
79
+ # Offense count: 1
80
+ Lint/Void:
81
+ Enabled: false
82
+
83
+ # Offense count: 22
84
+ # Cop supports --auto-correct.
85
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
86
+ Style/IndentHash:
87
+ Enabled: false
88
+
89
+ # Offense count: 7
90
+ # Configuration parameters: MinBodyLength.
91
+ Style/GuardClause:
92
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,124 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-04-24 07:22:28 +0200 using RuboCop version 0.30.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 33
9
+ Lint/AmbiguousRegexpLiteral:
10
+ Enabled: false
11
+
12
+ # Offense count: 1
13
+ # Configuration parameters: AlignWith, SupportedStyles.
14
+ Lint/EndAlignment:
15
+ Enabled: false
16
+
17
+ # Offense count: 1
18
+ Lint/SuppressedException:
19
+ Enabled: false
20
+
21
+ # Offense count: 5
22
+ Lint/UselessAssignment:
23
+ Enabled: false
24
+
25
+ # Offense count: 23
26
+ Metrics/AbcSize:
27
+ Max: 86
28
+
29
+ # Offense count: 1
30
+ # Configuration parameters: CountComments.
31
+ Metrics/ClassLength:
32
+ Max: 285
33
+
34
+ # Offense count: 8
35
+ Metrics/CyclomaticComplexity:
36
+ Max: 17
37
+
38
+ # Offense count: 332
39
+ # Configuration parameters: AllowURI, URISchemes.
40
+ Metrics/LineLength:
41
+ Max: 266
42
+
43
+ # Offense count: 17
44
+ # Configuration parameters: CountComments.
45
+ Metrics/MethodLength:
46
+ Max: 39
47
+
48
+ # Offense count: 8
49
+ Metrics/PerceivedComplexity:
50
+ Max: 20
51
+
52
+ # Offense count: 1
53
+ Style/AccessorMethodName:
54
+ Enabled: false
55
+
56
+ # Offense count: 1
57
+ Style/AsciiComments:
58
+ Enabled: false
59
+
60
+ # Offense count: 14
61
+ # Cop supports --auto-correct.
62
+ # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
63
+ Style/BlockDelimiters:
64
+ Enabled: false
65
+
66
+ # Offense count: 2
67
+ Style/CaseEquality:
68
+ Enabled: false
69
+
70
+ # Offense count: 3
71
+ # Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
72
+ Style/CaseIndentation:
73
+ Enabled: false
74
+
75
+ # Offense count: 4
76
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
77
+ Style/ClassAndModuleChildren:
78
+ Enabled: false
79
+
80
+ # Offense count: 7
81
+ Style/ConstantName:
82
+ Enabled: false
83
+
84
+ # Offense count: 2
85
+ Style/EachWithObject:
86
+ Enabled: false
87
+
88
+ # Offense count: 2
89
+ # Cop supports --auto-correct.
90
+ Style/ElseAlignment:
91
+ Enabled: false
92
+
93
+ # Offense count: 3
94
+ # Cop supports --auto-correct.
95
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
96
+ Style/FirstParameterIndentation:
97
+ Enabled: false
98
+
99
+ # Offense count: 2
100
+ # Cop supports --auto-correct.
101
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
102
+ Style/HashSyntax:
103
+ Enabled: false
104
+
105
+ # Offense count: 7
106
+ # Cop supports --auto-correct.
107
+ # Configuration parameters: MaxLineLength.
108
+ Style/IfUnlessModifier:
109
+ Enabled: false
110
+
111
+ # Offense count: 11
112
+ # Cop supports --auto-correct.
113
+ Style/Lambda:
114
+ Enabled: false
115
+
116
+ # Offense count: 1
117
+ # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
118
+ Style/Next:
119
+ Enabled: false
120
+
121
+ # Offense count: 2
122
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
123
+ Style/RaiseArgs:
124
+ Enabled: false
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,23 @@
1
+ # Contributing
2
+
3
+ * Contributions will not be accepted without tests.
4
+ * Please post unconfirmed bugs to the mailing list first: https://groups.google.com/forum/#!forum/httparty-gem
5
+ * Don't change the version. The maintainers will handle that when they release.
6
+ * Always provide as much information and reproducibility as possible when filing an issue or submitting a pull request.
7
+
8
+ ## Workflow
9
+
10
+ * Fork the project.
11
+ * Run `bundle`
12
+ * Run `bundle exec rake`
13
+ * Make your feature addition or bug fix.
14
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
15
+ * Run `bundle exec rake` (No, REALLY :))
16
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself in another branch so I can ignore when I pull)
17
+ * Send me a pull request. Bonus points for topic branches.
18
+
19
+ ## Help and Docs
20
+
21
+ * https://groups.google.com/forum/#!forum/httparty-gem
22
+ * http://stackoverflow.com/questions/tagged/httparty
23
+ * http://rdoc.info/projects/jnunemaker/httparty