line-okuru 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Richard Lee
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.
@@ -0,0 +1,63 @@
1
+ # Line::Okuru
2
+
3
+ ActionView helpers for creating NAVER LINE share buttons.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'line-okuru'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install line-okuru
18
+
19
+ ## Usage
20
+
21
+ There're currently 5 types of button available.
22
+
23
+ ![Buttons](http://media.line.naver.jp/img/img_icon_design.png)
24
+
25
+ In this gem, the above button types are named as below:
26
+
27
+ * Wide (88x20px)
28
+ * Small (20x20px)
29
+ * **Default:** Medium (30x30px)
30
+ * Large (40x40px)
31
+ * Tall (30x70px)
32
+
33
+ To insert button to your template (Use ERB for example),
34
+
35
+ ```
36
+ <%= line_share_button "Check out Line Okuru https://github.com/polydice/line-okuru" %>
37
+
38
+ ```
39
+
40
+ To insert button of different type,
41
+
42
+ ```
43
+ <%= line_share_button "Check out Line Okuru https://github.com/polydice/line-okuru", :button_type => :large %>
44
+
45
+ ```
46
+
47
+ Also, you can pass in HTML attributes for button as parameters as using other ActionView helpers.
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
56
+
57
+ ## License
58
+
59
+ The codes are under MIT License, and the button images are copyrighted by NAVER.
60
+
61
+ ## Links
62
+
63
+ [Official Setup Guide for LINE Send Buttons (Japanese)](http://media.line.naver.jp/howto/ja/)
@@ -0,0 +1,9 @@
1
+ require "line-okuru/version"
2
+
3
+ module Line
4
+ module Okuru
5
+ module Rails
6
+ require "line-okuru/engine"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ require 'line-okuru/helpers/button_helper'
2
+
3
+ module Line
4
+ module Okuru
5
+ class Engine < ::Rails::Engine
6
+ initializer "line-okuru.helpers" do
7
+ ActionView::Base.send :include, ButtonHelper
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,50 @@
1
+ require 'uri'
2
+
3
+ module Line
4
+ module Okuru
5
+ module ButtonHelper
6
+
7
+ FILES = {
8
+ small: {
9
+ width: 20,
10
+ height: 20,
11
+ },
12
+ medium: {
13
+ width: 30,
14
+ height: 30
15
+ },
16
+ large: {
17
+ width: 40,
18
+ height: 40
19
+ },
20
+ wide: {
21
+ width: 86,
22
+ height: 20
23
+ },
24
+ tall: {
25
+ width: 36,
26
+ height: 60
27
+ }
28
+ }
29
+
30
+ def line_share_button(text, attrs = {})
31
+ style = attrs.delete(:button_style) || :medium
32
+
33
+ raise InvalidButtonStyleError, "button_style argument should be one of [:small, :medium, :large, :wide, :tall] " unless FILES.has_key? style
34
+
35
+ share_link(text, attrs) do
36
+ image_tag("linebutton_#{FILES[style][:width]}x#{FILES[style][:height]}.png", :width => FILES[style][:width], :height => FILES[style][:height])
37
+ end
38
+ end
39
+
40
+ protected
41
+
42
+ def share_link(text, attrs = {}, &block)
43
+ link_to("http://line.naver.jp/R/msg/text/?#{URI.escape(text)}", attrs, &block)
44
+ end
45
+
46
+ class InvalidButtonStyleError < StandardError; end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ module Line
2
+ module Okuru
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: line-okuru
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Richard Lee
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: activesupport
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.1'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.1'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.6'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.6'
62
+ description: ActionView helpers for creating NAVER LINE share buttons.
63
+ email:
64
+ - rl@polydice.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - lib/line-okuru/engine.rb
70
+ - lib/line-okuru/helpers/button_helper.rb
71
+ - lib/line-okuru/version.rb
72
+ - lib/line-okuru.rb
73
+ - vendor/assets/images/linebutton_20x20.png
74
+ - vendor/assets/images/linebutton_30x30.png
75
+ - vendor/assets/images/linebutton_36x60.png
76
+ - vendor/assets/images/linebutton_40x40.png
77
+ - vendor/assets/images/linebutton_86x20.png
78
+ - LICENSE.txt
79
+ - README.md
80
+ homepage: https://github.com/polydice/line-okuru
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
93
+ - 0
94
+ hash: -2119565712141679981
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
102
+ - 0
103
+ hash: -2119565712141679981
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.23
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: NAVER LINE share buttons.
110
+ test_files: []