ai_noto 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.travis.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +14 -2
- data/Rakefile +0 -0
- data/ai_noto.gemspec +0 -0
- data/bin/setup +0 -0
- data/lib/ai_noto.rb +12 -7
- data/lib/ai_noto/version.rb +1 -1
- data/lib/ai_noto_cli.rb +4 -4
- data/lib/config.test.yml +2 -1
- data/lib/config.yml.dist +2 -0
- 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: 2b46743ac21b9a239e8ec48c88d327754de46399
|
4
|
+
data.tar.gz: 1fc9f5fc1657147993278a909afc84a9001ed39e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4114f3a7e595f6d6a0c9b5d22e8a4b0e59ffadc6b8ac709a3d6dba5c1987297b91deec7b70e92b83a31987711fba8752e10b0915a095bde3be6038ae31be8944
|
7
|
+
data.tar.gz: 02dc8fd0081a2e3bcad8bd058664933ca5b390bea216cdb4317cf7be5d3aa9724be202fc61d0e42996ce9806b7d7811e21f5ff861dc8ac39626eff57e4a25a63
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
|
4
4
|
Ai Noto (Love Notes) lets you quickly send SMS messages from your CLI.
|
5
5
|
|
6
|
-
TODO: Support multiple recipients
|
7
|
-
|
8
6
|
## Installation
|
9
7
|
|
10
8
|
Add this line to your application's Gemfile:
|
@@ -34,7 +32,21 @@ Edit the `config.yml.dist` file with your Twilio credentials. Also
|
|
34
32
|
make sure to provide a proper Twilio from_number then rename
|
35
33
|
the sample dist file to `config.yml`
|
36
34
|
|
35
|
+
|
36
|
+
### Set up recipients
|
37
|
+
In `config.yml` please ensure a default_recipient is filled in
|
38
|
+
You may also add specific recipients e.g.:
|
39
|
+
```
|
40
|
+
"Foo": "+18001234567"
|
41
|
+
```
|
42
|
+
|
37
43
|
### Send a new message
|
44
|
+
Send a message to Foo:
|
45
|
+
> ainoto new Foo "Hello World"
|
46
|
+
|
47
|
+
If no recipient is specified then it will send a message to
|
48
|
+
`default_recipient` in config.yml
|
49
|
+
|
38
50
|
> ainoto new "hello world!"
|
39
51
|
|
40
52
|
## Development
|
data/Rakefile
CHANGED
File without changes
|
data/ai_noto.gemspec
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/lib/ai_noto.rb
CHANGED
@@ -2,8 +2,8 @@ require "twilio-ruby"
|
|
2
2
|
require "yaml"
|
3
3
|
|
4
4
|
module AiNoto
|
5
|
-
def self.send(contents)
|
6
|
-
Message.new(contents, twilio_client).send_sms!
|
5
|
+
def self.send(recipient, contents)
|
6
|
+
Message.new(contents, twilio_client, recipient).send_sms!
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.twilio_client
|
@@ -18,12 +18,16 @@ module AiNoto
|
|
18
18
|
config["twilio_auth_token"]]
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.default_recipient
|
22
|
+
YAML.load_file(config_file)["default_recipient"]
|
23
|
+
end
|
24
|
+
|
21
25
|
def self.from_number
|
22
26
|
YAML.load_file(config_file)["from_number"]
|
23
27
|
end
|
24
28
|
|
25
|
-
def self.to_number
|
26
|
-
YAML.load_file(config_file)[
|
29
|
+
def self.to_number(recipient = nil)
|
30
|
+
recipient = recipient.nil? ? default_recipient : YAML.load_file(config_file)[recipient]
|
27
31
|
end
|
28
32
|
|
29
33
|
def self.config
|
@@ -35,16 +39,17 @@ module AiNoto
|
|
35
39
|
end
|
36
40
|
|
37
41
|
class Message
|
38
|
-
attr_accessor :contents, :twilio_client
|
42
|
+
attr_accessor :contents, :twilio_client, :recipient
|
39
43
|
|
40
|
-
def initialize(contents, twilio_client)
|
44
|
+
def initialize(contents, twilio_client, recipient)
|
41
45
|
@contents = contents
|
42
46
|
@twilio_client = twilio_client
|
47
|
+
@recipient = recipient
|
43
48
|
end
|
44
49
|
|
45
50
|
def send_sms!
|
46
51
|
twilio_client.api.account.messages.create(from: AiNoto.from_number,
|
47
|
-
to: AiNoto.to_number,
|
52
|
+
to: AiNoto.to_number(recipient),
|
48
53
|
body: contents)
|
49
54
|
end
|
50
55
|
end
|
data/lib/ai_noto/version.rb
CHANGED
data/lib/ai_noto_cli.rb
CHANGED
@@ -8,10 +8,10 @@ require 'byebug'
|
|
8
8
|
class AiNotoCLI < Thor
|
9
9
|
include AiNoto
|
10
10
|
|
11
|
-
desc 'new "MESSAGE"', 'send a new "MESSAGE" to
|
12
|
-
def new(message)
|
13
|
-
puts "Sending a message to #{AiNoto.to_number}"
|
14
|
-
AiNoto.send(message)
|
11
|
+
desc 'new [recipient] "MESSAGE"', 'send a new "MESSAGE" to recipient'
|
12
|
+
def new(recipient=nil, message)
|
13
|
+
puts "Sending a message to #{AiNoto.to_number(recipient)}"
|
14
|
+
AiNoto.send(recipient, message)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
data/lib/config.test.yml
CHANGED
data/lib/config.yml.dist
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ai_noto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sid Ngeth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|