tweetwine 0.2.12 → 0.3.0

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.
Files changed (67) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/Gemfile +17 -0
  3. data/README.md +57 -47
  4. data/Rakefile +17 -26
  5. data/bin/tweetwine +11 -12
  6. data/contrib/tweetwine-completion.bash +2 -3
  7. data/example/application_behavior_example.rb +173 -0
  8. data/example/example_helper.rb +44 -28
  9. data/example/fixture/config.yaml +8 -0
  10. data/example/fixture/shorten_rubygems.html +5 -0
  11. data/example/fixture/shorten_rubylang.html +5 -0
  12. data/example/fixture/update_utf8.json +1 -0
  13. data/example/fixture/update_with_urls.json +1 -0
  14. data/example/fixture/{update.json → update_without_urls.json} +0 -0
  15. data/example/search_statuses_example.rb +49 -16
  16. data/example/show_followers_example.rb +7 -8
  17. data/example/show_friends_example.rb +7 -8
  18. data/example/show_home_example.rb +19 -16
  19. data/example/show_mentions_example.rb +8 -9
  20. data/example/show_user_example.rb +16 -13
  21. data/example/update_status_example.rb +143 -26
  22. data/example/use_http_proxy_example.rb +40 -20
  23. data/lib/tweetwine/basic_object.rb +19 -0
  24. data/lib/tweetwine/character_encoding.rb +59 -0
  25. data/lib/tweetwine/cli.rb +354 -230
  26. data/lib/tweetwine/config.rb +65 -0
  27. data/lib/tweetwine/http.rb +120 -0
  28. data/lib/tweetwine/oauth.rb +104 -0
  29. data/lib/tweetwine/obfuscate.rb +21 -0
  30. data/lib/tweetwine/option_parser.rb +31 -0
  31. data/lib/tweetwine/promise.rb +39 -0
  32. data/lib/tweetwine/twitter.rb +211 -0
  33. data/lib/tweetwine/{io.rb → ui.rb} +30 -21
  34. data/lib/tweetwine/url_shortener.rb +15 -9
  35. data/lib/tweetwine/util.rb +30 -15
  36. data/lib/tweetwine.rb +72 -12
  37. data/man/tweetwine.7 +43 -69
  38. data/man/tweetwine.7.ronn +57 -47
  39. data/test/character_encoding_test.rb +87 -0
  40. data/test/cli_test.rb +19 -6
  41. data/test/config_test.rb +244 -0
  42. data/test/fixture/oauth.rb +21 -0
  43. data/test/fixture/test_config.yaml +4 -4
  44. data/test/http_test.rb +199 -0
  45. data/test/oauth_test.rb +77 -0
  46. data/test/obfuscate_test.rb +16 -0
  47. data/test/option_parser_test.rb +60 -0
  48. data/test/promise_test.rb +56 -0
  49. data/test/test_helper.rb +76 -8
  50. data/test/twitter_test.rb +625 -0
  51. data/test/{io_test.rb → ui_test.rb} +92 -74
  52. data/test/url_shortener_test.rb +115 -135
  53. data/test/util_test.rb +136 -85
  54. data/tweetwine.gemspec +53 -0
  55. metadata +112 -56
  56. data/example/show_metadata_example.rb +0 -86
  57. data/lib/tweetwine/client.rb +0 -187
  58. data/lib/tweetwine/meta.rb +0 -5
  59. data/lib/tweetwine/options.rb +0 -24
  60. data/lib/tweetwine/retrying_http.rb +0 -99
  61. data/lib/tweetwine/startup_config.rb +0 -50
  62. data/man/tweetwine.1 +0 -109
  63. data/man/tweetwine.1.ronn +0 -69
  64. data/test/client_test.rb +0 -544
  65. data/test/options_test.rb +0 -45
  66. data/test/retrying_http_test.rb +0 -147
  67. data/test/startup_config_test.rb +0 -162
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweetwine
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
- - 12
9
- version: 0.2.12
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tuomas Kareinen
@@ -18,68 +19,78 @@ date: 2010-02-28 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: rest-client
22
+ name: oauth
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
- - - ">="
27
+ - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 7
27
30
  segments:
