httparty 0.24.3 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +2 -4
- data/Rakefile +3 -1
- data/bin/httparty +32 -11
- data/docs/README.md +39 -5
- data/examples/README.md +12 -23
- data/examples/basic.rb +2 -2
- data/examples/basic_auth.rb +19 -0
- data/examples/cookies.rb +20 -0
- data/examples/crack.rb +2 -2
- data/examples/custom_parsers.rb +2 -2
- data/examples/debug_output.rb +17 -0
- data/examples/google.rb +2 -2
- data/examples/headers_and_user_agents.rb +2 -2
- data/examples/idn.rb +4 -3
- data/examples/logging.rb +2 -2
- data/examples/nokogiri_html_parser.rb +2 -2
- data/examples/party_foul_mode.rb +1 -0
- data/examples/peer_cert.rb +2 -2
- data/examples/rescue_json.rb +5 -3
- data/examples/stackexchange.rb +2 -2
- data/examples/stream_download.rb +2 -2
- data/examples/whoismyrep.rb +2 -2
- data/httparty.gemspec +5 -2
- data/lib/httparty/connection_adapter.rb +6 -6
- data/lib/httparty/cookie_hash.rb +1 -1
- data/lib/httparty/headers_processor.rb +5 -2
- data/lib/httparty/logger/apache_formatter.rb +14 -1
- data/lib/httparty/logger/curl_formatter.rb +31 -7
- data/lib/httparty/logger/logger.rb +2 -1
- data/lib/httparty/module_inheritable_attributes.rb +13 -13
- data/lib/httparty/net_digest_auth.rb +9 -11
- data/lib/httparty/parser.rb +2 -1
- data/lib/httparty/request/body.rb +5 -3
- data/lib/httparty/request/streaming_multipart_body.rb +9 -2
- data/lib/httparty/request.rb +85 -25
- data/lib/httparty/response.rb +16 -4
- data/lib/httparty/text_encoder.rb +6 -6
- data/lib/httparty/utils.rb +1 -5
- data/lib/httparty/version.rb +1 -1
- data/lib/httparty.rb +35 -23
- metadata +8 -18
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/ci.yml +0 -24
- data/.rubocop.yml +0 -92
- data/.rubocop_todo.yml +0 -124
- data/Gemfile +0 -27
- data/Guardfile +0 -17
- data/cucumber.yml +0 -1
- data/examples/aaws.rb +0 -36
- data/examples/delicious.rb +0 -37
- data/examples/rubyurl.rb +0 -14
- data/examples/tripit_sign_in.rb +0 -44
- data/examples/twitter.rb +0 -31
- data/script/release +0 -42
- data/website/css/common.css +0 -47
- data/website/index.html +0 -73
data/lib/httparty.rb
CHANGED
|
@@ -28,7 +28,7 @@ module HTTParty
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# == Common Request Options
|
|
31
|
-
# Request methods (get, post, patch, put, delete, head, options) all take a common set of options. These are:
|
|
31
|
+
# Request methods (get, post, patch, put, delete, move, copy, head, options, mkcol, lock, unlock) all take a common set of options. These are:
|
|
32
32
|
#
|
|
33
33
|
# [:+body+:] Body of the request. If passed an object that responds to #to_hash, will try to normalize it first, by default passing it to ActiveSupport::to_params. Any other kind of object will get used as-is.
|
|
34
34
|
# [:+http_proxyaddr+:] Address of proxy server to use.
|
|
@@ -37,7 +37,11 @@ module HTTParty
|
|
|
37
37
|
# [:+http_proxypass+:] Password for proxy server authentication.
|
|
38
38
|
# [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
|
|
39
39
|
# [:+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.
|
|
40
|
-
# [:+timeout+:] Timeout for opening connection and
|
|
40
|
+
# [:+timeout+:] Timeout for opening the connection, reading and writing.
|
|
41
|
+
# [:+open_timeout+:] Timeout for opening the connection. Overrides :+timeout+.
|
|
42
|
+
# [:+read_timeout+:] Timeout for each read. Overrides :+timeout+.
|
|
43
|
+
# [:+write_timeout+:] Timeout for each write. Overrides :+timeout+.
|
|
44
|
+
# [:+max_retries+:] Number of times Net::HTTP retries an idempotent request that times out or fails after connecting. Net::HTTP's default is 1.
|
|
41
45
|
# [:+local_host+:] Local address to bind to before connecting.
|
|
42
46
|
# [:+local_port+:] Local port to bind to before connecting.
|
|
43
47
|
# [:+body_stream+:] Allow streaming to a REST server to specify a body_stream.
|
|
@@ -76,7 +80,7 @@ module HTTParty
|
|
|
76
80
|
#
|
|
77
81
|
# class Foo
|
|
78
82
|
# include HTTParty
|
|
79
|
-
# logger Logger.new('http_logger'), :info, :apache
|
|
83
|
+
# logger ::Logger.new('http_logger'), :info, :apache
|
|
80
84
|
# end
|
|
81
85
|
def logger(logger, level = :info, format = :apache)
|
|
82
86
|
default_options[:logger] = logger
|
|
@@ -85,11 +89,12 @@ module HTTParty
|
|
|
85
89
|
end
|
|
86
90
|
|
|
87
91
|
# Raises HTTParty::ResponseError if the response status matches a code,
|
|
88
|
-
# range, or regular expression string.
|
|
92
|
+
# range, or regular expression string. Codes and strings match anywhere
|
|
93
|
+
# in the status, so '3..' means any 3xx while '3[0-9]*' also matches 403.
|
|
89
94
|
#
|
|
90
95
|
# class Foo
|
|
91
96
|
# include HTTParty
|
|
92
|
-
# raise_on [404, 500..599, '3
|
|
97
|
+
# raise_on [404, 500..599, '3..']
|
|
93
98
|
# end
|
|
94
99
|
def raise_on(codes = [])
|
|
95
100
|
default_options[:raise_on] = codes.is_a?(Range) ? [codes] : [*codes]
|
|
@@ -99,7 +104,7 @@ module HTTParty
|
|
|
99
104
|
#
|
|
100
105
|
# class Foo
|
|
101
106
|
# include HTTParty
|
|
102
|
-
# http_proxy '
|
|
107
|
+
# http_proxy 'foo.com', 80, 'user', 'pass'
|
|
103
108
|
# end
|
|
104
109
|
def http_proxy(addr = nil, port = nil, user = nil, pass = nil)
|
|
105
110
|
default_options[:http_proxyaddr] = addr
|
|
@@ -210,7 +215,6 @@ module HTTParty
|
|
|
210
215
|
end
|
|
211
216
|
|
|
212
217
|
# Allows setting a default write_timeout for all HTTP calls in seconds
|
|
213
|
-
# Supported by Ruby > 2.6.0
|
|
214
218
|
#
|
|
215
219
|
# class Foo
|
|
216
220
|
# include HTTParty
|
|
@@ -251,7 +255,7 @@ module HTTParty
|
|
|
251
255
|
|
|
252
256
|
def cookies(h = {})
|
|
253
257
|
raise ArgumentError, 'Cookies must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
|
|
254
|
-
default_cookies.add_cookies(h)
|
|
258
|
+
default_cookies.add_cookies(h.to_hash)
|
|
255
259
|
end
|
|
256
260
|
|
|
257
261
|
# Proceed to the location header when an HTTP response dictates a redirect.
|
|
@@ -328,8 +332,9 @@ module HTTParty
|
|
|
328
332
|
# even on redirects that should logically become GET requests.
|
|
329
333
|
# A 303 redirect in HTTP signifies that the redirected url should normally
|
|
330
334
|
# retrieved using a GET request, for instance, it is the output of a previous
|
|
331
|
-
# POST. maintain_method_across_redirects respects this behavior
|
|
332
|
-
# can force HTTParty to resend_on_redirect
|
|
335
|
+
# POST. maintain_method_across_redirects respects this behavior (a HEAD
|
|
336
|
+
# request stays a HEAD), but you can force HTTParty to resend_on_redirect
|
|
337
|
+
# even on 303 responses.
|
|
333
338
|
#
|
|
334
339
|
# @example
|
|
335
340
|
# class Foo
|
|
@@ -376,6 +381,8 @@ module HTTParty
|
|
|
376
381
|
# Let's change it to this:
|
|
377
382
|
# /?selected_ids=1&selected_ids=2&selected_ids=3
|
|
378
383
|
#
|
|
384
|
+
# (For exactly this format, call disable_rails_query_string_format.)
|
|
385
|
+
#
|
|
379
386
|
# Pass a Proc to the query normalizer which accepts the yielded query.
|
|
380
387
|
#
|
|
381
388
|
# @example Modifying Array query strings
|
|
@@ -383,9 +390,7 @@ module HTTParty
|
|
|
383
390
|
# include HTTParty
|
|
384
391
|
#
|
|
385
392
|
# query_string_normalizer proc { |query|
|
|
386
|
-
# query
|
|
387
|
-
# value.map {|v| "#{key}=#{v}"}
|
|
388
|
-
# end.join('&')
|
|
393
|
+
# URI.encode_www_form(query)
|
|
389
394
|
# }
|
|
390
395
|
# end
|
|
391
396
|
#
|
|
@@ -396,7 +401,7 @@ module HTTParty
|
|
|
396
401
|
default_options[:query_string_normalizer] = normalizer
|
|
397
402
|
end
|
|
398
403
|
|
|
399
|
-
# Allows setting of SSL version to use.
|
|
404
|
+
# Allows setting of SSL version to use.
|
|
400
405
|
# You can get a list of valid versions from OpenSSL::SSL::SSLContext::METHODS.
|
|
401
406
|
#
|
|
402
407
|
# class Foo
|
|
@@ -423,7 +428,7 @@ module HTTParty
|
|
|
423
428
|
default_options[:skip_decompression] = !!value
|
|
424
429
|
end
|
|
425
430
|
|
|
426
|
-
# Allows setting of SSL ciphers to use.
|
|
431
|
+
# Allows setting of SSL ciphers to use.
|
|
427
432
|
# You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
|
|
428
433
|
# You also can specify a cipher suite here, listed here at openssl.org:
|
|
429
434
|
# http://www.openssl.org/docs/apps/ciphers.html#CIPHER_SUITE_NAMES
|
|
@@ -575,8 +580,7 @@ module HTTParty
|
|
|
575
580
|
|
|
576
581
|
# Perform a HEAD request to a path
|
|
577
582
|
def head(path, options = {}, &block)
|
|
578
|
-
|
|
579
|
-
perform_request Net::HTTP::Head, path, options, &block
|
|
583
|
+
perform_request Net::HTTP::Head, path, { maintain_method_across_redirects: true }.merge(options), &block
|
|
580
584
|
end
|
|
581
585
|
|
|
582
586
|
# Perform an OPTIONS request to a path
|
|
@@ -589,10 +593,12 @@ module HTTParty
|
|
|
589
593
|
perform_request Net::HTTP::Mkcol, path, options, &block
|
|
590
594
|
end
|
|
591
595
|
|
|
596
|
+
# Perform a LOCK request to a path
|
|
592
597
|
def lock(path, options = {}, &block)
|
|
593
598
|
perform_request Net::HTTP::Lock, path, options, &block
|
|
594
599
|
end
|
|
595
600
|
|
|
601
|
+
# Perform an UNLOCK request to a path
|
|
596
602
|
def unlock(path, options = {}, &block)
|
|
597
603
|
perform_request Net::HTTP::Unlock, path, options, &block
|
|
598
604
|
end
|
|
@@ -612,12 +618,6 @@ module HTTParty
|
|
|
612
618
|
raise ArgumentError, "#{ timeout_type } must be an integer or float" unless value && (value.is_a?(Integer) || value.is_a?(Float))
|
|
613
619
|
end
|
|
614
620
|
|
|
615
|
-
def ensure_method_maintained_across_redirects(options)
|
|
616
|
-
unless options.key?(:maintain_method_across_redirects)
|
|
617
|
-
options[:maintain_method_across_redirects] = true
|
|
618
|
-
end
|
|
619
|
-
end
|
|
620
|
-
|
|
621
621
|
def perform_request(http_method, path, options, &block) #:nodoc:
|
|
622
622
|
build_request(http_method, path, options).perform(&block)
|
|
623
623
|
end
|
|
@@ -687,6 +687,18 @@ module HTTParty
|
|
|
687
687
|
Basement.options(*args, &block)
|
|
688
688
|
end
|
|
689
689
|
|
|
690
|
+
def self.mkcol(*args, &block)
|
|
691
|
+
Basement.mkcol(*args, &block)
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
def self.lock(*args, &block)
|
|
695
|
+
Basement.lock(*args, &block)
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
def self.unlock(*args, &block)
|
|
699
|
+
Basement.unlock(*args, &block)
|
|
700
|
+
end
|
|
701
|
+
|
|
690
702
|
def self.build_request(*args, &block)
|
|
691
703
|
Basement.build_request(*args, &block)
|
|
692
704
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: httparty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.25.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Nunemaker
|
|
8
8
|
- Sandro Turriate
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2026-11-21 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: csv
|
|
@@ -61,28 +62,22 @@ extensions: []
|
|
|
61
62
|
extra_rdoc_files: []
|
|
62
63
|
files:
|
|
63
64
|
- ".editorconfig"
|
|
64
|
-
- ".github/dependabot.yml"
|
|
65
|
-
- ".github/workflows/ci.yml"
|
|
66
65
|
- ".gitignore"
|
|
67
|
-
- ".rubocop.yml"
|
|
68
|
-
- ".rubocop_todo.yml"
|
|
69
66
|
- CONTRIBUTING.md
|
|
70
67
|
- Changelog.md
|
|
71
|
-
- Gemfile
|
|
72
|
-
- Guardfile
|
|
73
68
|
- MIT-LICENSE
|
|
74
69
|
- README.md
|
|
75
70
|
- Rakefile
|
|
76
71
|
- bin/httparty
|
|
77
|
-
- cucumber.yml
|
|
78
72
|
- docs/README.md
|
|
79
73
|
- examples/README.md
|
|
80
|
-
- examples/aaws.rb
|
|
81
74
|
- examples/basic.rb
|
|
75
|
+
- examples/basic_auth.rb
|
|
82
76
|
- examples/body_stream.rb
|
|
77
|
+
- examples/cookies.rb
|
|
83
78
|
- examples/crack.rb
|
|
84
79
|
- examples/custom_parsers.rb
|
|
85
|
-
- examples/
|
|
80
|
+
- examples/debug_output.rb
|
|
86
81
|
- examples/google.rb
|
|
87
82
|
- examples/headers_and_user_agents.rb
|
|
88
83
|
- examples/idn.rb
|
|
@@ -93,11 +88,8 @@ files:
|
|
|
93
88
|
- examples/party_foul_mode.rb
|
|
94
89
|
- examples/peer_cert.rb
|
|
95
90
|
- examples/rescue_json.rb
|
|
96
|
-
- examples/rubyurl.rb
|
|
97
91
|
- examples/stackexchange.rb
|
|
98
92
|
- examples/stream_download.rb
|
|
99
|
-
- examples/tripit_sign_in.rb
|
|
100
|
-
- examples/twitter.rb
|
|
101
93
|
- examples/whoismyrep.rb
|
|
102
94
|
- httparty.gemspec
|
|
103
95
|
- lib/httparty.rb
|
|
@@ -124,9 +116,6 @@ files:
|
|
|
124
116
|
- lib/httparty/text_encoder.rb
|
|
125
117
|
- lib/httparty/utils.rb
|
|
126
118
|
- lib/httparty/version.rb
|
|
127
|
-
- script/release
|
|
128
|
-
- website/css/common.css
|
|
129
|
-
- website/index.html
|
|
130
119
|
homepage: https://github.com/jnunemaker/httparty
|
|
131
120
|
licenses:
|
|
132
121
|
- MIT
|
|
@@ -147,7 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
136
|
- !ruby/object:Gem::Version
|
|
148
137
|
version: '0'
|
|
149
138
|
requirements: []
|
|
150
|
-
rubygems_version:
|
|
139
|
+
rubygems_version: 3.3.7
|
|
140
|
+
signing_key:
|
|
151
141
|
specification_version: 4
|
|
152
142
|
summary: Makes http fun! Also, makes consuming restful web services dead easy.
|
|
153
143
|
test_files: []
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/ci.yml
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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.7
|
|
10
|
-
- "3.0" # Quoted, to avoid YAML float 3.0 interplated to "3"
|
|
11
|
-
- 3.1
|
|
12
|
-
- 3.2
|
|
13
|
-
- 3.3
|
|
14
|
-
- 3.4
|
|
15
|
-
steps:
|
|
16
|
-
- name: Check out repository code
|
|
17
|
-
uses: actions/checkout@v6
|
|
18
|
-
- name: Set up Ruby
|
|
19
|
-
uses: ruby/setup-ruby@v1
|
|
20
|
-
with:
|
|
21
|
-
ruby-version: ${{ matrix.ruby }}
|
|
22
|
-
bundler-cache: true # Run "bundle install", and cache the result automatically.
|
|
23
|
-
- name: Run Rake
|
|
24
|
-
run: bundle exec rake
|
data/.rubocop.yml
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
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/Gemfile
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
gemspec
|
|
3
|
-
|
|
4
|
-
gem 'base64'
|
|
5
|
-
gem 'rake'
|
|
6
|
-
gem 'mongrel', '1.2.0.pre2'
|
|
7
|
-
gem 'json'
|
|
8
|
-
|
|
9
|
-
group :development do
|
|
10
|
-
gem 'guard'
|
|
11
|
-
gem 'guard-rspec'
|
|
12
|
-
gem 'guard-bundler'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
group :test do
|
|
16
|
-
gem 'rexml'
|
|
17
|
-
gem 'rspec', '~> 3.4'
|
|
18
|
-
gem 'simplecov', require: false
|
|
19
|
-
gem 'aruba'
|
|
20
|
-
gem 'cucumber', '~> 2.3'
|
|
21
|
-
gem 'webmock'
|
|
22
|
-
gem 'addressable'
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
group :development, :test do
|
|
26
|
-
gem 'pry'
|
|
27
|
-
end
|
data/Guardfile
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
rspec_options = {
|
|
2
|
-
all_after_pass: false,
|
|
3
|
-
all_on_start: false,
|
|
4
|
-
failed_mode: :keep,
|
|
5
|
-
cmd: 'bundle exec rspec',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
guard 'rspec', rspec_options do
|
|
9
|
-
watch(%r{^spec/.+_spec\.rb$})
|
|
10
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
11
|
-
watch('spec/spec_helper.rb') { "spec" }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
guard 'bundler' do
|
|
15
|
-
watch('Gemfile')
|
|
16
|
-
watch(/^.+\.gemspec/)
|
|
17
|
-
end
|
data/cucumber.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
default: features --format progress
|
data/examples/aaws.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'active_support'
|
|
3
|
-
require 'active_support/core_ext/hash'
|
|
4
|
-
require 'active_support/core_ext/string'
|
|
5
|
-
|
|
6
|
-
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
7
|
-
require File.join(dir, 'httparty')
|
|
8
|
-
require 'pp'
|
|
9
|
-
config = YAML.load(File.read(File.join(ENV['HOME'], '.aaws')))
|
|
10
|
-
|
|
11
|
-
module AAWS
|
|
12
|
-
class Book
|
|
13
|
-
include HTTParty
|
|
14
|
-
base_uri 'http://ecs.amazonaws.com'
|
|
15
|
-
default_params Service: 'AWSECommerceService', Operation: 'ItemSearch', SearchIndex: 'Books'
|
|
16
|
-
|
|
17
|
-
def initialize(key)
|
|
18
|
-
@auth = { AWSAccessKeyId: key }
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def search(options = {})
|
|
22
|
-
raise ArgumentError, 'You must search for something' if options[:query].blank?
|
|
23
|
-
|
|
24
|
-
# amazon uses nasty camelized query params
|
|
25
|
-
options[:query] = options[:query]
|
|
26
|
-
.reverse_merge(@auth)
|
|
27
|
-
.transform_keys { |k| k.to_s.camelize }
|
|
28
|
-
|
|
29
|
-
# make a request and return the items (NOTE: this doesn't handle errors at this point)
|
|
30
|
-
self.class.get('/onca/xml', options)['ItemSearchResponse']['Items']
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
aaws = AAWS::Book.new(config[:access_key])
|
|
36
|
-
pp aaws.search(query: { title: 'Ruby On Rails' })
|
data/examples/delicious.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
|
-
require File.join(dir, 'httparty')
|
|
3
|
-
require 'pp'
|
|
4
|
-
config = YAML.load(File.read(File.join(ENV['HOME'], '.delicious')))
|
|
5
|
-
|
|
6
|
-
class Delicious
|
|
7
|
-
include HTTParty
|
|
8
|
-
base_uri 'https://api.del.icio.us/v1'
|
|
9
|
-
|
|
10
|
-
def initialize(u, p)
|
|
11
|
-
@auth = { username: u, password: p }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# query params that filter the posts are:
|
|
15
|
-
# tag (optional). Filter by this tag.
|
|
16
|
-
# dt (optional). Filter by this date (CCYY-MM-DDThh:mm:ssZ).
|
|
17
|
-
# url (optional). Filter by this url.
|
|
18
|
-
# ie: posts(query: {tag: 'ruby'})
|
|
19
|
-
def posts(options = {})
|
|
20
|
-
options.merge!({ basic_auth: @auth })
|
|
21
|
-
self.class.get('/posts/get', options)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# query params that filter the posts are:
|
|
25
|
-
# tag (optional). Filter by this tag.
|
|
26
|
-
# count (optional). Number of items to retrieve (Default:15, Maximum:100).
|
|
27
|
-
def recent(options = {})
|
|
28
|
-
options.merge!({ basic_auth: @auth })
|
|
29
|
-
self.class.get('/posts/recent', options)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
delicious = Delicious.new(config['username'], config['password'])
|
|
34
|
-
pp delicious.posts(query: { tag: 'ruby' })
|
|
35
|
-
pp delicious.recent
|
|
36
|
-
|
|
37
|
-
delicious.recent['posts']['post'].each { |post| puts post['href'] }
|
data/examples/rubyurl.rb
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
|
-
require File.join(dir, 'httparty')
|
|
3
|
-
require 'pp'
|
|
4
|
-
|
|
5
|
-
class Rubyurl
|
|
6
|
-
include HTTParty
|
|
7
|
-
base_uri 'rubyurl.com'
|
|
8
|
-
|
|
9
|
-
def self.shorten(website_url)
|
|
10
|
-
post('/api/links.json', query: { link: { website_url: website_url } })
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
pp Rubyurl.shorten('http://istwitterdown.com/')
|
data/examples/tripit_sign_in.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
|
-
require File.join(dir, 'httparty')
|
|
3
|
-
|
|
4
|
-
class TripIt
|
|
5
|
-
include HTTParty
|
|
6
|
-
base_uri 'https://www.tripit.com'
|
|
7
|
-
debug_output
|
|
8
|
-
|
|
9
|
-
def initialize(email, password)
|
|
10
|
-
@email = email
|
|
11
|
-
get_response = self.class.get('/account/login')
|
|
12
|
-
get_response_cookie = parse_cookie(get_response)
|
|
13
|
-
|
|
14
|
-
post_response = self.class.post(
|
|
15
|
-
'/account/login',
|
|
16
|
-
body: {
|
|
17
|
-
login_email_address: email,
|
|
18
|
-
login_password: password
|
|
19
|
-
},
|
|
20
|
-
headers: {'Cookie' => get_response_cookie.to_cookie_string }
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
@cookie = parse_cookie(post_response)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def account_settings
|
|
27
|
-
self.class.get('/account/edit', headers: { 'Cookie' => @cookie.to_cookie_string })
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def logged_in?
|
|
31
|
-
account_settings.include? "You're logged in as #{@email}"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def parse_cookie(resp)
|
|
37
|
-
cookie_hash = CookieHash.new
|
|
38
|
-
resp.get_fields('Set-Cookie').each { |c| cookie_hash.add_cookies(c) }
|
|
39
|
-
cookie_hash
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
tripit = TripIt.new('email', 'password')
|
|
44
|
-
puts "Logged in: #{tripit.logged_in?}"
|