atabodi 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 +4 -4
- data/README.md +14 -2
- data/lib/atabodi/client.rb +20 -3
- data/lib/atabodi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1404b5df127a4d892d2b09d9fa67b135ffd79426
|
4
|
+
data.tar.gz: 7a25711b9f54f12d1ffad58d0d2463f0d54977c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ea140974e71cc335f327dbb36fe4053090b20b77c3827b59bc2b59b13a9be8cabf473ea00cada4129fe9943526bdfd8447111a26cdd4e16c95b50bc30912a0e
|
7
|
+
data.tar.gz: 170d2248ca53ea0c697569d8662fea4376d3d70f0a4e9b7048f85b2f3f6e7a54bc1b49f0524811562b6dbada8d42656837a1914a3851d349b1d5c5fbf3c4ad8b
|
data/README.md
CHANGED
@@ -18,11 +18,23 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
``` ruby
|
22
|
+
require 'atabodi'
|
23
|
+
|
24
|
+
client = Atabodi::Client.new(api_token: 'your_idobata_bot_api_token_here')
|
25
|
+
|
26
|
+
# Get bot lists
|
27
|
+
res = client.list_bots
|
28
|
+
p res.body.bots
|
29
|
+
# => [{"id":3543,"name":"ys","icon_url":"https://idobata.s3.amazonaws.com/uploads/bot/icon/3543/mihashi.jpg","api_token":"your_idobata_bot_api_token_here","status":"offline","channel_name":"presence-guy_3543"}]
|
30
|
+
|
31
|
+
# Update your idobata bot icon
|
32
|
+
client.update_bot_icon(id: 3543, file_path: 'path/to/icon/image.jpg')
|
33
|
+
```
|
22
34
|
|
23
35
|
## Contributing
|
24
36
|
|
25
|
-
1. Fork it ( http://github.com
|
37
|
+
1. Fork it ( http://github.com/hanachin/atabodi/fork )
|
26
38
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
39
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
40
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/atabodi/client.rb
CHANGED
@@ -11,9 +11,8 @@ module Atabodi
|
|
11
11
|
|
12
12
|
def_delegator :client, :respond_to?, :respond_to_missing?
|
13
13
|
|
14
|
-
def initialize(schema: DEFAULT_SCHEMA
|
14
|
+
def initialize(schema: DEFAULT_SCHEMA)
|
15
15
|
@schema = schema
|
16
|
-
@api_token = api_token
|
17
16
|
client.connection.headers = client.connection.headers.merge(headers)
|
18
17
|
end
|
19
18
|
|
@@ -53,8 +52,26 @@ module Atabodi
|
|
53
52
|
def headers
|
54
53
|
{
|
55
54
|
'User-Agent' => "Atabodi v#{Atabodi::VERSION}",
|
56
|
-
'X-API-Token' => @api_token
|
57
55
|
}
|
58
56
|
end
|
59
57
|
end
|
58
|
+
|
59
|
+
class User < Client
|
60
|
+
def initialize(user:, password:)
|
61
|
+
super()
|
62
|
+
client.connection.basic_auth(user, password)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class Bot < Client
|
67
|
+
def initialize(api_token:)
|
68
|
+
@api_token = api_token
|
69
|
+
super()
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
def headers
|
74
|
+
super.merge('X-API-Token' => @api_token)
|
75
|
+
end
|
76
|
+
end
|
60
77
|
end
|
data/lib/atabodi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atabodi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Higa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06
|
11
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonism
|