hato-plugin-twitter 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e881e4ab53a4fd419f050ff5d3f67177236d241b
4
+ data.tar.gz: 02e057f12a823fd9f1b7dadff0a60d03410111bf
5
+ SHA512:
6
+ metadata.gz: 19dae5b44bb2524f55f5f436edb5fce164ceeb571edaf870aea692700b76a3a014351f476f452e428ecf9bb96a1eec1c4fc62d1a1b8ebb1a232d5f433b3e0234
7
+ data.tar.gz: e67b00580fffa9f56e04495a587750f0909ba044ea9be095bfc4dba8a009f7b9c9b84dab2b364489da99d2b5ab22b1cd2ee26883db80d34344567702cbc3d4b4
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor/
19
+
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - ruby-head
7
+ - rbx-19mode
8
+ - jruby-19mode
9
+ - jruby-head
10
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hato-plugin-twitter.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Kentaro Kuribayashi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Hato::Plugin::Twitter [![BuildStatus](https://secure.travis-ci.org/kentaro/hato-plugin-twitter.png)](http://travis-ci.org/kentaro/hato-plugin-twitter)
2
+
3
+ Hato plugin to send messages via Twitter.
4
+
5
+ ## Configuration
6
+
7
+ ```ruby
8
+ Hato::Config.define do
9
+ api_key 'test'
10
+ host '0.0.0.0'
11
+ port 9699
12
+
13
+ # ...
14
+
15
+ tag 'test' do
16
+ plugin 'Twitter' do
17
+ consumer_key 'YOUR COMSUMER KEY'
18
+ consumer_secret 'YOUR CONSUMER SECRET'
19
+ access_token 'YOUR ACCESS TOKEN'
20
+ access_token_secret 'YOUR ACCESS TOKEN SECRET'
21
+ message_template '[<%= args[:tag] %>] <%= args[:message] %>'
22
+ end
23
+ end
24
+
25
+ # ...
26
+ end
27
+ ```
28
+
29
+ ## Installation
30
+
31
+ Add this line to your application's Gemfile:
32
+
33
+ gem 'hato-plugin-twitter'
34
+
35
+ And then execute:
36
+
37
+ $ bundle
38
+
39
+ Or install it yourself as:
40
+
41
+ $ gem install hato-plugin-twitter
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
50
+
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = FileList['spec/**/*_spec.rb']
8
+ spec.ruby_opts = %w[-w]
9
+ end
10
+
11
+ task :default => :spec
12
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'hato-plugin-twitter'
7
+ spec.version = '0.0.1'
8
+ spec.authors = ['Kentaro Kuribayashi']
9
+ spec.email = ['kentarok@gmail.com']
10
+ spec.description = %q{Hato plugin to send messages via Twitter}
11
+ spec.summary = %q{Hato plugin to send messages via Twitter}
12
+ spec.homepage = 'https://github.com/kentaro/hato-plugin-twitter'
13
+ spec.license = 'MIT'
14
+
15
+ spec.required_ruby_version = '>= 1.9.2'
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'hato'
23
+ spec.add_dependency 'twitter', '5.0.0.rc.1'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.3'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec'
28
+ end
29
+
@@ -0,0 +1,34 @@
1
+ require 'hato/plugin'
2
+ require 'hato/plugin/twitter/version'
3
+
4
+ require 'erb'
5
+ require 'twitter'
6
+
7
+ module Hato
8
+ module Plugin
9
+ class Twitter < Base
10
+ def notify(args)
11
+ send_tweet(args)
12
+ end
13
+
14
+ protected
15
+
16
+ def send_tweet(args)
17
+ client = ::Twitter::REST::Client.new(
18
+ consumer_key: config.consumer_key,
19
+ consumer_secret: config.consumer_secret,
20
+ access_token: config.access_token,
21
+ access_token_secret: config.access_token_secret,
22
+ )
23
+ message = render(config.message_template, args)
24
+ client.update(message)
25
+ end
26
+
27
+ def render(template, args)
28
+ erb = ERB.new(template)
29
+ erb.result(binding).chomp
30
+ end
31
+ end
32
+ end
33
+ end
34
+
@@ -0,0 +1,10 @@
1
+ require 'hato/plugin'
2
+
3
+ module Hato
4
+ module Plugin
5
+ class Twitter < Base
6
+ VERSION = '0.0.1'
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,5 @@
1
+ require_relative '../../../spec_helper'
2
+
3
+ describe Hato::Plugin::Twitter do
4
+ end
5
+
@@ -0,0 +1,5 @@
1
+ require_relative '../lib/hato/plugin/twitter'
2
+
3
+ RSpec.configure do |config|
4
+ end
5
+
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hato-plugin-twitter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kentaro Kuribayashi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hato
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: twitter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 5.0.0.rc.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 5.0.0.rc.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Hato plugin to send messages via Twitter
84
+ email:
85
+ - kentarok@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .travis.yml
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - hato-plugin-twitter.gemspec
97
+ - lib/hato/plugin/twitter.rb
98
+ - lib/hato/plugin/twitter/version.rb
99
+ - spec/lib/hato/plugin/twitter_spec.rb
100
+ - spec/spec_helper.rb
101
+ homepage: https://github.com/kentaro/hato-plugin-twitter
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: 1.9.2
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.0.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Hato plugin to send messages via Twitter
125
+ test_files:
126
+ - spec/lib/hato/plugin/twitter_spec.rb
127
+ - spec/spec_helper.rb