docomoru 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d04d819418e0183a2bde1d8d85ee096a91f6c1d6
4
- data.tar.gz: f49da17d964b80a229105e960ed4e319729648c0
3
+ metadata.gz: 8938cee1dc86c5fcbb4b03212e03bc8796edf776
4
+ data.tar.gz: 219bb80f68c6ab072efaeac56d9413c0b8da7bed
5
5
  SHA512:
6
- metadata.gz: f8ec6d380bbd1cebe49f39366f4ff3035dda5ab3ae1ba0211e4e0258b02e24e57da31dee75aa2be7e80b6b4d1fb0d0546ee8f5d3dcec5eadb2d3c7de2bf6ee0c
7
- data.tar.gz: 270de75d628caa1f2f35006c3da903b21370e6917e21b41eb51ad8d4ef9f9b28732ce41dd7201b9248fcbe33d8b08a39a9889371398bec6de77fe32e33bf111d
6
+ metadata.gz: 9f3e7b75bc937acb886709466ce14a1c7a34f4672d06320da05f524dd9b943abc446c1b9ebe5c4d4858dd25788f55e2e6decb67a3326ba950b7a2dac6fdb4e85
7
+ data.tar.gz: fd3af2dd9e9f676e44d039307010875c80502c6a27ec12f27cefd211ba098b72f5e8d8a4aafc0d971cdf4ab682511801bcb65e5ef0c3c69f7738865ad2e4c1f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.1
2
+ - Support Knowledge Q&A API (Thx @kkosuge)
3
+
1
4
  ## 0.1.0
2
5
  - Add `docomoru` executable for CLI use
3
6
 
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Docomoru
2
- Client library for DoCoMo API written in Ruby.
2
+ Client library for docomo API written in Ruby.
3
3
 
4
4
  ## Install
5
5
  Note: requires Ruby 2.0.0 or higher.
@@ -9,8 +9,7 @@ gem install docomoru
9
9
  ```
10
10
 
11
11
  ## Library
12
- Currenty docomoru is supporting [Dialogue API](https://dev.smt.docomo.ne.jp/?p=docs.api.page&api_docs_id=3)
13
- (You need DoCoMo API Key).
12
+ Currenty Docomoru is supporting [Dialogue API](https://dev.smt.docomo.ne.jp/?p=docs.api.page&api_docs_id=3) & [Knowledge Q&A API](https://dev.smt.docomo.ne.jp/?p=docs.api.page&api_docs_id=6).
14
13
 
15
14
  ```rb
16
15
  client = Docomoru::Client.new(api_key: ENV["DOCOMO_API_KEY"])
@@ -43,11 +42,12 @@ $ docomoru <method> <arguments> [options]
43
42
  | | --header
44
43
  | | --no-body
45
44
  | |
46
- | `------------------------------ required arguments for the method
45
+ | `------------- required arguments for the method
47
46
  |
48
- `----------------------------------------- method name
47
+ `------------------------ method name
49
48
 
50
- $ docomoru create_dialogue Gemになってみた感想はどうですか
49
+ $ docomoru create_dialogue かわいい
50
+ $ docomoru create_knowledge Rubyの作者は誰ですか
51
51
  ```
52
52
 
53
53
  ![](images/cli.png)
data/docomoru.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Docomoru::VERSION
8
8
  spec.authors = ["Ryo Nakamura"]
9
9
  spec.email = ["r7kamura@gmail.com"]
10
- spec.summary = "Client library for DoCoMo API written in Ruby."
10
+ spec.summary = "Client library for docomo API written in Ruby."
11
11
  spec.homepage = "https://github.com/r7kamura/docomoru"
12
12
  spec.license = "MIT"
13
13
 
@@ -1,4 +1,5 @@
1
1
  require "docomoru/dialogue_methods"
2
+ require "docomoru/knowledge_methods"
2
3
  require "docomoru/response"
3
4
  require "docomoru/version"
4
5
  require "active_support/core_ext/object/to_query"
@@ -17,12 +18,17 @@ module Docomoru
17
18
  }
18
19
 
19
20
  include DialogueMethods
21
+ include KnowledgeMethods
20
22
 
21
23
  # @param [String] api_key APIKEY issued from DoCoMo.
22
24
  def initialize(api_key: nil)
23
25
  @api_key = api_key
24
26
  end
25
27
 
28
+ def get(path, params = nil, headers = nil)
29
+ process(:get, path, params, headers)
30
+ end
31
+
26
32
  def post(path, params = nil, headers = nil)
27
33
  process(:post, path, params, headers)
28
34
  end
@@ -0,0 +1,13 @@
1
+ module Docomoru
2
+ module KnowledgeMethods
3
+ PATH = "/knowledgeQA/v1/ask"
4
+
5
+ def create_knowledge(q, params = {}, headers = {})
6
+ get(
7
+ "#{PATH}?#{default_query_string}&q=#{q}",
8
+ params,
9
+ headers,
10
+ )
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Docomoru
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docomoru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2014-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -161,6 +161,7 @@ files:
161
161
  - lib/docomoru/commands/error.rb
162
162
  - lib/docomoru/commands/request.rb
163
163
  - lib/docomoru/dialogue_methods.rb
164
+ - lib/docomoru/knowledge_methods.rb
164
165
  - lib/docomoru/response.rb
165
166
  - lib/docomoru/response_renderer.rb
166
167
  - lib/docomoru/version.rb
@@ -187,6 +188,6 @@ rubyforge_project:
187
188
  rubygems_version: 2.2.2
188
189
  signing_key:
189
190
  specification_version: 4
190
- summary: Client library for DoCoMo API written in Ruby.
191
+ summary: Client library for docomo API written in Ruby.
191
192
  test_files: []
192
193
  has_rdoc: