httparty 0.13.1 → 0.13.2
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.
- checksums.yaml +4 -4
- data/Guardfile +3 -3
- data/History +74 -11
- data/README.md +4 -1
- data/Rakefile +1 -2
- data/bin/httparty +4 -4
- data/examples/README.md +64 -0
- data/examples/aaws.rb +3 -3
- data/examples/basic.rb +5 -5
- data/examples/crack.rb +1 -1
- data/examples/delicious.rb +5 -5
- data/examples/headers_and_user_agents.rb +1 -1
- data/examples/logging.rb +38 -0
- data/examples/rubyurl.rb +1 -1
- data/examples/stackexchange.rb +1 -1
- data/examples/tripit_sign_in.rb +5 -5
- data/examples/twitter.rb +5 -5
- data/examples/whoismyrep.rb +1 -1
- data/features/steps/httparty_steps.rb +2 -2
- data/httparty.gemspec +2 -0
- data/lib/httparty.rb +35 -17
- data/lib/httparty/connection_adapter.rb +4 -2
- data/lib/httparty/cookie_hash.rb +1 -1
- data/lib/httparty/hash_conversions.rb +12 -12
- data/lib/httparty/logger/apache_logger.rb +1 -1
- data/lib/httparty/logger/logger.rb +1 -1
- data/lib/httparty/net_digest_auth.rb +4 -1
- data/lib/httparty/request.rb +41 -21
- data/lib/httparty/version.rb +1 -1
- data/spec/httparty/connection_adapter_spec.rb +52 -36
- data/spec/httparty/cookie_hash_spec.rb +8 -8
- data/spec/httparty/logger/apache_logger_spec.rb +29 -14
- data/spec/httparty/net_digest_auth_spec.rb +11 -0
- data/spec/httparty/parser_spec.rb +10 -10
- data/spec/httparty/request_spec.rb +209 -30
- data/spec/httparty/response_spec.rb +41 -41
- data/spec/httparty/ssl_spec.rb +4 -4
- data/spec/httparty_spec.rb +78 -59
- data/spec/support/ssl_test_helper.rb +6 -6
- data/spec/support/stub_response.rb +2 -2
- data/website/index.html +3 -3
- metadata +15 -14
- data/spec/spec.opts +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c95cb69f9c1bafaf136df6ad12aa9b9447ad97f
|
4
|
+
data.tar.gz: c28653f64f4fd21a3538455e229df99e39775e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00ea60f1ee73a3c49b6f2a5be6cbe7e4bb18ee46b5517e8ffe6fb7de2d83fdfd122a986a57da4ec20a887e96711722fc7068e8c414faf530fbc50b68fe47c156
|
7
|
+
data.tar.gz: c15f982b49d90fe39fef463c1f12e8eec88b7a26466b0345fd963dbd8704c9a28d75cb4389889c013305f639f6470bc18c9d3c1d306b1799d12ce00f83fa7d65
|
data/Guardfile
CHANGED
data/History
CHANGED
@@ -1,8 +1,72 @@
|
|
1
|
-
== 0.
|
1
|
+
== 0.13.2
|
2
|
+
* minor improvement
|
3
|
+
* [Set correct path on redirect to filename](https://github.com/jnunemaker/httparty/pull/337)
|
4
|
+
* ensure logger works with curl format
|
2
5
|
|
6
|
+
== 0.13.1 2014-04-08
|
7
|
+
* new
|
8
|
+
* [Added ability to specify a body_stream in HttpRequest](https://github.com/jnunemaker/httparty/pull/275)
|
9
|
+
* [Added read_timeout and open_timeout options](https://github.com/jnunemaker/httparty/pull/278)
|
10
|
+
* change
|
11
|
+
* [Initialize HTTParty requests with an URI object and a String](https://github.com/jnunemaker/httparty/pull/274)
|
12
|
+
* minor improvement
|
13
|
+
* [Add stackexchange API example](https://github.com/jnunemaker/httparty/pull/280)
|
14
|
+
|
15
|
+
== 0.13.0 2014-02-14
|
16
|
+
* new
|
17
|
+
* [Add CSV support](https://github.com/jnunemaker/httparty/pull/269)
|
18
|
+
* [Allows PKCS12 client certificates](https://github.com/jnunemaker/httparty/pull/246)
|
19
|
+
* bug fix
|
20
|
+
* [Digest auth no longer fails when multiple headers are sent by the server](https://github.com/jnunemaker/httparty/pull/272)
|
21
|
+
* [Use 'Basement.copy' when calling 'HTTParty.copy'](https://github.com/jnunemaker/httparty/pull/268)
|
22
|
+
* [No longer appends ampersand when queries are embedded in paths](https://github.com/jnunemaker/httparty/pull/252)
|
23
|
+
* change
|
24
|
+
* [Merge - instead of overwrite - default headers with request provided headers](https://github.com/jnunemaker/httparty/pull/270)
|
25
|
+
* [Modernize respond_to implementations to support second param](https://github.com/jnunemaker/httparty/pull/264)
|
26
|
+
* [Sort query parameters by key before processing](https://github.com/jnunemaker/httparty/pull/245)
|
27
|
+
* minor improvement
|
28
|
+
* [Add HTTParty::Error base class](https://github.com/jnunemaker/httparty/pull/260)
|
29
|
+
|
30
|
+
== 0.12.0 2013-10-10
|
3
31
|
* new
|
4
|
-
* [
|
5
|
-
* [
|
32
|
+
* [Added initial logging support](https://github.com/jnunemaker/httparty/pull/243)
|
33
|
+
* [Add support for local host and port binding](https://github.com/jnunemaker/httparty/pull/238)
|
34
|
+
* [content_type_charset_support](https://github.com/jnunemaker/httparty/commit/82e351f0904e8ecc856015ff2854698a2ca47fbc)
|
35
|
+
* bug fix
|
36
|
+
* [No longer attempt to decompress the body on HEAD requests](https://github.com/jnunemaker/httparty/commit/f2b8cc3d49e0e9363d7054b14f30c340d7b8e7f1)
|
37
|
+
* [Adding java check in aliasing of multiple choices](https://github.com/jnunemaker/httparty/pull/204/commits)
|
38
|
+
* change
|
39
|
+
* [MIME-type files of javascript are returned as a string instead of JSON](https://github.com/jnunemaker/httparty/pull/239)
|
40
|
+
* [Made SSL connections use the system certificate store by default](https://github.com/jnunemaker/httparty/pull/226)
|
41
|
+
* [Do not pass proxy options to Net::HTTP connection if not specified](https://github.com/jnunemaker/httparty/pull/222)
|
42
|
+
* [Replace multi_json with stdlib json](https://github.com/jnunemaker/httparty/pull/214)
|
43
|
+
* [Require Ruby >= 1.9.3]
|
44
|
+
* [Response returns array of returned cookie strings](https://github.com/jnunemaker/httparty/pull/218)
|
45
|
+
* [Allow '=' within value of a cookie]
|
46
|
+
* minor improvements
|
47
|
+
* [Improve documentation of ssl_ca_file, ssl_ca_path](https://github.com/jnunemaker/httparty/pull/223)
|
48
|
+
* [Fix example URLs](https://github.com/jnunemaker/httparty/pull/232)
|
49
|
+
|
50
|
+
== 0.11.0 2013-04-10
|
51
|
+
* new
|
52
|
+
* [Add COPY http request handling](https://github.com/jnunemaker/httparty/pull/190)
|
53
|
+
* [Ruby 2.0 tests](https://github.com/jnunemaker/httparty/pull/194)
|
54
|
+
* [Ruby >= 2.0.0 support both multiple_choice? and multiple_choices?]
|
55
|
+
* bug fix
|
56
|
+
* [Maintain blocks passed to 'perform' in redirects](https://github.com/jnunemaker/httparty/pull/191)
|
57
|
+
* [Fixed nc value being quoted, this was against spec](https://github.com/jnunemaker/httparty/pull/196)
|
58
|
+
* [Request#uri no longer duplicates non-relative-path params](https://github.com/jnunemaker/httparty/pull/189)
|
59
|
+
* change
|
60
|
+
* [Client-side-only cookie attributes are removed: case-insensitive](https://github.com/jnunemaker/httparty/pull/188)
|
61
|
+
|
62
|
+
== 0.10.2 2013-01-26
|
63
|
+
* bug fix
|
64
|
+
* [hash_conversions misnamed variable](https://github.com/jnunemaker/httparty/pull/187)
|
65
|
+
|
66
|
+
== 0.10.1 2013-01-26
|
67
|
+
* new
|
68
|
+
* [Added support for MOVE requests](https://github.com/jnunemaker/httparty/pull/183)
|
69
|
+
* [Bump multi xml version](https://github.com/jnunemaker/httparty/pull/181)
|
6
70
|
|
7
71
|
== 0.10.0 2013-01-10
|
8
72
|
* changes
|
@@ -12,7 +76,6 @@
|
|
12
76
|
* new
|
13
77
|
* [support for connection adapters](https://github.com/jnunemaker/httparty/pull/157)
|
14
78
|
* [allow ssl_version on ruby 1.9](https://github.com/jnunemaker/httparty/pull/159)
|
15
|
-
|
16
79
|
* bug fixes
|
17
80
|
* [don't treat port 4430 as ssl](https://github.com/jnunemaker/httparty/commit/a296b1c97f83d7dcc6ef85720a43664c265685ac)
|
18
81
|
* [deep clone default options](https://github.com/jnunemaker/httparty/commit/f74227d30f9389b4b23a888c9af49fb9b8248e1f)
|
@@ -167,7 +230,7 @@
|
|
167
230
|
|
168
231
|
* minor enhancements
|
169
232
|
* Timeout option added; will raise a Timeout::Error after the timeout has elapsed (attack). Closes #17
|
170
|
-
HTTParty.get "http://github.com", :
|
233
|
+
HTTParty.get "http://github.com", timeout: 1
|
171
234
|
* Building gem with Jeweler
|
172
235
|
|
173
236
|
== 0.4.4 2009-07-19
|
@@ -282,20 +345,20 @@
|
|
282
345
|
== 0.1.3 2008-08-22
|
283
346
|
|
284
347
|
* 3 major enhancements:
|
285
|
-
|
286
|
-
|
287
|
-
|
348
|
+
* Added http_proxy key for setting proxy server and port (francxk@gmail.com)
|
349
|
+
* Now raises exception when http error occurs (francxk@gmail.com)
|
350
|
+
* Changed auto format detection from file extension to response content type (Jay Pignata)
|
288
351
|
|
289
352
|
== 0.1.2 2008-08-09
|
290
353
|
|
291
354
|
* 1 major enhancement:
|
292
|
-
|
355
|
+
* default_params were not being appended to query string if option[:query] was blank
|
293
356
|
|
294
357
|
== 0.1.1 2008-07-30
|
295
358
|
|
296
359
|
* 2 major enhancement:
|
297
|
-
|
298
|
-
|
360
|
+
* Added :basic_auth key for options when making a request
|
361
|
+
* :query and :body both now work with query string or hash
|
299
362
|
|
300
363
|
== 0.1.0 2008-07-27
|
301
364
|
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ class StackExchange
|
|
28
28
|
base_uri 'api.stackexchange.com'
|
29
29
|
|
30
30
|
def initialize(service, page)
|
31
|
-
@options = { :
|
31
|
+
@options = { query: {site: service, page: page} }
|
32
32
|
end
|
33
33
|
|
34
34
|
def questions
|
@@ -68,7 +68,10 @@ httparty "https://api.stackexchange.com/2.2/questions?site=stackoverflow"
|
|
68
68
|
## Contributing
|
69
69
|
|
70
70
|
* Fork the project.
|
71
|
+
* Run `bundle`
|
72
|
+
* Run `bundle exec rake`
|
71
73
|
* Make your feature addition or bug fix.
|
72
74
|
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
75
|
+
* Run `bundle exec rake` (No, REALLY :))
|
73
76
|
* 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)
|
74
77
|
* Send me a pull request. Bonus points for topic branches.
|
data/Rakefile
CHANGED
@@ -3,10 +3,9 @@ Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
3
3
|
spec.ruby_opts << '-rubygems'
|
4
4
|
spec.libs << 'lib' << 'spec'
|
5
5
|
spec.spec_files = FileList['spec/**/*_spec.rb']
|
6
|
-
spec.spec_opts = ['--options', 'spec/spec.opts']
|
7
6
|
end
|
8
7
|
|
9
8
|
require 'cucumber/rake/task'
|
10
9
|
Cucumber::Rake::Task.new(:features)
|
11
10
|
|
12
|
-
task :
|
11
|
+
task default: [:spec, :features]
|
data/bin/httparty
CHANGED
@@ -7,9 +7,9 @@ $:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
|
|
7
7
|
require "httparty"
|
8
8
|
|
9
9
|
opts = {
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
10
|
+
action: :get,
|
11
|
+
headers: {},
|
12
|
+
verbose: false
|
13
13
|
}
|
14
14
|
|
15
15
|
OptionParser.new do |o|
|
@@ -51,7 +51,7 @@ OptionParser.new do |o|
|
|
51
51
|
o.on("-u", "--user [CREDS]", "Use basic authentication. Value should be user:password") do |u|
|
52
52
|
abort "Invalid credentials format. Must be user:password" unless u =~ /.*:.+/
|
53
53
|
user, password = u.split(':')
|
54
|
-
opts[:basic_auth] = { :
|
54
|
+
opts[:basic_auth] = { username: user, password: password }
|
55
55
|
end
|
56
56
|
|
57
57
|
o.on("-r", "--response-code", "Command fails if response code >= 400") do
|
data/examples/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
## Examples
|
2
|
+
|
3
|
+
* [Amazon Book Search](aaws.rb)
|
4
|
+
* Httparty included into poro class
|
5
|
+
* Uses `get` requests
|
6
|
+
* Transforms query params to uppercased params
|
7
|
+
|
8
|
+
* [Google Search](google.rb)
|
9
|
+
* Httparty included into poro class
|
10
|
+
* Uses `get` requests
|
11
|
+
|
12
|
+
* [Crack Custom Parser](crack.rb)
|
13
|
+
* Creates a custom parser for XML using crack gem
|
14
|
+
* Uses `get` request
|
15
|
+
|
16
|
+
* [Create HTML Nokogiri parser](nokogiri_html_parser.rb)
|
17
|
+
* Adds Html as a format
|
18
|
+
* passed the body of request to Nokogiri
|
19
|
+
|
20
|
+
* [More Custom Parsers](custom_parsers.rb)
|
21
|
+
* Create an additional parser for atom or make it the ONLY parser
|
22
|
+
|
23
|
+
* [Basic Auth, Delicious](delicious.rb)
|
24
|
+
* Basic Auth, shows how to merge those into options
|
25
|
+
* Uses `get` requests
|
26
|
+
|
27
|
+
* [Passing Headers, User Agent](headers_and_user_agents.rb)
|
28
|
+
* Use the class method of Httparty
|
29
|
+
* Pass the User-Agent in the headers
|
30
|
+
* Uses `get` requests
|
31
|
+
|
32
|
+
* [Basic Post Request](basic.rb)
|
33
|
+
* Httparty included into poro class
|
34
|
+
* Uses `post` requests
|
35
|
+
|
36
|
+
* [Access Rubyurl Shortener](rubyurl.rb)
|
37
|
+
* Httparty included into poro class
|
38
|
+
* Uses `post` requests
|
39
|
+
|
40
|
+
* [Add a custom log file](logging.rb)
|
41
|
+
* create a log file and have httparty log requests
|
42
|
+
|
43
|
+
* [Accessing StackExchange](stackexchange.rb)
|
44
|
+
* Httparty included into poro class
|
45
|
+
* Creates methods for different endpoints
|
46
|
+
* Uses `get` requests
|
47
|
+
|
48
|
+
* [Accessing Tripit](tripit_sign_in.rb)
|
49
|
+
* Httparty included into poro class
|
50
|
+
* Example of using `debug_output` to see headers/urls passed
|
51
|
+
* Getting and using Cookies
|
52
|
+
* Uses `get` requests
|
53
|
+
|
54
|
+
* [Accessing Twitter](twitter.rb)
|
55
|
+
* Httparty included into poro class
|
56
|
+
* Basic Auth
|
57
|
+
* Loads settings from a config file
|
58
|
+
* Uses `get` requests
|
59
|
+
* Uses `post` requests
|
60
|
+
|
61
|
+
* [Accessing WhoIsMyRep](whoismyrep.rb)
|
62
|
+
* Httparty included into poro class
|
63
|
+
* Uses `get` requests
|
64
|
+
* Two ways to pass params to get, inline on the url or in query hash
|
data/examples/aaws.rb
CHANGED
@@ -10,10 +10,10 @@ module AAWS
|
|
10
10
|
class Book
|
11
11
|
include HTTParty
|
12
12
|
base_uri 'http://ecs.amazonaws.com'
|
13
|
-
default_params :
|
13
|
+
default_params Service: 'AWSECommerceService', Operation: 'ItemSearch', SearchIndex: 'Books'
|
14
14
|
|
15
15
|
def initialize(key)
|
16
|
-
self.class.default_params :
|
16
|
+
self.class.default_params AWSAccessKeyId: key
|
17
17
|
end
|
18
18
|
|
19
19
|
def search(options={})
|
@@ -29,4 +29,4 @@ module AAWS
|
|
29
29
|
end
|
30
30
|
|
31
31
|
aaws = AAWS::Book.new(config[:access_key])
|
32
|
-
pp aaws.search(:
|
32
|
+
pp aaws.search(query: {title: 'Ruby On Rails'})
|
data/examples/basic.rb
CHANGED
@@ -16,11 +16,11 @@ class Partay
|
|
16
16
|
end
|
17
17
|
|
18
18
|
options = {
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
19
|
+
body: {
|
20
|
+
pear: { # your resource
|
21
|
+
foo: '123', # your columns/data
|
22
|
+
bar: 'second',
|
23
|
+
baz: 'last thing'
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
data/examples/crack.rb
CHANGED
@@ -16,4 +16,4 @@ class Rep
|
|
16
16
|
end
|
17
17
|
|
18
18
|
pp Rep.get('http://whoismyrepresentative.com/getall_mems.php?zip=46544')
|
19
|
-
pp Rep.get('http://whoismyrepresentative.com/getall_mems.php', :
|
19
|
+
pp Rep.get('http://whoismyrepresentative.com/getall_mems.php', query: {zip: 46544})
|
data/examples/delicious.rb
CHANGED
@@ -8,16 +8,16 @@ class Delicious
|
|
8
8
|
base_uri 'https://api.del.icio.us/v1'
|
9
9
|
|
10
10
|
def initialize(u, p)
|
11
|
-
@auth = {:
|
11
|
+
@auth = {username: u, password: p}
|
12
12
|
end
|
13
13
|
|
14
14
|
# query params that filter the posts are:
|
15
15
|
# tag (optional). Filter by this tag.
|
16
16
|
# dt (optional). Filter by this date (CCYY-MM-DDThh:mm:ssZ).
|
17
17
|
# url (optional). Filter by this url.
|
18
|
-
# ie: posts(:
|
18
|
+
# ie: posts(query: {tag: 'ruby'})
|
19
19
|
def posts(options={})
|
20
|
-
options.merge!({:
|
20
|
+
options.merge!({basic_auth: @auth})
|
21
21
|
self.class.get('/posts/get', options)
|
22
22
|
end
|
23
23
|
|
@@ -25,13 +25,13 @@ class Delicious
|
|
25
25
|
# tag (optional). Filter by this tag.
|
26
26
|
# count (optional). Number of items to retrieve (Default:15, Maximum:100).
|
27
27
|
def recent(options={})
|
28
|
-
options.merge!({:
|
28
|
+
options.merge!({basic_auth: @auth})
|
29
29
|
self.class.get('/posts/recent', options)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
delicious = Delicious.new(config['username'], config['password'])
|
34
|
-
pp delicious.posts(:
|
34
|
+
pp delicious.posts(query: {tag: 'ruby'})
|
35
35
|
pp delicious.recent
|
36
36
|
|
37
37
|
delicious.recent['posts']['post'].each { |post| puts post['href'] }
|
data/examples/logging.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
require File.join(dir, 'httparty')
|
3
|
+
require 'logger'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
my_logger = Logger.new "httparty.log"
|
7
|
+
|
8
|
+
my_logger.info "Logging can be used on the main HTTParty class. It logs redirects too."
|
9
|
+
HTTParty.get "http://google.com", logger: my_logger
|
10
|
+
|
11
|
+
my_logger.info '*'*70
|
12
|
+
|
13
|
+
my_logger.info "It can be used also on a custom class."
|
14
|
+
|
15
|
+
class Google
|
16
|
+
include HTTParty
|
17
|
+
logger ::Logger.new "httparty.log"
|
18
|
+
end
|
19
|
+
|
20
|
+
Google.get "http://google.com"
|
21
|
+
|
22
|
+
my_logger.info '*'*70
|
23
|
+
|
24
|
+
my_logger.info "The default formatter is :apache. The :curl formatter can also be used."
|
25
|
+
my_logger.info "You can tell wich method to call on the logger too. It is info by default."
|
26
|
+
HTTParty.get "http://google.com", logger: my_logger, log_level: :debug, log_format: :curl
|
27
|
+
|
28
|
+
|
29
|
+
my_logger.info '*'*70
|
30
|
+
|
31
|
+
my_logger.info "These configs are also available on custom classes."
|
32
|
+
class Google
|
33
|
+
include HTTParty
|
34
|
+
logger ::Logger.new("httparty.log"), :debug, :curl
|
35
|
+
end
|
36
|
+
|
37
|
+
Google.get "http://google.com"
|
38
|
+
|
data/examples/rubyurl.rb
CHANGED
data/examples/stackexchange.rb
CHANGED
data/examples/tripit_sign_in.rb
CHANGED
@@ -11,17 +11,17 @@ class TripIt
|
|
11
11
|
response = self.class.get('/account/login')
|
12
12
|
response = self.class.post(
|
13
13
|
'/account/login',
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
14
|
+
body: {
|
15
|
+
login_email_address: email,
|
16
|
+
login_password: password
|
17
17
|
},
|
18
|
-
:
|
18
|
+
headers: {'Cookie' => response.headers['Set-Cookie']}
|
19
19
|
)
|
20
20
|
@cookie = response.request.options[:headers]['Cookie']
|
21
21
|
end
|
22
22
|
|
23
23
|
def account_settings
|
24
|
-
self.class.get('/account/edit', :
|
24
|
+
self.class.get('/account/edit', headers: {'Cookie' => @cookie})
|
25
25
|
end
|
26
26
|
|
27
27
|
def logged_in?
|
data/examples/twitter.rb
CHANGED
@@ -8,24 +8,24 @@ class Twitter
|
|
8
8
|
base_uri 'twitter.com'
|
9
9
|
|
10
10
|
def initialize(u, p)
|
11
|
-
@auth = {:
|
11
|
+
@auth = {username: u, password: p}
|
12
12
|
end
|
13
13
|
|
14
14
|
# which can be :friends, :user or :public
|
15
15
|
# options[:query] can be things like since, since_id, count, etc.
|
16
16
|
def timeline(which=:friends, options={})
|
17
|
-
options.merge!({:
|
17
|
+
options.merge!({basic_auth: @auth})
|
18
18
|
self.class.get("/statuses/#{which}_timeline.json", options)
|
19
19
|
end
|
20
20
|
|
21
21
|
def post(text)
|
22
|
-
options = { :
|
22
|
+
options = { query: {status: text}, basic_auth: @auth }
|
23
23
|
self.class.post('/statuses/update.json', options)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
twitter = Twitter.new(config['email'], config['password'])
|
28
28
|
pp twitter.timeline
|
29
|
-
# pp twitter.timeline(:friends, :
|
30
|
-
# pp twitter.timeline(:friends, :
|
29
|
+
# pp twitter.timeline(:friends, query: {since_id: 868482746})
|
30
|
+
# pp twitter.timeline(:friends, query: 'since_id=868482746')
|
31
31
|
# pp twitter.post('this is a test of 0.2.0')
|