Sha256: f9096841b5c70697477d6665f6b64c78f4a7298b081c497b845f73528c2d70c4
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
module Connfu module Provisioning ## # This class defines a whitelist user (whitelist item) WhitelistUser = Struct.new(:name, :phone) ## # This class models a conference whitelist class Whitelist # WhitelistUser array attr_accessor :users # Conference phone attr_reader :voice def initialize(voice, users = []) @voice = voice @users = users end # Iterator based on users array def each users.each{|user| yield user } end def to_s value = [] self.instance_variables.each { |var| value << "#{var}: #{self.instance_variable_get(var)}" } value.join("\n").to_s end ## # Creates a Whitelist object using the raw data from the provisioning API # ==== Parameters # * +voice+ voice channel unique identifier # * +data+ raw data retrieved using the connFu API def self.unmarshal(voice, data) if data.is_a?(Array) numbers = [] data.each { |number| numbers << WhitelistUser.new(*number.values) } users = numbers else users = [WhitelistUser.new(*data.values)] end Whitelist.new(voice, users) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
connfu-client-0.1.2 | lib/connfu/provisioning/whitelist.rb |
connfu-client-0.1.1 | lib/connfu/provisioning/whitelist.rb |
connfu-client-0.1 | lib/connfu/provisioning/whitelist.rb |