28
- - 1
29
- - 0
30
31
  - 0
31
- version: 1.0.0
32
+ - 4
33
+ - 4
34
+ version: 0.4.4
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
- name: contest
38
+ name: json
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 23
41
46
  segments:
42
- - 0
43
47
  - 1
44
- - 2
45
- version: 0.1.2
46
- type: :development
48
+ - 0
49
+ - 0
50
+ version: 1.0.0
51
+ type: :runtime
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
- name: coulda
54
+ name: contest
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
- - - ">="
59
+ - - ~>
54
60
  - !ruby/object:Gem::Version
61
+ hash: 31
55
62
  segments:
56
63
  - 0
57
- - 5
58
- - 3
59
- version: 0.5.3
64
+ - 1
65
+ - 2
66
+ version: 0.1.2
60
67
  type: :development
61
68
  version_requirements: *id003
62
69
  - !ruby/object:Gem::Dependency
63
- name: fakeweb
70
+ name: coulda
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
- - - ">="
75
+ - - ~>
68
76
  - !ruby/object:Gem::Version
77
+ hash: 7
69
78
  segments:
70
- - 1
71
- - 2
72
- - 8
73
- version: 1.2.8
79
+ - 0
80
+ - 6
81
+ - 0
82
+ version: 0.6.0
74
83
  type: :development
75
84
  version_requirements: *id004
76
85
  - !ruby/object:Gem::Dependency
77
86
  name: gem-man
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
- - - ">="
91
+ - - ~>
82
92
  - !ruby/object:Gem::Version
93
+ hash: 23
83
94
  segments:
84
95
  - 0
85
96
  - 2
@@ -91,23 +102,27 @@ dependencies:
91
102
  name: matchy
92
103
  prerelease: false
93
104
  requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
94
106
  requirements:
95
- - - ">="
107
+ - - ~>
96
108
  - !ruby/object:Gem::Version
109
+ hash: 15
97
110
  segments:
98
111
  - 0
99
- - 3
100
- - 3
101
- version: 0.3.3
112
+ - 5
113
+ - 2
114
+ version: 0.5.2
102
115
  type: :development
103
116
  version_requirements: *id006
104
117
  - !ruby/object:Gem::Dependency
105
118
  name: mocha
106
119
  prerelease: false
107
120
  requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
108
122
  requirements:
109
- - - ">="
123
+ - - "="
110
124
  - !ruby/object:Gem::Version
125
+ hash: 43
111
126
  segments:
112
127
  - 0
113
128
  - 9
@@ -119,43 +134,66 @@ dependencies:
119
134
  name: open4
120
135
  prerelease: false
121
136
  requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
122
138
  requirements:
123
139
  - - ~>
124
140
  - !ruby/object:Gem::Version
141
+ hash: 21
125
142
  segments:
126
143
  - 1
127
144
  - 0
128
- version: "1.0"
145
+ - 1
146
+ version: 1.0.1
129
147
  type: :development
130
148
  version_requirements: *id008
131
149
  - !ruby/object:Gem::Dependency
132
150
  name: ronn
133
151
  prerelease: false
134
152
  requirement: &id009 !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - ">="
155
+ - - ~>
137
156
  - !ruby/object:Gem::Version
157
+ hash: 5
138
158
  segments:
139
159
  - 0
140
- - 5
141
- - 0
142
- version: 0.5.0
160
+ - 7
161
+ - 3
162
+ version: 0.7.3
143
163
  type: :development
144
164
  version_requirements: *id009
145
165
  - !ruby/object:Gem::Dependency
146
166
  name: timecop
147
167
  prerelease: false
148
168
  requirement: &id010 !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - ">="
171
+ - - ~>
151
172
  - !ruby/object:Gem::Version
173
+ hash: 25
152
174
  segments:
153
175
  - 0
154
176
  - 3
155
- - 4
156
- version: 0.3.4
177
+ - 5
178
+ version: 0.3.5
157
179
  type: :development
