Sha256: 4a6b1d870f7ca02b8fce5edbfde079dde95160fa00a349a206161cde2bffa31a
Contents?: true
Size: 1.16 KB
Versions: 7
Compression:
Stored size: 1.16 KB
Contents
module Moonshado class Sms class Keywords class << self def list response = sender.get(configuration.keywords_uri) parse(response.body) end def register_keywords raise MoonshadoSMSException.new("no keywords specified") unless valid_keywords? response = sender.send_to_moonshado({:keywords => configuration.keywords}, configuration.keywords_uri) parse(response.body) end # def self.destory(keyword) # response = RestClient.delete("#{url}/#{keyword}") # parse(response.body) # end def valid_keywords? configuration.keywords.is_a?(Hash) && (!configuration.keywords.empty?) end class MoonshadoSMSException < StandardError; end private def sender Moonshado::Sms.sender end def configuration Moonshado::Sms.configuration end def production_environment? configuration.production_environment end def parse(json) parser = Yajl::Parser.new.parse(json) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems