dustin-twitter 0.3.2.1 → 0.3.2.2
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.
- data/lib/twitter/base.rb +4 -3
- data/twitter.gemspec +1 -1
- metadata +1 -1
data/lib/twitter/base.rb
CHANGED
@@ -7,9 +7,10 @@ module Twitter
|
|
7
7
|
class Base
|
8
8
|
|
9
9
|
# Initializes the configuration for making requests to twitter
|
10
|
-
def initialize(email, password, host='twitter.com')
|
10
|
+
def initialize(email, password, host='twitter.com', path='')
|
11
11
|
@config, @config[:email], @config[:password] = {}, email, password
|
12
12
|
@api_host = host
|
13
|
+
@api_path = path
|
13
14
|
end
|
14
15
|
|
15
16
|
# Returns an array of statuses for a timeline; Defaults to your friends timeline.
|
@@ -87,7 +88,7 @@ module Twitter
|
|
87
88
|
|
88
89
|
# Sends a direct message <code>text</code> to <code>user</code>
|
89
90
|
def d(user, text)
|
90
|
-
url = URI.parse("http://#{@api_host}/direct_messages/new.xml")
|
91
|
+
url = URI.parse("http://#{@api_host}#{@api_path}/direct_messages/new.xml")
|
91
92
|
req = Net::HTTP::Post.new(url.path)
|
92
93
|
req.basic_auth(@config[:email], @config[:password])
|
93
94
|
req.set_form_data({'text' => text, 'user' => user})
|
@@ -160,7 +161,7 @@ module Twitter
|
|
160
161
|
def post(status, options={})
|
161
162
|
form_data = {'status' => status}
|
162
163
|
form_data.merge({'source' => options[:source]}) if options[:source]
|
163
|
-
url = URI.parse("http://#{@api_host}/statuses/update.xml")
|
164
|
+
url = URI.parse("http://#{@api_host}#{@api_path}/statuses/update.xml")
|
164
165
|
req = Net::HTTP::Post.new(url.path)
|
165
166
|
req.basic_auth(@config[:email], @config[:password])
|
166
167
|
req.set_form_data(form_data)
|
data/twitter.gemspec
CHANGED