class TermuxRubyApi::SubSystems::Sms

Public Instance Methods

draft(limit: nil, offset: nil) click to toggle source

Lists the SMS messages in the draft folder of the phone @param limit [Fixnum] Number of messages to return @param offset [Fixnum] Start from message @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 72
def draft(limit: nil, offset: nil)
  list(limit: limit, offset: offset, type: :draft)
end
draft_all() click to toggle source

Lists all the SMS messages in the draft folder of the phone, with no pagination @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 78
def draft_all
  list_all(type: :draft)
end
inbox(limit: nil, offset: nil) click to toggle source

Lists the SMS messages in the inbox folder of the phone @param limit [Fixnum] Number of messages to return @param offset [Fixnum] Start from message @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 30
def inbox(limit: nil, offset: nil)
  list(limit: limit, offset: offset, type: :inbox)
end
inbox_all() click to toggle source

Lists all the SMS messages in the inbox folder of the phone, with no pagination @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 36
def inbox_all
  list_all(type: :inbox)
end
list(limit: nil, offset: nil, type: nil) click to toggle source

Gets part of the list of SMS messages in the phone @param limit [Fixnum] Number of messages to return @param offset [Fixnum] Start from message @param type [:inbox, :outbox, :sent] @return [Array <Hash>]

# File lib/termux_ruby_api/sub_systems/sms.rb, line 9
def list(limit: nil, offset: nil, type: nil)
  args = []
  args = owner.generate_args_list([['-l', limit&.to_s],
                                   ['-o', offset&.to_s],
                                   ['-t', type]
                                  ])
  res = owner.json_api_command('sms-list', nil, *args)
  TermuxRubyApi::Utils::Xformer.xform(res, received: :time, type: :symbol)
end
list_all(type: nil) click to toggle source

Lists all the SMS messages in the phone, with no pagination @param type [:inbox, :outbox, :sent] @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 22
def list_all(type: nil)
  list(limit: -1, type: type)
end
outbox(limit: nil, offset: nil) click to toggle source

Lists the SMS messages in the outbox folder of the phone @param limit [Fixnum] Number of messages to return @param offset [Fixnum] Start from message @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 44
def outbox(limit: nil, offset: nil)
  list(limit: limit, offset: offset, type: :outbox)
end
outbox_all() click to toggle source

Lists all the SMS messages in the outbox folder of the phone, with no pagination @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 50
def outbox_all
  list_all(type: :outbox)
end
send(msg, *numbers) click to toggle source

Sends an SMS message @param msg [String] the text of the message @param numbers [String] all subsequent params are interpreted as numbers to send the message to

# File lib/termux_ruby_api/sub_systems/sms.rb, line 85
def send(msg, *numbers)
  args = owner.generate_args(["-n", "#{numbers.join(',')}"])
  owner.api_command('sms-send', msg, *args)
end
sent(limit: nil, offset: nil) click to toggle source

Lists the SMS messages in the sent folder of the phone @param limit [Fixnum] Number of messages to return @param offset [Fixnum] Start from message @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 58
def sent(limit: nil, offset: nil)
  list(limit: limit, offset: offset, type: :sent)
end
sent_all() click to toggle source

Lists all the SMS messages in the sent folder of the phone, with no pagination @return (see list)

# File lib/termux_ruby_api/sub_systems/sms.rb, line 64
def sent_all
  list_all(type: :sent)
end