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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b46743ac21b9a239e8ec48c88d327754de46399
4
- data.tar.gz: 1fc9f5fc1657147993278a909afc84a9001ed39e
3
+ metadata.gz: a595b506730cf13afc917f06bf6e1457c4bd5992
4
+ data.tar.gz: 5cc3ad9f7a788b0d62d406555ce67a5e4288734d
5
5
  SHA512:
6
- metadata.gz: 4114f3a7e595f6d6a0c9b5d22e8a4b0e59ffadc6b8ac709a3d6dba5c1987297b91deec7b70e92b83a31987711fba8752e10b0915a095bde3be6038ae31be8944
7
- data.tar.gz: 02dc8fd0081a2e3bcad8bd058664933ca5b390bea216cdb4317cf7be5d3aa9724be202fc61d0e42996ce9806b7d7811e21f5ff861dc8ac39626eff57e4a25a63
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
- Edit the `config.yml.dist` file with your Twilio credentials. Also
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 `config.yml` please ensure a default_recipient is filled 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
- "Foo": "+18001234567"
42
+ Foo: "+18001234567"
41
43
  ```
42
44
 
43
45
  ### Send a new message
@@ -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
- file = File.join(Dir.pwd, "lib", config)
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
@@ -1,3 +1,3 @@
1
1
  module AiNoto
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -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
- include AiNoto
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
@@ -2,4 +2,4 @@ twilio_account_sid: '1234'
2
2
  twilio_auth_token: '1234'
3
3
  from_number: "+19045745217"
4
4
  default_recipient: "+18001234567"
5
- "Ashley": "+18001112222"
5
+ Ashley: "+18001112222"
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.2.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
@@ -1,6 +0,0 @@
1
- from_number: "+18001234567"
2
- to_number: "+18001234567"
3
- twilio_account_sid: "enter your account sid"
4
- twilio_auth_token: "enter your auth token"
5
- default_recipient: "+18001234567"
6
- "John": "+18001112222"