lita-irkit 0.0.1 → 0.0.2

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: 0b00b105c0baf6bd5e853a89fb8bf6f760837ef7
4
- data.tar.gz: a8bb19f69bccd4d3c04d7bdd5b377344f9fef0e6
3
+ metadata.gz: d8fd505367b9e0c72152dde9c7153fb18675c236
4
+ data.tar.gz: f2e2a3ce84fbb32234973f766481964d856219d0
5
5
  SHA512:
6
- metadata.gz: 66fd91a41ad3213e2acdfcd423634e50e561e9d1bfb14bb2cc9269cb10ab4d929e71c1182a2a056481a7e5766f6af987010a6c518e55f92cb44a180bcd32e30b
7
- data.tar.gz: 0091b4c4c97c3470f7ff162cdc50e641430f5ed26fc68fbbfbd0957eb4107f7eb277b543884ecc6d2a357ca1043f7b7c0943fc3cf3965a675c09d0c632bda185
6
+ metadata.gz: 5ba81d73d002f2d2043dcc39e83a4335703620b88350d41991fd045b5ed42d2bcb5504c9b05204c9e574a34203e77cf77bb7f1a50f44900f425c6a62a6244e4b
7
+ data.tar.gz: df040079f3895ab7136066216ee91b6ec86bce6202cdd5392a8238f4d565d7f3ca78966cf0e4ba4f55a871ee5e7de02669d67c143c0257cc63d8915e9dddac70
data/README.md CHANGED
@@ -15,8 +15,8 @@ gem "lita-irkit"
15
15
 
16
16
  ```
17
17
  def self.default_config(handler_config)
18
- handler_config.deviceid = ENV['IRKIT_DEVICEID']
19
- handler_config.clientkey = ENV['IRKIT_CLIENTKEY']
18
+ config.handlers.irkit.deviceid = ENV["IRKIT_DEVICEID"]
19
+ config.handlers.irkit.clientkey = ENV["IRKIT_CLIENTKEY"]
20
20
  end
21
21
  ```
22
22
 
@@ -1,4 +1,4 @@
1
- require 'irkit'
1
+ require 'faraday'
2
2
  require 'json'
3
3
 
4
4
  module Lita
@@ -20,10 +20,10 @@ module Lita
20
20
 
21
21
  def ir_save(response)
22
22
  cmd = response.matches[0][0]
23
- ir_data = irkit.get_messages
24
- return response.reply "ir data not found" unless ir_data
23
+ ir_data = irkit_api.get('/1/messages', clientkey: config.clientkey).body
24
+ return response.reply "ir data not found" if ir_data.length == 0
25
25
 
26
- Lita.redis["irkit:messages:#{cmd}"] = ir_data.message.to_json
26
+ Lita.redis["irkit:messages:#{cmd}"] = JSON.parse(ir_data)['message'].to_json
27
27
  response.reply "ir data saved: #{cmd}"
28
28
  end
29
29
 
@@ -32,7 +32,7 @@ module Lita
32
32
  message = Lita.redis["irkit:messages:#{cmd}"]
33
33
  return response.reply 'ir data not found' unless message
34
34
 
35
- irkit.post_messages JSON.parse(message)
35
+ irkit_api.post('/1/messages', clientkey: config.clientkey, deviceid: config.deviceid, message: message)
36
36
  response.reply "ir data send: #{cmd}"
37
37
  end
38
38
 
@@ -46,8 +46,12 @@ module Lita
46
46
  Lita.config.handlers.irkit
47
47
  end
48
48
 
49
- def irkit
50
- @irkit ||= ::IRKit::InternetAPI.new(clientkey: config.clientkey, deviceid: config.deviceid)
49
+ def irkit_api
50
+ @conn ||= Faraday.new(url: 'https://api.getirkit.com') do |faraday|
51
+ faraday.request :url_encoded # form-encode POST params
52
+ faraday.response :logger # log requests to STDOUT
53
+ faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
54
+ end
51
55
  end
52
56
  end
53
57
 
data/lita-irkit.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-irkit"
3
- spec.version = "0.0.1"
3
+ spec.version = "0.0.2"
4
4
  spec.authors = ["fukayatsu"]
5
5
  spec.email = ["fukayatsu@gmail.com"]
6
6
  spec.description = %q{Use IRKit on Lita}
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
 
17
17
  spec.add_runtime_dependency "lita", ">= 3.0"
18
- spec.add_runtime_dependency "irkit", "~> 0.0.8"
18
+ spec.add_runtime_dependency "faraday", "~> 0.9.0"
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-irkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: irkit
28
+ name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.8
33
+ version: 0.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.8
40
+ version: 0.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement