nature_remo_api 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34833560b30a1741d68d1cc6dc254637212a4dffcd6a2235e366447e4a479949
4
- data.tar.gz: 9b28176e2c5f0f98b0c078359fe44e9781928e6abdedaec0cb951801612faa81
3
+ metadata.gz: 011a41b33b9318ddd73de9845a925da54aa4959748740e5d71984b8ea37f3413
4
+ data.tar.gz: bdf5f957b8c5d772590725c1c93bc9f65337bf7a9b173d47b05509c79e67ad60
5
5
  SHA512:
6
- metadata.gz: 77f3d20aeec226f7ed8fd29bfbdea9a639ad808046c3ccea1530c2e5501b58d123ad76269f6079d59b28ef73c929dbd8cacf3aee97be0430f39bc60750296caa
7
- data.tar.gz: 9949ba7cc1333d1ec27b70a17a17882d9c45530385f2fb205d5cd0483810521290c9494f1a1d597867c7003dda154901d66805828071733f5d40c69d739e9526
6
+ metadata.gz: a254512ebffad786aed2dd465580304feeda5febee079d02559f6962eba9bb9ec742a9c53793da42ebb7a6de88e11c4384691fe60631350b485b79fce7140e1b
7
+ data.tar.gz: 8a6be9d6cb20f2c55e23a513b4ff4dfaf8658d324497a03da167b5f835b8acbea2c74f32854bff924fe9d3e6e07b902d45b74e744d3c7cc8b15e218286ab85c0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nature_remo_api (0.1.3)
4
+ nature_remo_api (0.1.4)
5
5
  bundler (~> 2.0)
6
6
  faraday (>= 1.0)
7
7
  rake (~> 13.0)
@@ -1,8 +1,11 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
+ require_relative "endpoints"
3
4
 
4
5
  module NatureRemoApi
5
6
  class Client
7
+ include Endpoints
8
+
6
9
  # TODO: NatureRemoApi::Config::ATTRIBUTESを下記に設定できるようにする
7
10
  attr_accessor :endpoint, :access_token, :default_max_retries, :client
8
11
 
@@ -15,39 +18,6 @@ module NatureRemoApi
15
18
  @client.headers['Authorization'] = "Bearer #{access_token}"
16
19
  end
17
20
 
18
- # TODO: 後々別ファイルに切り出す
19
- def user_me
20
- get('/1/users/me')
21
- end
22
-
23
- def update_user_me(nickname:)
24
- params = {
25
- nickname: nickname
26
- }
27
-
28
- post('/1/users/me', params)
29
- end
30
-
31
- def devices
32
- get('/1/devices')
33
- end
34
-
35
- def appliances
36
- get('/1/appliances')
37
- end
38
-
39
- def signals(appliance_id:)
40
- get("/1/appliances/#{appliance_id}/signals")
41
- end
42
-
43
- def send_signal(signal_id:)
44
- params = {
45
- signal: signal_id
46
- }
47
-
48
- post("/1/signals/#{signal_id}/send", params)
49
- end
50
-
51
21
  # TODO: BaseClientを作ってそちらに定義
52
22
  Faraday::Connection::METHODS.each do |method|
53
23
  define_method(method) do |url, args = {}, &block|
@@ -0,0 +1,13 @@
1
+ require_relative 'endpoints/user'
2
+ require_relative 'endpoints/device'
3
+ require_relative 'endpoints/appliance'
4
+ require_relative 'endpoints/signal'
5
+
6
+ module NatureRemoApi
7
+ module Endpoints
8
+ include User
9
+ include Device
10
+ include Appliance
11
+ include Signal
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module NatureRemoApi
2
+ module Endpoints
3
+ module Appliance
4
+ def appliances
5
+ get('/1/appliances')
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module NatureRemoApi
2
+ module Endpoints
3
+ module Device
4
+ def devices
5
+ get('/1/devices')
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module NatureRemoApi
2
+ module Endpoints
3
+ module Signal
4
+ def signals(appliance_id:)
5
+ get("/1/appliances/#{appliance_id}/signals")
6
+ end
7
+
8
+ def send_signal(signal_id:)
9
+ params = {
10
+ signal: signal_id
11
+ }
12
+
13
+ post("/1/signals/#{signal_id}/send", params)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module NatureRemoApi
2
+ module Endpoints
3
+ module User
4
+ def user_me
5
+ get('/1/users/me')
6
+ end
7
+
8
+ def update_user_me(nickname:)
9
+ params = {
10
+ nickname: nickname
11
+ }
12
+
13
+ post('/1/users/me', params)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module NatureRemoApi
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nature_remo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - keita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,11 @@ files:
87
87
  - lib/nature_remo_api.rb
88
88
  - lib/nature_remo_api/client.rb
89
89
  - lib/nature_remo_api/config.rb
90
+ - lib/nature_remo_api/endpoints.rb
91
+ - lib/nature_remo_api/endpoints/appliance.rb
92
+ - lib/nature_remo_api/endpoints/device.rb
93
+ - lib/nature_remo_api/endpoints/signal.rb
94
+ - lib/nature_remo_api/endpoints/user.rb
90
95
  - lib/nature_remo_api/version.rb
91
96
  - nature_remo_api.gemspec
92
97
  homepage: https://github.com/keita-hino/nature-remo-ruby-client