module AiNoto

Constants

VERSION

Public Class Methods

config_file() click to toggle source
# File lib/ai_noto.rb, line 33
def self.config_file
  if ENV["TEST"]
    File.join(Dir.pwd, "lib", "config.test.yml")
  else
    File.join(Dir.home, ".ai_noto.rc.yml")
  end
end
default_recipient() click to toggle source
# File lib/ai_noto.rb, line 21
def self.default_recipient
  YAML.load_file(config_file)["default_recipient"]
end
from_number() click to toggle source
# File lib/ai_noto.rb, line 25
def self.from_number
  YAML.load_file(config_file)["from_number"]
end
send(recipient, contents) click to toggle source
# File lib/ai_noto.rb, line 5
def self.send(recipient, contents)
  Message.new(contents, twilio_client, recipient).send_sms!
end
to_number(recipient = nil) click to toggle source
# File lib/ai_noto.rb, line 29
def self.to_number(recipient = nil)
  recipient = recipient.nil? ? default_recipient : YAML.load_file(config_file)[recipient]
end
twilio_client() click to toggle source
# File lib/ai_noto.rb, line 9
def self.twilio_client
  account_sid, auth_token = twilio_credentials
  Twilio::REST::Client.new(account_sid, auth_token)
end
twilio_credentials() click to toggle source
# File lib/ai_noto.rb, line 14
def self.twilio_credentials
  config = YAML.load_file(config_file)

  [config["twilio_account_sid"],
    config["twilio_auth_token"]]
end