ai_noto 0.2.0 → 0.3.1
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 +8 -6
- data/lib/ai_noto.rb +5 -5
- data/lib/ai_noto/version.rb +1 -1
- data/lib/ai_noto_cli.rb +24 -2
- data/lib/config.test.yml +1 -1
- metadata +1 -2
- data/lib/config.yml.dist +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a595b506730cf13afc917f06bf6e1457c4bd5992
|
4
|
+
data.tar.gz: 5cc3ad9f7a788b0d62d406555ce67a5e4288734d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0b0a78a53fd936429312b44945c3a93152664983c42ff30b07d8f00e8bcaccea99797314814f0d28df512ba86e152c50c5b2103900d4e3b40bbe7ab4ebebbe
|
7
|
+
data.tar.gz: faef9cbc6254a56478543216752bba71f52307398c7755bf88c503cb4ae0dbb7cf07cc99754a7f0726d5f1e7e29176076d1a6cbb42b45b73939acbd9f3a9a72c
|
data/README.md
CHANGED
@@ -28,16 +28,18 @@ rbenv rehash).
|
|
28
28
|
|
29
29
|
|
30
30
|
### Setup your Twilio credentials in your environment
|
31
|
-
|
32
|
-
make sure to provide a proper Twilio from_number then rename
|
33
|
-
the sample dist file to `config.yml`
|
31
|
+
Run
|
34
32
|
|
33
|
+
> ainoto init
|
34
|
+
|
35
|
+
Then edit the file in your home dir, `.ai_noto.rc.yml`. Make sure to
|
36
|
+
include proper Twilio credentials
|
35
37
|
|
36
38
|
### Set up recipients
|
37
|
-
In
|
38
|
-
You may also add specific recipients e.g.:
|
39
|
+
In your `.ai_noto.rc.yml` please ensure a default_recipient is filled
|
40
|
+
in. You may also add specific recipients e.g.:
|
39
41
|
```
|
40
|
-
|
42
|
+
Foo: "+18001234567"
|
41
43
|
```
|
42
44
|
|
43
45
|
### Send a new message
|
data/lib/ai_noto.rb
CHANGED
@@ -30,12 +30,12 @@ module AiNoto
|
|
30
30
|
recipient = recipient.nil? ? default_recipient : YAML.load_file(config_file)[recipient]
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.config
|
34
|
-
ENV["TEST"] ? "config.test.yml" : "config.yml"
|
35
|
-
end
|
36
|
-
|
37
33
|
def self.config_file
|
38
|
-
|
34
|
+
if ENV["TEST"]
|
35
|
+
File.join(Dir.pwd, "lib", "config.test.yml")
|
36
|
+
else
|
37
|
+
File.join(Dir.home, ".ai_noto.rc.yml")
|
38
|
+
end
|
39
39
|
end
|
40
40
|
|
41
41
|
class Message
|
data/lib/ai_noto/version.rb
CHANGED
data/lib/ai_noto_cli.rb
CHANGED
@@ -1,15 +1,37 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'byebug'
|
3
2
|
|
4
3
|
# Command line suite
|
5
4
|
#
|
6
5
|
# Available commands:
|
6
|
+
# init
|
7
7
|
# new
|
8
8
|
class AiNotoCLI < Thor
|
9
|
-
|
9
|
+
CONFIG_FILE = File.join(Dir.home, ".ai_noto.rc.yml")
|
10
|
+
|
11
|
+
desc 'init', 'initializes twilio configuration'
|
12
|
+
def init
|
13
|
+
options = {
|
14
|
+
"from_number" => "+18001234567",
|
15
|
+
"to_number" => "+18001234567",
|
16
|
+
"twilio_account_sid" => "enter your account sid",
|
17
|
+
"twilio_auth_token" => "enter your auth token",
|
18
|
+
"default_recipient" => "+18001234567",
|
19
|
+
"John" => "+18001112222",
|
20
|
+
}
|
21
|
+
|
22
|
+
if !File.exists? CONFIG_FILE
|
23
|
+
File.open(CONFIG_FILE, 'w') { |file| YAML::dump(options, file) }
|
24
|
+
STDOUT.puts "Initialized default configuration file in #{CONFIG_FILE}"
|
25
|
+
STDOUT.puts "Please ensure it properly configured"
|
26
|
+
else
|
27
|
+
STDOUT.puts "Configuration file already exists in #{CONFIG_FILE}"
|
28
|
+
end
|
29
|
+
end
|
10
30
|
|
11
31
|
desc 'new [recipient] "MESSAGE"', 'send a new "MESSAGE" to recipient'
|
12
32
|
def new(recipient=nil, message)
|
33
|
+
raise RuntimeError, "No configuration found, please run ainoto init" if !File.exists? CONFIG_FILE
|
34
|
+
|
13
35
|
puts "Sending a message to #{AiNoto.to_number(recipient)}"
|
14
36
|
AiNoto.send(recipient, message)
|
15
37
|
end
|
data/lib/config.test.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ai_noto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sid Ngeth
|
@@ -118,7 +118,6 @@ files:
|
|
118
118
|
- lib/ai_noto/version.rb
|
119
119
|
- lib/ai_noto_cli.rb
|
120
120
|
- lib/config.test.yml
|
121
|
-
- lib/config.yml.dist
|
122
121
|
homepage: ''
|
123
122
|
licenses:
|
124
123
|
- MIT
|