atig 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.mkdn +1 -2
- data/atig.gemspec +1 -0
- data/lib/atig/command/status.rb +8 -6
- data/lib/atig/http.rb +1 -2
- data/lib/atig/oauth.rb +1 -1
- data/lib/atig/option.rb +1 -1
- data/lib/atig/search.rb +1 -1
- data/lib/atig/version.rb +1 -1
- data/spec/command/status_spec.rb +18 -9
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 600b07b559862ae694b0c7c99890c9e043a9aa6a
|
4
|
+
data.tar.gz: ae106983e3d0c5846c41c8ff8e93370f981ac7d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9b3350f024a475f036f26734c2e5fae1bbd3fb73a93279579b060a44a04a897a88d2e7b66e8cd226d76eeedc16475e6ece90099900ee0cd6cea7c6fff6d1a35
|
7
|
+
data.tar.gz: 00ff15638abddb5064b478a30c3c30e15c3c15b36991418fc90f1adfd7f566a63c493360d7befe27d0c37c0e2368406a8cfde2124bf402406a72e8793020deec
|
data/README.mkdn
CHANGED
@@ -10,9 +10,8 @@ Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.
|
|
10
10
|
PREREQUISITES
|
11
11
|
-------------
|
12
12
|
|
13
|
-
* Ruby 1.
|
13
|
+
* Ruby 1.9.3 or later
|
14
14
|
* sqlite3-ruby
|
15
|
-
* json(when use Ruby 1.8)
|
16
15
|
* rspec(for unit test)
|
17
16
|
* rake(for unit test)
|
18
17
|
|
data/atig.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency 'sqlite3', ['>= 1.3.2']
|
21
21
|
gem.add_dependency 'net-irc', ['>= 0']
|
22
22
|
gem.add_dependency 'oauth', ['>= 0']
|
23
|
+
gem.add_dependency 'twitter-text', ['~> 1.7.0']
|
23
24
|
|
24
25
|
gem.add_development_dependency 'bundler'
|
25
26
|
gem.add_development_dependency 'rspec'
|
data/lib/atig/command/status.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# -*- mode:ruby; coding:utf-8 -*-
|
2
2
|
require 'atig/command/command'
|
3
|
-
|
4
|
-
require 'jcode'
|
5
|
-
rescue LoadError
|
6
|
-
end
|
3
|
+
require 'twitter-text'
|
7
4
|
|
8
5
|
module Atig
|
9
6
|
module Command
|
10
7
|
class Status < Atig::Command::Command
|
11
|
-
|
8
|
+
include ::Twitter::Validation
|
9
|
+
|
12
10
|
def command_name; %w(status) end
|
13
11
|
|
14
12
|
def action(target, mesg, command, args)
|
@@ -26,9 +24,13 @@ module Atig
|
|
26
24
|
end
|
27
25
|
q = gateway.output_message(:status => text)
|
28
26
|
|
29
|
-
|
27
|
+
case tweet_invalid? q[:status]
|
28
|
+
when :too_long
|
30
29
|
yield "You can't submit the status over 140 chars"
|
31
30
|
return
|
31
|
+
when :invalid_characters
|
32
|
+
yield "You can't submit the status invalid chars"
|
33
|
+
return
|
32
34
|
end
|
33
35
|
|
34
36
|
api.delay(0, :retry=>3) do|t|
|
data/lib/atig/http.rb
CHANGED
@@ -49,9 +49,8 @@ module Atig
|
|
49
49
|
http.open_timeout = open_timeout if open_timeout # nil by default
|
50
50
|
http.read_timeout = read_timeout if read_timeout # 60 by default
|
51
51
|
if uri.is_a? URI::HTTPS
|
52
|
-
http.use_ssl
|
52
|
+
http.use_ssl = true
|
53
53
|
http.cert_store = @cert_store
|
54
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
55
54
|
end
|
56
55
|
http
|
57
56
|
rescue => e
|
data/lib/atig/oauth.rb
CHANGED
data/lib/atig/option.rb
CHANGED
@@ -31,7 +31,7 @@ module Atig
|
|
31
31
|
|
32
32
|
default_value :api_base, 'https://api.twitter.com/1.1/'
|
33
33
|
default_value :stream_api_base, 'https://userstream.twitter.com/2/'
|
34
|
-
default_value :search_api_base, '
|
34
|
+
default_value :search_api_base, 'https://search.twitter.com/'
|
35
35
|
|
36
36
|
def initialize(table)
|
37
37
|
@table = {}
|
data/lib/atig/search.rb
CHANGED
@@ -5,7 +5,7 @@ require 'atig/url_escape'
|
|
5
5
|
module Atig
|
6
6
|
class Search
|
7
7
|
def search(query, options = {})
|
8
|
-
search = URI("
|
8
|
+
search = URI("https://search.twitter.com")
|
9
9
|
search.path = "/search.json"
|
10
10
|
params = options; options[:q] = query
|
11
11
|
search.query = options.to_query_str
|
data/lib/atig/version.rb
CHANGED
data/spec/command/status_spec.rb
CHANGED
@@ -24,17 +24,26 @@ describe Atig::Command::Status do
|
|
24
24
|
@gateway.filtered.should == { :status => 'blah blah' }
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
it "should post with japanese language" do
|
28
|
+
res = status("あ"*140)
|
29
|
+
@statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
|
30
|
+
@api.should_receive(:post).with('statuses/update', {:status=>"あ"*140}).and_return(res)
|
31
|
+
|
32
|
+
call '#twitter', "status", ["あ" * 140]
|
33
|
+
|
34
|
+
@gateway.updated.should == [ res, '#twitter' ]
|
35
|
+
@gateway.filtered.should == { :status => "あ" * 140 }
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should post the status even if has long URL" do
|
39
|
+
res = status("https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off")
|
40
|
+
@statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
|
41
|
+
@api.should_receive(:post).with('statuses/update', {:status=>'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'}).and_return(res)
|
32
42
|
|
33
|
-
|
43
|
+
call '#twitter', "status", ['https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off']
|
34
44
|
|
35
|
-
|
36
|
-
|
37
|
-
end
|
45
|
+
@gateway.updated.should == [ res, '#twitter' ]
|
46
|
+
@gateway.filtered.should == { :status => 'https://www.google.co.jp/search?q=%E3%83%AB%E3%83%93%E3%83%BC%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E9%96%8B%E7%99%BA&safe=off'}
|
38
47
|
end
|
39
48
|
|
40
49
|
it "should not post same post" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MIZUNO Hiroki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: twitter-text
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.7.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.7.0
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: bundler
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
306
|
version: '0'
|
293
307
|
requirements: []
|
294
308
|
rubyforge_project:
|
295
|
-
rubygems_version: 2.2.
|
309
|
+
rubygems_version: 2.2.1
|
296
310
|
signing_key:
|
297
311
|
specification_version: 4
|
298
312
|
summary: Atig.rb is forked from cho45's tig.rb. We improve some features of tig.rb.
|