Class: Moonshado::Sms::Keywords

Inherits:
Object
  • Object
show all
Defined in:
lib/moonshado/keywords.rb

Defined Under Namespace

Classes: MoonshadoSMSException

Class Method Summary collapse

Class Method Details

.listObject



5
6
7
8
9
# File 'lib/moonshado/keywords.rb', line 5

def list
  response = sender.get(configuration.keywords_uri)

  parse(response.body)
end

.register_keywordsObject



11
12
13
14
15
16
# File 'lib/moonshado/keywords.rb', line 11

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

.valid_keywords?Boolean

def self.destory(keyword)

response = RestClient.delete("#{url}/#{keyword}")
parse(response.body)

end

Returns:

  • (Boolean)


23
24
25
# File 'lib/moonshado/keywords.rb', line 23

def valid_keywords?
  configuration.keywords.is_a?(Hash) && (!configuration.keywords.empty?)
end