class Twizo::Twizo

Public Class Methods

new(api_key, api_host) click to toggle source

Constructor

@param [String] api_key @param [String] api_host

# File lib/twizo.rb, line 34
def initialize(api_key, api_host)
  @client = NetHttpClient.new(api_key, api_host)
end

Public Instance Methods

create_backup_codes(identifier) click to toggle source

@param [String] identifier

@return [Object]

# File lib/twizo.rb, line 114
def create_backup_codes(identifier)
  backup_codes = Entity.new(@client).extend(BackupCodes)
  backup_codes.set(identifier)
  backup_codes
end
create_number_lookup(numbers) click to toggle source

@param [String|Array] numbers

# File lib/twizo.rb, line 43
def create_number_lookup(numbers)
  number_lookup = Entity.new(@client).extend(NumberLookup)
  number_lookup.set(numbers)
  number_lookup
end
create_sms(body, recipients, sender) click to toggle source

@param [String] body @param [String|Array] recipients @param [String] sender

@return [Object]

# File lib/twizo.rb, line 76
def create_sms(body, recipients, sender)
  sms = Entity.new(@client).extend(Sms)
  sms.set(body, recipients, sender)
  sms
end
create_verification(recipient) click to toggle source

@param [String] recipient

@return [Object]

# File lib/twizo.rb, line 137
def create_verification(recipient)
  verification = Entity.new(@client).extend(Verification)
  verification.set(recipient)
  verification
end
create_widget(recipient) click to toggle source

@param [String] recipient

@return [Object]

# File lib/twizo.rb, line 171
def create_widget(recipient)
  widget = Entity.new(@client).extend(Widget)
  widget.set(recipient)
  widget
end
get_backup_code(identifier) click to toggle source

@param [String] identifier

@return [Object]

# File lib/twizo.rb, line 125
def get_backup_code(identifier)
  backup_codes = Entity.new(@client).extend(BackupCodes)
  backup_codes.populate(identifier)
end
get_balance() click to toggle source

Balance

# File lib/twizo.rb, line 102
def get_balance
  balance = Entity.new(@client).extend(Balance)
  balance.send
end
get_number_lookup_results() click to toggle source

@return [Object]

# File lib/twizo.rb, line 62
def get_number_lookup_results
  number_lookup = Entity.new(@client).extend(NumberLookup)
  number_lookup.poll
end
get_number_lookup_status(message_id) click to toggle source

@param [String] message_id

@return [Object]

# File lib/twizo.rb, line 54
def get_number_lookup_status(message_id)
  number_lookup = Entity.new(@client).extend(NumberLookup)
  number_lookup.populate(message_id)
end
get_sms_results() click to toggle source

@return [Object]

# File lib/twizo.rb, line 95
def get_sms_results
  sms = Entity.new(@client).extend(Sms)
  sms.poll
end
get_sms_status(message_id) click to toggle source

@param [String] message_id

@return [Object]

# File lib/twizo.rb, line 87
def get_sms_status(message_id)
  sms = Entity.new(@client).extend(Sms)
  sms.populate(message_id)
end
get_verification_status(message_id) click to toggle source

@param [String] message_id

@return [Object]

# File lib/twizo.rb, line 159
def get_verification_status(message_id)
  verification = Entity.new(@client).extend(Verification)
  verification.populate(message_id)
end
get_widget_status(session_token, recipient = nil, backup_code_identifier = nil) click to toggle source

@param [String] session_token @param [String|null] recipient @param [String|null] backup_code_identifier

@return [Object]

# File lib/twizo.rb, line 184
def get_widget_status(session_token, recipient = nil, backup_code_identifier = nil)
  widget = Entity.new(@client).extend(Widget)
  widget.populate(session_token, recipient, backup_code_identifier)
end
verify_token(message_id, token) click to toggle source

@param [String] message_id @param [String] token

@return [Object]

# File lib/twizo.rb, line 149
def verify_token(message_id, token)
  verification = Entity.new(@client).extend(Verification)
  verification.verify(message_id, token)
end