atig 0.4.4 → 0.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5849d378b18e123fd9dcf8bf9a1ee96e6401434
4
- data.tar.gz: f0e7fc07a38030e1beb7b2fb9fd2633fb289db1e
3
+ metadata.gz: 600b07b559862ae694b0c7c99890c9e043a9aa6a
4
+ data.tar.gz: ae106983e3d0c5846c41c8ff8e93370f981ac7d7
5
5
  SHA512:
6
- metadata.gz: f8418c16aa59ad77355d7ccb591d1ef21cfe0c3963c0626c3f9e1ecdefdebaf76db89286e62e1528a5f07242f2f76aa06cf172b166ee3d2e08439c56623770af
7
- data.tar.gz: c50550489c0888bb2bba2facf47ee41b6524a44b2f7c85c0d3661dcaacc2ae93f5542d2e0c2431d84721bc6881f7cf97795184f05743f18bc0a9c9a0be6bf025
6
+ metadata.gz: c9b3350f024a475f036f26734c2e5fae1bbd3fb73a93279579b060a44a04a897a88d2e7b66e8cd226d76eeedc16475e6ece90099900ee0cd6cea7c6fff6d1a35
7
+ data.tar.gz: 00ff15638abddb5064b478a30c3c30e15c3c15b36991418fc90f1adfd7f566a63c493360d7befe27d0c37c0e2368406a8cfde2124bf402406a72e8793020deec
@@ -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.8 or 1.9
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
 
@@ -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'
@@ -1,14 +1,12 @@
1
1
  # -*- mode:ruby; coding:utf-8 -*-
2
2
  require 'atig/command/command'
3
- begin
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
- def initialize(*args); super end
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
- if q[:status].each_char.to_a.size > 140 then
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|
@@ -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 = true
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
@@ -23,7 +23,7 @@ module Atig
23
23
 
24
24
  def initialize(context, nick)
25
25
  uri = URI(context.opts.api_base)
26
- site = "http://#{uri.host}"
26
+ site = "https://#{uri.host}"
27
27
 
28
28
  @nick = nick
29
29
  @oauth = ::OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, {
@@ -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, 'http://search.twitter.com/'
34
+ default_value :search_api_base, 'https://search.twitter.com/'
35
35
 
36
36
  def initialize(table)
37
37
  @table = {}
@@ -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("http://search.twitter.com/search.json")
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
@@ -1,3 +1,3 @@
1
1
  module Atig
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
@@ -24,17 +24,26 @@ describe Atig::Command::Status do
24
24
  @gateway.filtered.should == { :status => 'blah blah' }
25
25
  end
26
26
 
27
- if RUBY_VERSION >= '1.9'
28
- it "should post with japanese language" do
29
- res = status("あ"*140)
30
- @statuses.should_receive(:find_by_user).with(@me,:limit=>1).and_return(nil)
31
- @api.should_receive(:post).with('statuses/update', {:status=>"あ"*140}).and_return(res)
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
- call '#twitter', "status", ["あ" * 140]
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
- @gateway.updated.should == [ res, '#twitter' ]
36
- @gateway.filtered.should == { :status => "あ" * 140 }
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
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: 2013-12-29 00:00:00.000000000 Z
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.0
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.