httparty-responsibly 0.17.0.r1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +18 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +92 -0
- data/.rubocop_todo.yml +124 -0
- data/.simplecov +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +23 -0
- data/Changelog.md +502 -0
- data/Gemfile +23 -0
- data/Guardfile +16 -0
- data/MIT-LICENSE +20 -0
- data/README.md +78 -0
- data/Rakefile +10 -0
- data/bin/httparty +123 -0
- data/cucumber.yml +1 -0
- data/docs/README.md +106 -0
- data/examples/README.md +86 -0
- data/examples/aaws.rb +32 -0
- data/examples/basic.rb +28 -0
- data/examples/body_stream.rb +14 -0
- data/examples/crack.rb +19 -0
- data/examples/custom_parsers.rb +68 -0
- data/examples/delicious.rb +37 -0
- data/examples/google.rb +16 -0
- data/examples/headers_and_user_agents.rb +10 -0
- data/examples/logging.rb +36 -0
- data/examples/microsoft_graph.rb +52 -0
- data/examples/multipart.rb +22 -0
- data/examples/nokogiri_html_parser.rb +19 -0
- data/examples/peer_cert.rb +9 -0
- data/examples/rescue_json.rb +17 -0
- data/examples/rubyurl.rb +14 -0
- data/examples/stackexchange.rb +24 -0
- data/examples/stream_download.rb +26 -0
- data/examples/tripit_sign_in.rb +44 -0
- data/examples/twitter.rb +31 -0
- data/examples/whoismyrep.rb +10 -0
- data/httparty-responsibly.gemspec +27 -0
- data/lib/httparty.rb +684 -0
- data/lib/httparty/connection_adapter.rb +244 -0
- data/lib/httparty/cookie_hash.rb +21 -0
- data/lib/httparty/exceptions.rb +33 -0
- data/lib/httparty/hash_conversions.rb +69 -0
- data/lib/httparty/logger/apache_formatter.rb +45 -0
- data/lib/httparty/logger/curl_formatter.rb +91 -0
- data/lib/httparty/logger/logger.rb +28 -0
- data/lib/httparty/logger/logstash_formatter.rb +59 -0
- data/lib/httparty/module_inheritable_attributes.rb +56 -0
- data/lib/httparty/net_digest_auth.rb +136 -0
- data/lib/httparty/parser.rb +150 -0
- data/lib/httparty/request.rb +386 -0
- data/lib/httparty/request/body.rb +84 -0
- data/lib/httparty/request/multipart_boundary.rb +11 -0
- data/lib/httparty/response.rb +140 -0
- data/lib/httparty/response/headers.rb +33 -0
- data/lib/httparty/response_fragment.rb +19 -0
- data/lib/httparty/text_encoder.rb +70 -0
- data/lib/httparty/utils.rb +11 -0
- data/lib/httparty/version.rb +3 -0
- data/script/release +42 -0
- data/website/css/common.css +47 -0
- data/website/index.html +73 -0
- metadata +138 -0
data/website/index.html
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
+
<title>HTTParty by John Nunemaker</title>
|
6
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<div id="wrapper">
|
11
|
+
<div id="header">
|
12
|
+
<h1>HTTParty</h1>
|
13
|
+
<p>Tonight we're gonna HTTParty like it's 1999!</p>
|
14
|
+
|
15
|
+
<ul id="nav">
|
16
|
+
<li><a href="rdoc/">Docs</a></li>
|
17
|
+
<li><a href="http://github.com/jnunemaker/httparty">Github</a></li>
|
18
|
+
<li><a href="http://rubyforge.org/projects/httparty/">Rubyforge</a></li>
|
19
|
+
</ul>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="content">
|
23
|
+
<h2>Install</h2>
|
24
|
+
<pre><code>$ sudo gem install httparty</code></pre>
|
25
|
+
|
26
|
+
<h2>Some Quick Examples</h2>
|
27
|
+
|
28
|
+
<p>The following is a simple example of wrapping Twitter's API for posting updates.</p>
|
29
|
+
|
30
|
+
<pre><code>class Twitter
|
31
|
+
include HTTParty
|
32
|
+
base_uri 'twitter.com'
|
33
|
+
basic_auth 'username', 'password'
|
34
|
+
end
|
35
|
+
|
36
|
+
Twitter.post('/statuses/update.json', query: {status: "It's an HTTParty and everyone is invited!"})</code></pre>
|
37
|
+
|
38
|
+
<p>That is really it! The object returned is a ruby hash that is decoded from Twitter's json response. JSON parsing is used because of the .json extension in the path of the request. You can also explicitly set a format (see the examples). </p>
|
39
|
+
|
40
|
+
<p>That works and all but what if you don't want to embed your username and password in the class? Below is an example to fix that:</p>
|
41
|
+
|
42
|
+
<pre><code>class Twitter
|
43
|
+
include HTTParty
|
44
|
+
base_uri 'twitter.com'
|
45
|
+
|
46
|
+
def initialize(u, p)
|
47
|
+
@auth = {username: u, password: p}
|
48
|
+
end
|
49
|
+
|
50
|
+
def post(text)
|
51
|
+
options = { query: {status: text}, basic_auth: @auth }
|
52
|
+
self.class.post('/statuses/update.json', options)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
Twitter.new('username', 'password').post("It's an HTTParty and everyone is invited!")</code></pre>
|
57
|
+
|
58
|
+
<p><strong>More Examples:</strong> There are <a href="http://github.com/jnunemaker/httparty/tree/master/examples/">several examples in the gem itself</a>.</p>
|
59
|
+
|
60
|
+
<h2>Support</h2>
|
61
|
+
<p>Conversations welcome in the <a href="http://groups.google.com/group/httparty-gem">google group</a> and bugs/features over at <a href="http://github.com/jnunemaker/httparty">Github</a>.</p>
|
62
|
+
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div id="footer">
|
67
|
+
<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a> |
|
68
|
+
<a href="http://orderedlist.com/">Hire Me at Ordered List</a></p>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
</body>
|
73
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: httparty-responsibly
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.17.0.r1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Nunemaker
|
8
|
+
- Sandro Turriate
|
9
|
+
- James Denness
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: multi_xml
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.5.2
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: mime-types
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '3.0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3.0'
|
43
|
+
description: An up-to-date fork of jnunemaker's httparty, without the post-install
|
44
|
+
nonsense.
|
45
|
+
email:
|
46
|
+
- nunemaker@gmail.com
|
47
|
+
- james@denness.org
|
48
|
+
executables:
|
49
|
+
- httparty
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- ".editorconfig"
|
54
|
+
- ".gitignore"
|
55
|
+
- ".rubocop.yml"
|
56
|
+
- ".rubocop_todo.yml"
|
57
|
+
- ".simplecov"
|
58
|
+
- ".travis.yml"
|
59
|
+
- CONTRIBUTING.md
|
60
|
+
- Changelog.md
|
61
|
+
- Gemfile
|
62
|
+
- Guardfile
|
63
|
+
- MIT-LICENSE
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- bin/httparty
|
67
|
+
- cucumber.yml
|
68
|
+
- docs/README.md
|
69
|
+
- examples/README.md
|
70
|
+
- examples/aaws.rb
|
71
|
+
- examples/basic.rb
|
72
|
+
- examples/body_stream.rb
|
73
|
+
- examples/crack.rb
|
74
|
+
- examples/custom_parsers.rb
|
75
|
+
- examples/delicious.rb
|
76
|
+
- examples/google.rb
|
77
|
+
- examples/headers_and_user_agents.rb
|
78
|
+
- examples/logging.rb
|
79
|
+
- examples/microsoft_graph.rb
|
80
|
+
- examples/multipart.rb
|
81
|
+
- examples/nokogiri_html_parser.rb
|
82
|
+
- examples/peer_cert.rb
|
83
|
+
- examples/rescue_json.rb
|
84
|
+
- examples/rubyurl.rb
|
85
|
+
- examples/stackexchange.rb
|
86
|
+
- examples/stream_download.rb
|
87
|
+
- examples/tripit_sign_in.rb
|
88
|
+
- examples/twitter.rb
|
89
|
+
- examples/whoismyrep.rb
|
90
|
+
- httparty-responsibly.gemspec
|
91
|
+
- lib/httparty.rb
|
92
|
+
- lib/httparty/connection_adapter.rb
|
93
|
+
- lib/httparty/cookie_hash.rb
|
94
|
+
- lib/httparty/exceptions.rb
|
95
|
+
- lib/httparty/hash_conversions.rb
|
96
|
+
- lib/httparty/logger/apache_formatter.rb
|
97
|
+
- lib/httparty/logger/curl_formatter.rb
|
98
|
+
- lib/httparty/logger/logger.rb
|
99
|
+
- lib/httparty/logger/logstash_formatter.rb
|
100
|
+
- lib/httparty/module_inheritable_attributes.rb
|
101
|
+
- lib/httparty/net_digest_auth.rb
|
102
|
+
- lib/httparty/parser.rb
|
103
|
+
- lib/httparty/request.rb
|
104
|
+
- lib/httparty/request/body.rb
|
105
|
+
- lib/httparty/request/multipart_boundary.rb
|
106
|
+
- lib/httparty/response.rb
|
107
|
+
- lib/httparty/response/headers.rb
|
108
|
+
- lib/httparty/response_fragment.rb
|
109
|
+
- lib/httparty/text_encoder.rb
|
110
|
+
- lib/httparty/utils.rb
|
111
|
+
- lib/httparty/version.rb
|
112
|
+
- script/release
|
113
|
+
- website/css/common.css
|
114
|
+
- website/index.html
|
115
|
+
homepage: https://github.com/scarybot/httparty-responsibly
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 2.0.0
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.3.1
|
133
|
+
requirements: []
|
134
|
+
rubygems_version: 3.0.3
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: An up-to-date fork of jnunemaker's httparty, without the post-install nonsense.
|
138
|
+
test_files: []
|