line-bot-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE +202 -0
- data/README.md +216 -0
- data/lib/line/bot.rb +11 -0
- data/lib/line/bot/api/errors.rb +7 -0
- data/lib/line/bot/api/version.rb +7 -0
- data/lib/line/bot/builder/multiple_message.rb +102 -0
- data/lib/line/bot/builder/rich_message.rb +138 -0
- data/lib/line/bot/client.rb +249 -0
- data/lib/line/bot/event_type.rb +15 -0
- data/lib/line/bot/message.rb +7 -0
- data/lib/line/bot/message/audio.rb +25 -0
- data/lib/line/bot/message/base.rb +29 -0
- data/lib/line/bot/message/content_type.rb +16 -0
- data/lib/line/bot/message/image.rb +23 -0
- data/lib/line/bot/message/location.rb +28 -0
- data/lib/line/bot/message/sticker.rb +26 -0
- data/lib/line/bot/message/text.rb +22 -0
- data/lib/line/bot/message/video.rb +23 -0
- data/lib/line/bot/operation.rb +3 -0
- data/lib/line/bot/operation/add_friend.rb +10 -0
- data/lib/line/bot/operation/base.rb +17 -0
- data/lib/line/bot/operation/block_account.rb +10 -0
- data/lib/line/bot/operation/op_type.rb +10 -0
- data/lib/line/bot/receive/message.rb +60 -0
- data/lib/line/bot/receive/operation.rb +42 -0
- data/lib/line/bot/receive/request.rb +35 -0
- data/lib/line/bot/request.rb +72 -0
- data/lib/line/bot/response/user/contact.rb +22 -0
- data/lib/line/bot/response/user/profile.rb +30 -0
- data/line-bot-api.gemspec +27 -0
- metadata +147 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Line
|
4
|
+
module Bot
|
5
|
+
module Response
|
6
|
+
module User
|
7
|
+
|
8
|
+
class Contact
|
9
|
+
attr_reader :mid, :display_name, :picture_url, :status_message
|
10
|
+
|
11
|
+
def initialize(attrs)
|
12
|
+
@mid = attrs['mid']
|
13
|
+
@display_name = attrs['displayName']
|
14
|
+
@picture_url = attrs['pictureUrl']
|
15
|
+
@status_message = attrs['statusMessage']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'line/bot/response/user/contact'
|
3
|
+
|
4
|
+
module Line
|
5
|
+
module Bot
|
6
|
+
module Response
|
7
|
+
module User
|
8
|
+
class Profile
|
9
|
+
attr_reader :start, :count, :total, :contacts, :display
|
10
|
+
|
11
|
+
def initialize(response)
|
12
|
+
json = JSON.parse(response.body)
|
13
|
+
|
14
|
+
@start = json['start']
|
15
|
+
@count = json['count']
|
16
|
+
@total = json['total']
|
17
|
+
@contacts = create_contacts(json['contacts']) || []
|
18
|
+
@display = json['display']
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_contacts(contacts)
|
22
|
+
contacts.map { |c|
|
23
|
+
Contact.new(c)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'line/bot/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "line-bot-api"
|
8
|
+
spec.version = Line::Bot::API::VERSION
|
9
|
+
spec.authors = ["LINE Corporation", "Hirohisa Kawasaki"]
|
10
|
+
spec.email = ["hirohisa.kawasaki@gmail.com"]
|
11
|
+
|
12
|
+
spec.description = "LINE::Bot::API - SDK of the LINE BOT API"
|
13
|
+
spec.summary = spec.description
|
14
|
+
spec.homepage = "https://github.com/line/line-bot-sdk-ruby"
|
15
|
+
spec.license = "Apache License, Version 2.0"
|
16
|
+
|
17
|
+
spec.files = %w(CODE_OF_CONDUCT.md LICENSE README.md line-bot-api.gemspec) + Dir['lib/**/*.rb']
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'rack', '~> 1.6.4'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "webmock", "~> 1.24"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: line-bot-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- LINE Corporation
|
8
|
+
- Hirohisa Kawasaki
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rack
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.6.4
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.6.4
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.11'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.11'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: webmock
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.24'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.24'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.0'
|
84
|
+
description: LINE::Bot::API - SDK of the LINE BOT API
|
85
|
+
email:
|
86
|
+
- hirohisa.kawasaki@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- CODE_OF_CONDUCT.md
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- line-bot-api.gemspec
|
95
|
+
- lib/line/bot/api/errors.rb
|
96
|
+
- lib/line/bot/api/version.rb
|
97
|
+
- lib/line/bot/builder/multiple_message.rb
|
98
|
+
- lib/line/bot/builder/rich_message.rb
|
99
|
+
- lib/line/bot/client.rb
|
100
|
+
- lib/line/bot/event_type.rb
|
101
|
+
- lib/line/bot/message/audio.rb
|
102
|
+
- lib/line/bot/message/base.rb
|
103
|
+
- lib/line/bot/message/content_type.rb
|
104
|
+
- lib/line/bot/message/image.rb
|
105
|
+
- lib/line/bot/message/location.rb
|
106
|
+
- lib/line/bot/message/sticker.rb
|
107
|
+
- lib/line/bot/message/text.rb
|
108
|
+
- lib/line/bot/message/video.rb
|
109
|
+
- lib/line/bot/message.rb
|
110
|
+
- lib/line/bot/operation/add_friend.rb
|
111
|
+
- lib/line/bot/operation/base.rb
|
112
|
+
- lib/line/bot/operation/block_account.rb
|
113
|
+
- lib/line/bot/operation/op_type.rb
|
114
|
+
- lib/line/bot/operation.rb
|
115
|
+
- lib/line/bot/receive/message.rb
|
116
|
+
- lib/line/bot/receive/operation.rb
|
117
|
+
- lib/line/bot/receive/request.rb
|
118
|
+
- lib/line/bot/request.rb
|
119
|
+
- lib/line/bot/response/user/contact.rb
|
120
|
+
- lib/line/bot/response/user/profile.rb
|
121
|
+
- lib/line/bot.rb
|
122
|
+
homepage: https://github.com/line/line-bot-sdk-ruby
|
123
|
+
licenses:
|
124
|
+
- Apache License, Version 2.0
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.0.14.1
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: LINE::Bot::API - SDK of the LINE BOT API
|
146
|
+
test_files: []
|
147
|
+
has_rdoc:
|