158
180
  version_requirements: *id010
181
+ - !ruby/object:Gem::Dependency
182
+ name: webmock
183
+ prerelease: false
184
+ requirement: &id011 !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 1
192
+ - 5
193
+ - 0
194
+ version: 1.5.0
195
+ type: :development
196
+ version_requirements: *id011
159
197
  description: A simple but tasty Twitter agent for command line use, made for fun.
160
198
  email: tkareine@gmail.com
161
199
  executables:
@@ -166,17 +204,25 @@ extra_rdoc_files:
166
204
  - CHANGELOG.rdoc
167
205
  - LICENSE.txt
168
206
  files:
207
+ - README.md
169
208
  - CHANGELOG.rdoc
170
209
  - LICENSE.txt
210
+ - Gemfile
171
211
  - Rakefile
172
- - README.md
212
+ - tweetwine.gemspec
173
213
  - bin/tweetwine
174
214
  - contrib/tweetwine-completion.bash
215
+ - example/application_behavior_example.rb
175
216
  - example/example_helper.rb
217
+ - example/fixture/config.yaml
176
218
  - example/fixture/home.json
177
219
  - example/fixture/mentions.json
178
220
  - example/fixture/search.json
179
- - example/fixture/update.json
221
+ - example/fixture/shorten_rubygems.html
222
+ - example/fixture/shorten_rubylang.html
223
+ - example/fixture/update_utf8.json
224
+ - example/fixture/update_with_urls.json
225
+ - example/fixture/update_without_urls.json
180
226
  - example/fixture/user.json
181
227
  - example/fixture/users.json
182
228
  - example/search_statuses_example.rb
@@ -184,33 +230,39 @@ files:
184
230
  - example/show_friends_example.rb
185
231
  - example/show_home_example.rb
186
232
  - example/show_mentions_example.rb
187
- - example/show_metadata_example.rb
188
233
  - example/show_user_example.rb
189
234
  - example/update_status_example.rb
190
235
  - example/use_http_proxy_example.rb
236
+ - lib/tweetwine/basic_object.rb
237
+ - lib/tweetwine/character_encoding.rb
191
238
  - lib/tweetwine/cli.rb
192
- - lib/tweetwine/client.rb
193
- - lib/tweetwine/io.rb
194
- - lib/tweetwine/meta.rb
195
- - lib/tweetwine/options.rb
196
- - lib/tweetwine/retrying_http.rb
197
- - lib/tweetwine/startup_config.rb
239
+ - lib/tweetwine/config.rb
240
+ - lib/tweetwine/http.rb
241
+ - lib/tweetwine/oauth.rb
242
+ - lib/tweetwine/obfuscate.rb
243
+ - lib/tweetwine/option_parser.rb
244
+ - lib/tweetwine/promise.rb
245
+ - lib/tweetwine/twitter.rb
246
+ - lib/tweetwine/ui.rb
198
247
  - lib/tweetwine/url_shortener.rb
199
248
  - lib/tweetwine/util.rb
200
249
  - lib/tweetwine.rb
250
+ - test/character_encoding_test.rb
201
251
  - test/cli_test.rb
202
- - test/client_test.rb
252
+ - test/config_test.rb
253
+ - test/fixture/oauth.rb
203
254
  - test/fixture/test_config.yaml
204
- - test/io_test.rb
205
- - test/options_test.rb
206
- - test/retrying_http_test.rb
207
- - test/startup_config_test.rb
255
+ - test/http_test.rb
256
+ - test/oauth_test.rb
257
+ - test/obfuscate_test.rb
258
+ - test/option_parser_test.rb
259
+ - test/promise_test.rb
208
260
  - test/test_helper.rb
261
+ - test/twitter_test.rb
262
+ - test/ui_test.rb
209
263
  - test/url_shortener_test.rb
210
264
  - test/util_test.rb
211
- - man/tweetwine.1
212
265
  - man/tweetwine.7
213
- - man/tweetwine.1.ronn
214
266
  - man/tweetwine.7.ronn
