chatwork 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chatwork.rb +1 -0
- data/lib/chatwork/my_task.rb +13 -0
- data/lib/chatwork/operations.rb +17 -6
- data/lib/chatwork/task.rb +2 -6
- data/lib/chatwork/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6695bd548cc4e8fa03c3ebd1ca71aa59cada6f24
|
4
|
+
data.tar.gz: 0754d76d9bb12746246b36512904fa461e384412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4835a4b56f6acf2bec2021ff1547036e6da14673c222c2a3c18f80ed2c8c4bb126358d4d1cf508e1f6571c1f1f03065d45c8c3f701ce76a5e32fca6f82a757d7
|
7
|
+
data.tar.gz: e630f861861cbfba42b70ba078eae787176fc1d17ee18429bf70e8517b55065e7fec566c8074441bc83f5d35b2cc8b51827e4c947a8560b0c433dabf19c2fc4d
|
data/lib/chatwork.rb
CHANGED
data/lib/chatwork/operations.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
module ChatWork
|
2
2
|
module Operations
|
3
|
+
ACCEPT_PARAMS_ID = %i(file_id task_id message_id)
|
4
|
+
|
5
|
+
attr_accessor :assign_path
|
6
|
+
|
3
7
|
def install_class_operations(*operations)
|
4
8
|
define_create if operations.include?(:create)
|
5
9
|
define_get if operations.include?(:get)
|
@@ -8,8 +12,9 @@ module ChatWork
|
|
8
12
|
def define_get
|
9
13
|
instance_eval do
|
10
14
|
def get(params = {})
|
11
|
-
assign_path = parse_if_hash_key_exists(path, params, :room_id)
|
12
|
-
|
15
|
+
@assign_path = parse_if_hash_key_exists(path, params, :room_id)
|
16
|
+
attach_nested_resource_id(params)
|
17
|
+
convert(ChatWork.client.get(@assign_path, params))
|
13
18
|
end
|
14
19
|
end
|
15
20
|
end
|
@@ -17,10 +22,9 @@ module ChatWork
|
|
17
22
|
def define_create
|
18
23
|
instance_eval do
|
19
24
|
def create(params = {})
|
20
|
-
|
21
|
-
|
22
|
-
assign_path
|
23
|
-
convert(ChatWork.client.post(assign_path, params))
|
25
|
+
@assign_path = parse_if_hash_key_exists(path, params, :room_id)
|
26
|
+
attach_nested_resource_id(params)
|
27
|
+
convert(ChatWork.client.post(@assign_path, params))
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -33,5 +37,12 @@ module ChatWork
|
|
33
37
|
string
|
34
38
|
end
|
35
39
|
end
|
40
|
+
|
41
|
+
def attach_nested_resource_id(params)
|
42
|
+
ACCEPT_PARAMS_ID.each do |id_name|
|
43
|
+
next unless params.include? id_name
|
44
|
+
@assign_path += "/#{params.delete(id_name)}"
|
45
|
+
end
|
46
|
+
end
|
36
47
|
end
|
37
48
|
end
|
data/lib/chatwork/task.rb
CHANGED
data/lib/chatwork/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- asonas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/chatwork/entity.rb
|
86
86
|
- lib/chatwork/me.rb
|
87
87
|
- lib/chatwork/message.rb
|
88
|
+
- lib/chatwork/my_task.rb
|
88
89
|
- lib/chatwork/operations.rb
|
89
90
|
- lib/chatwork/room.rb
|
90
91
|
- lib/chatwork/task.rb
|