idobata 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +12 -1
- data/lib/idobata.rb +6 -6
- data/lib/idobata/client.rb +2 -2
- data/lib/idobata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d3aac7cf1635d8bad8a519b03cef797b0b20c0a
|
4
|
+
data.tar.gz: 16af1aa976282a3aeee5893a326137ff7e7df769
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d32ef09a1ef2c58fda5e7c659c9fa54c8e33183320e02cabf685bf6598bc1a7982ac1d300f19fd016fd3a74748ea9842976b04df46e23ba73fb049a8962542a
|
7
|
+
data.tar.gz: 9806ea8e11c74ba0a1148b2442c16ae393978936c706df8a28cfb9de8a1fe3193da7589283ab026bdf4d020cf09bce7c58b92635c4935a0143d3bd193be96bea
|
data/README.md
CHANGED
@@ -18,7 +18,18 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
```
|
22
|
+
require 'idobata'
|
23
|
+
|
24
|
+
# set hook url
|
25
|
+
Idobata.hooK_url = "https://idobata.io/hook/XXXXX"
|
26
|
+
|
27
|
+
# plain text
|
28
|
+
Idobata::Message.create(source: "Hello, Idobata!")
|
29
|
+
|
30
|
+
# html format
|
31
|
+
Idobata::Message.create(source: "<marquee>Hello, Idobata!</marquee>", format: :html)
|
32
|
+
```
|
22
33
|
|
23
34
|
## Contributing
|
24
35
|
|
data/lib/idobata.rb
CHANGED
@@ -4,20 +4,20 @@ module Idobata
|
|
4
4
|
autoload(:Client, 'idobata/client')
|
5
5
|
autoload(:Message, 'idobata/message')
|
6
6
|
|
7
|
-
@
|
7
|
+
@hook_url = nil
|
8
8
|
|
9
9
|
class << self
|
10
10
|
def client
|
11
|
-
@client ||= Client.new(@
|
11
|
+
@client ||= Client.new(@hook_url)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
@
|
14
|
+
def hook_url=(new_value)
|
15
|
+
@hook_url = new_value
|
16
16
|
@client = nil
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
@
|
19
|
+
def hook_url
|
20
|
+
@hook_url
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/idobata/client.rb
CHANGED
@@ -2,11 +2,11 @@ require 'faraday'
|
|
2
2
|
|
3
3
|
module Idobata
|
4
4
|
class Client
|
5
|
-
def initialize(
|
5
|
+
def initialize(hook_url)
|
6
6
|
default_header = {
|
7
7
|
'User-Agent' => "Idobata / RubyBinding/#{Idobata::VERSION}"
|
8
8
|
}
|
9
|
-
@conn = Faraday.new(
|
9
|
+
@conn = Faraday.new(hook_url, headers: default_header) do |builder|
|
10
10
|
builder.request :url_encoded
|
11
11
|
builder.adapter Faraday.default_adapter
|
12
12
|
end
|
data/lib/idobata/version.rb
CHANGED