215
267
  has_rdoc: true
216
268
  homepage: http://github.com/tuomas/tweetwine
@@ -219,29 +271,33 @@ licenses: []
219
271
  post_install_message:
220
272
  rdoc_options:
221
273
  - --title
222
- - tweetwine 0.2.12
274
+ - tweetwine 0.3.0
223
275
  - --exclude
224
276
  - test
225
277
  require_paths:
226
278
  - lib
227
279
  required_ruby_version: !ruby/object:Gem::Requirement
280
+ none: false
228
281
  requirements:
229
282
  - - ">="
230
283
  - !ruby/object:Gem::Version
284
+ hash: 3
231
285
  segments:
232
286
  - 0
233
287
  version: "0"
234
288
  required_rubygems_version: !ruby/object:Gem::Requirement
289
+ none: false
235
290
  requirements:
236
291
  - - ">="
237
292
  - !ruby/object:Gem::Version
293
+ hash: 3
238
294
  segments:
239
295
  - 0
240
296
  version: "0"
241
297
  requirements: []
242
298
 
243
299
  rubyforge_project:
244
- rubygems_version: 1.3.6
300
+ rubygems_version: 1.3.7
245
301
  signing_key:
246
302
  specification_version: 2
247
303
  summary: A simple Twitter command line agent
@@ -1,86 +0,0 @@
1
- # coding: utf-8
2
-
3
- require "example_helper"
4
-
5
- Feature "show metadata" do
6
- in_order_to "know about the application"
7
- as_a "user"
8
- i_want_to "see application metadata"
9
-
10
- Scenario "see version with designated exit status" do
11
- When "application is launched with -v" do
12
- @status = launch_app("-v") do |pid, stdin, stdout|
13
- @output = stdout.gets
14
- end
15
- end
16
-
17
- Then "version is shown" do
18
- @output.should =~ /\d+\.\d+\.\d+$/
19
- @status.exitstatus.should == CLI::EXIT_VERSION
20
- end
21
- end
22
-
23
- Scenario "see help with designated exit status" do
24
- When "application is launched with -h" do
25
- @status = launch_app("-h") do |pid, stdin, stdout|
26
- @output = stdout.readlines
27
- end
28
- end
29
-
30
- Then "help is shown" do
31
- @output.join.should == <<-END
32
- A simple but tasty Twitter agent for command line use, made for fun.
33
-
34
- Usage: tweetwine [global_options...] [command] [command_options...]
35
-
36
- [command] is one of
37
- * followers,
38
- * friends,
39
- * home,
40
- * mentions,
41
- * search,
42
- * update, or
43
- * user.
44
-
45
- The default command is home.
46
-
47
- [global_options]:
48
- -a, --auth USERNAME:PASSWORD Authentication
49
- -c, --colors Colorize output with ANSI escape codes
50
- -n, --num N The number of statuses in page, default 20
51
- --no-colors Do not use ANSI colors
52
- --no-http-proxy Do not use proxy for HTTP and HTTPS
53
- --no-url-shorten Do not shorten URLs for status update
54
- -p, --page N The page number for statuses, default 1
55
- --http-proxy URL Use proxy for HTTP and HTTPS
56
- -v, --version Show version information and exit
57
- -h, --help Show this help message and exit
58
- END
59
- @status.exitstatus.should == CLI::EXIT_HELP
60
- end
61
- end
62
-
63
- Scenario "upon invalid option, use designated exit status" do
64
- When "application is launched with -X" do
65
- @status = launch_app("-X") do |pid, stdin, stdout|
66
- @output = stdout.readlines
67
- end
68
- end
69
-
70
- Then "designated exit status is returned" do
71
- @status.exitstatus.should == CLI::EXIT_ERROR
72
- end
73
- end
74
-
75
- Scenario "upon invalid command, use designated exit status" do
76
- When "application is launched with 'unknown'" do
77
- @status = launch_app("unknown") do |pid, stdin, stdout|
78
- @output = stdout.readlines
79
- end
80
- end
81
-
82
- Then "designated exit status is returned" do
83
- @status.exitstatus.should == CLI::EXIT_ERROR
84
- end
85
- end
86
- end
@@ -1,187 +0,0 @@
1
- # coding: utf-8
2
-
3
- require "json"
4
- require "uri"
5
-
6
- module Tweetwine
7
- class Client
8
- Dependencies = Struct.new :io, :http_client, :url_shortener
9
-
10
- COMMANDS = [:followers, :friends, :home, :mentions, :search, :update, :user]
11
- DEFAULT_COMMAND = :home
12
-
13
- DEFAULT_NUM_STATUSES = 20
14
- DEFAULT_PAGE_NUM = 1
15
- MAX_STATUS_LENGTH = 140
16
-
17
- attr_reader :num_statuses, :page_num
18
-
19
- def initialize(dependencies, options)
20
- @io = dependencies.io
21
- @username = options[:username].to_s
22
- raise ArgumentError, "No authentication data given" if @username.empty?
23
- RetryingHttp.proxy = options[:http_proxy] if options[:http_proxy]
24
- @http_client = dependencies.http_client
25
- @http_resource = @http_client.as_resource("https://twitter.com", :user => @username, :password => options[:password])
26
- @num_statuses = Util.parse_int_gt(options[:num_statuses], DEFAULT_NUM_STATUSES, 1, "number of statuses_to_show")
27
- @page_num = Util.parse_int_gt(options[:page_num], DEFAULT_PAGE_NUM, 1, "page number")
28
- @url_shortener = if options[:shorten_urls] && options[:shorten_urls][:enable]
29
- dependencies.url_shortener.call(options[:shorten_urls])
30
- end
31
- end
32
-
33
- def followers(args = [], options = nil)
34
- response = get_from_rest_api("statuses/followers/#{@username}")
35
- show_users_from_rest_api(*response)
36
- end
37
-
38
- def friends(args = [], options = nil)
39
- response = get_from_rest_api("statuses/friends/#{@username}")
40
- show_users_from_rest_api(*response)
41
- end
42
-
43
- def home(args = [], options = nil)
44
- response = get_from_rest_api("statuses/home_timeline", :num_statuses, :page)
45
- show_statuses_from_rest_api(*response)
46
- end
47
-
48
- def mentions(args = [], options = nil)
49
- response = get_from_rest_api("statuses/mentions", :num_statuses, :page)
50
- show_statuses_from_rest_api(*response)
51
- end
52
-
53
- def search(args = [], options = nil)
54
- raise ArgumentError, "No search word" if args.empty?
55
- query = if options && options[:bin_op] == :or then args.join(" OR ") else args.join(" ") end
56
- response = get_from_search_api(query, :num_statuses, :page)
57
- show_statuses_from_search_api(*response["results"])
58
- end
59
-
60
- def update(args = [], options = nil)
61
- new_status = create_status_update(args.join(" "))
62
- completed = false
63
- unless new_status.empty?
64
- @io.show_status_preview(new_status)
65
- if @io.confirm("Really send?")
66
- response = post_to_rest_api("statuses/update", :status => new_status.to_s)
67
- @io.info "Sent status update.\n\n"
68
- show_statuses_from_rest_api(response)
69
- completed = true
70
- end
71
- end
72
- @io.info "Cancelled." unless completed
73
- end
74
-
75
- def user(args = [], options = nil)
76
- user = if args.empty? then @username else args.first end
77
- response = get_from_rest_api("statuses/user_timeline/#{user}", :num_statuses, :page)
78
- show_statuses_from_rest_api(*response)
79
- end
80
-
81
- private
82
-
83
- def get_from_rest_api(sub_url, *query_opts)
84
- query_str = query_options_to_string(query_opts, :page => "page", :num_statuses => "count")
85
- url_suffix = unless query_str.empty? then "?" << query_str else "" end
86
- JSON.parse(@http_resource[sub_url + ".json" + url_suffix].get)
87
- end
88
-
89
- def post_to_rest_api(sub_url, payload)
90
- JSON.parse(@http_resource[sub_url + ".json"].post(payload))
91
- end
92
-
93
- def get_from_search_api(query, *query_opts)
94
- query_str = "q=#{Util.percent_encode(query)}&" \
95
- << query_options_to_string(query_opts, :page => "page", :num_statuses => "rpp")
96
- JSON.parse(@http_client.get("http://search.twitter.com/search.json?#{query_str}"))
97
- end
98
-
99
- def query_options_to_string(query_opts, key_mappings)
100
- pairs = []
101
- query_opts.each do |opt|
102
- case opt
103
- when :page
104
- pairs << "#{key_mappings[:page]}=#{@page_num}"
105
- when :num_statuses
106
- pairs << "#{key_mappings[:num_statuses]}=#{@num_statuses}"
107
- # else: ignore unknown query options
108
- end
109
- end
110
- pairs.join("&")
111
- end
112
-
113
- def show_statuses_from_rest_api(*responses)
114
- show_records(
115
- responses,
116
- {
117
- :from_user => ["user", "screen_name"],
118
- :to_user => "in_reply_to_screen_name",
119
- :created_at => "created_at",
120
- :status => "text"
121
- }
122
- )
123
- end
124
-
125
- def show_users_from_rest_api(*responses)
126
- show_records(
127
- responses,
128
- {
129
- :from_user => "screen_name",
130
- :to_user => ["status", "in_reply_to_screen_name"],
131
- :created_at => ["status", "created_at"],
132
- :status => ["status", "text"]
133
- }
134
- )
135
- end
136
-
137
- def show_statuses_from_search_api(*responses)
138
- show_records(
139
- responses,
140
- {
141
- :from_user => "from_user",
142
- :to_user => "to_user",
143
- :created_at => "created_at",
144
- :status => "text"
145
- }
146
- )
147
- end
148
-
149
- def show_records(twitter_records, paths)
150
- twitter_records.each do |twitter_record|
151
- internal_record = [ :from_user, :to_user, :created_at, :status ].inject({}) do |result, key|
152
- result[key] = Util.find_hash_path(twitter_record, paths[key])
153
- result
154
- end
155
- @io.show_record(internal_record)
156
- end
157
- end
158
-
159
- def create_status_update(status)
160
- status = if status.nil? || status.empty?
161
- @io.prompt("Status update")
162
- else
163
- status.dup
164
- end
165
- status.strip!
166
- shorten_urls_in(status) if @url_shortener
167
- truncate_status(status) if status.length > MAX_STATUS_LENGTH
168
- status
169
- end
170
-
171
- def shorten_urls_in(status)
172
- url_pairs = URI.extract(status, ["http", "https"]).uniq.map do |url_to_be_shortened|
173
- [url_to_be_shortened, @url_shortener.shorten(url_to_be_shortened)]
174
- end
175
- url_pairs.reject { |pair| pair.last.nil? || pair.last.empty? }.each do |url_pair|
176
- status.gsub!(url_pair.first, url_pair.last)
177
- end
178
- rescue HttpError, LoadError => e
179
- @io.warn "#{e}. Skipping URL shortening..."
180
- end
181
-
182
- def truncate_status(status)
183
- status.replace status[0...MAX_STATUS_LENGTH]
184
- @io.warn("Status will be truncated.")
185
- end
186
- end
187
- end
@@ -1,5 +0,0 @@
1
- # coding: utf-8
2
-
3
- module Tweetwine
4
- VERSION = "0.2.12".freeze
5
- end
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
-
3
- module Tweetwine
4
- class Options
5
- def initialize(options, source = nil)
6
- @hash = options.to_hash
7
- @source = source
8
- end
9
-
10
- def [](key)
11
- @hash[key]
12
- end
13
-
14
- def require(key)
15
- value = @hash[key]
16
- if value.nil?
17
- msg = "Option #{key} is required"
18
- msg << " for #{@source}" if @source
19
- raise ArgumentError, msg
20
- end
21
- value
22
- end
23
- end
24
- end