### Home Classes Methods

### In Files

- lib/xmpp4r/location/location.rb

### Parent

XMPPElement

### Methods

- ::new
- #accuracy
- #alt
- #area
- #bearing
- #building
- #country
- #datum
- #description
- #floor
- #lat
- #locality
- #lon
- #postalcode
- #published?
- #region
- #room
- #speed
- #street
- #text
- #timestamp
- #uri

### Files

- CHANGELOG
- COPYING
- LICENSE
- README.rdoc
- README_ruby19.txt

### Class/Module Index

Quicksearch

- Jabber
- Jabber::ArgumentError
- Jabber::Bytestreams
- Jabber::Bytestreams::IBB
- Jabber::Bytestreams::IBBInitiator
- Jabber::Bytestreams::IBBQueueItem
- Jabber::Bytestreams::IBBTarget
- Jabber::Bytestreams::IqQueryBytestreams
- Jabber::Bytestreams::IqSi
- Jabber::Bytestreams::IqSiFile
- Jabber::Bytestreams::IqSiFileRange
- Jabber::Bytestreams::SOCKS5Bytestreams
- Jabber::Bytestreams::SOCKS5BytestreamsInitiator
- Jabber::Bytestreams::SOCKS5BytestreamsPeer
- Jabber::Bytestreams::SOCKS5BytestreamsServer
- Jabber::Bytestreams::SOCKS5BytestreamsServerStreamHost
- Jabber::Bytestreams::SOCKS5BytestreamsTarget
- Jabber::Bytestreams::SOCKS5Socket
- Jabber::Bytestreams::StreamHost
- Jabber::Bytestreams::StreamHostUsed
- Jabber::Callback
- Jabber::CallbackList
- Jabber::Caps
- Jabber::Caps::C
- Jabber::Caps::Helper
- Jabber::Client
- Jabber::ClientAuthenticationFailure
- Jabber::Command
- Jabber::Command::IqCommand
- Jabber::Command::Responder
- Jabber::Component
- Jabber::ComponentAuthenticationFailure
- Jabber::Connection
- Jabber::Connection::SSLSocketUTF8
- Jabber::Dataforms
- Jabber::Dataforms::XData
- Jabber::Dataforms::XDataField
- Jabber::Dataforms::XDataInstructions
- Jabber::Dataforms::XDataReported
- Jabber::Dataforms::XDataTitle
- Jabber::Delay
- Jabber::Delay::XDelay
- Jabber::Discovery
- Jabber::Discovery::Feature
- Jabber::Discovery::Helper
- Jabber::Discovery::Identity
- Jabber::Discovery::IqQueryDiscoInfo
- Jabber::Discovery::IqQueryDiscoItems
- Jabber::Discovery::Item
- Jabber::Discovery::Responder
- Jabber::EntityTime
- Jabber::EntityTime::IqTime
- Jabber::EntityTime::Responder
- Jabber::ErrorResponse
- Jabber::FeatureNegotiation
- Jabber::FeatureNegotiation::IqFeature
- Jabber::FileTransfer
- Jabber::FileTransfer::FileSource
- Jabber::FileTransfer::Helper
- Jabber::FileTransfer::TransferSource
- Jabber::Framework
- Jabber::Framework::Base
- Jabber::Framework::Bot
- Jabber::HTTPBinding
- Jabber::HTTPBinding::Client
- Jabber::IdGenerator
- Jabber::InvalidChatState
- Jabber::Iq
- Jabber::IqQuery
- Jabber::JID
- Jabber::JabberError
- Jabber::LastActivity
- Jabber::LastActivity::Helper
- Jabber::LastActivity::IqQueryLastActivity
- Jabber::MUC
- Jabber::MUC::IqQueryMUCAdmin
- Jabber::MUC::IqQueryMUCAdminItem
- Jabber::MUC::IqQueryMUCOwner
- Jabber::MUC::MUCBrowser
- Jabber::MUC::MUCClient
- Jabber::MUC::SimpleMUCClient
- Jabber::MUC::UserItem
- Jabber::MUC::XMUC
- Jabber::MUC::XMUCUser
- Jabber::MUC::XMUCUserInvite
- Jabber::MUC::XMUCUserItem
- Jabber::Message
- Jabber::NoNameXmlnsRegistered
- Jabber::NotConnected
- Jabber::Observable
- Jabber::Observable::Contact
- Jabber::Observable::PubSub
- Jabber::Observable::PubSub::AlreadySet
- Jabber::Observable::PubSub::NoService
- Jabber::Observable::Subscriptions
- Jabber::Presence
- Jabber::PubSub
- Jabber::PubSub::Configuration
- Jabber::PubSub::Event
- Jabber::PubSub::EventItem
- Jabber::PubSub::EventItems
- Jabber::PubSub::IqPubSub
- Jabber::PubSub::IqPubSubOwner
- Jabber::PubSub::Item
- Jabber::PubSub::Items
- Jabber::PubSub::NodeBrowser
- Jabber::PubSub::NodeConfig
- Jabber::PubSub::NodeHelper
- Jabber::PubSub::OAuthPubSubStreamHelper
- Jabber::PubSub::OAuthServiceHelper
- Jabber::PubSub::OwnerNodeConfig
- Jabber::PubSub::Publish
- Jabber::PubSub::Retract
- Jabber::PubSub::ServiceHelper
- Jabber::PubSub::Subscription
- Jabber::PubSub::SubscriptionConfig
- Jabber::PubSub::Unsubscribe
- Jabber::RPC
- Jabber::RPC::Client
- Jabber::RPC::IqQueryRPC
- Jabber::RPC::Server
- Jabber::Reliable
- Jabber::Reliable::Connection
- Jabber::Reliable::Listener
- Jabber::Roster
- Jabber::Roster::Helper
- Jabber::Roster::Helper::RosterItem
- Jabber::Roster::IqQueryRoster
- Jabber::Roster::RosterItem
- Jabber::Roster::RosterX
- Jabber::Roster::RosterXItem
- Jabber::Roster::XRoster
- Jabber::Roster::XRosterItem
- Jabber::SASL
- Jabber::SASL::Anonymous
- Jabber::SASL::Base
- Jabber::SASL::DigestMD5
- Jabber::SASL::Plain
- Jabber::SOCKS5Error
- Jabber::Semaphore
- Jabber::ServerDisconnected
- Jabber::Stream
- Jabber::Stream::ThreadBlock
- Jabber::StreamParser
- Jabber::Test
- Jabber::Test::ListenerMocker
- Jabber::UserLocation
- Jabber::UserLocation::Helper
- Jabber::UserLocation::Location
- Jabber::UserTune
- Jabber::UserTune::Helper
- Jabber::UserTune::Tune
- Jabber::Vcard
- Jabber::Vcard::Helper
- Jabber::Vcard::IqVcard
- Jabber::Version
- Jabber::Version::IqQueryVersion
- Jabber::Version::Responder
- Jabber::Version::SimpleResponder
- Jabber::X
- Jabber::XHTML
- Jabber::XHTML::Body
- Jabber::XHTML::HTML
- Jabber::XMPPElement
- Jabber::XMPPStanza
- Jabber::XParent
- REXML
- REXML::Element
- REXML::IOSource
- XMLRPC
- XMLRPC::Create
- Base64
- ObservableThing
- QObserver
- ThreadStore

No matching classes.

# Jabber::UserLocation::Location

The <geoloc> XMPP element, as defined in XEP-0080 User Location

See xmpp.org/extensions/xep-0080.html - this element encapsulates data about a user's current location. These are expressed as child elements such as <locality>, <lat>, etc. which are also managed by this class.

If the element has no children then it indicates that the user has stopped publishing their location.

### Public Class Methods

new(attributes = {}) click to toggle source

Construct a new <location> element.

Supply no arguments to make an empty element to indicate that location is no longer being published.

attributes

Hash

  location attributes

    # File lib/xmpp4r/location/location.rb, line 37
    def initialize(attributes = {})
      super()

      # validate attributes
      attributes = attributes.select do |k,v|
        ALLOWABLE_ATTRIBUTES.include?(k) && !v.nil?
      end

      attributes.each do |k,v|
        v = x.xmlschema if v.is_a?(Time)
        add_element(REXML::Element.new(k)).text = v.to_s
      end
    end

### Public Instance Methods

accuracy() click to toggle source

Get the accuracy attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 60
    def accuracy
      first_element('accuracy').text if first_element('accuracy')
    end

alt() click to toggle source

Get the alt attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 66
    def alt
      first_element('alt').text if first_element('alt')
    end

area() click to toggle source

Get the area attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 72
    def area
      first_element('area').text if first_element('area')
    end

bearing() click to toggle source

Get the bearing attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 78
    def bearing
      first_element('bearing').text if first_element('bearing')
    end

building() click to toggle source

Get the building attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 84
    def building
      first_element('building').text if first_element('building')
    end

country() click to toggle source

Get the country attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 90
    def country
      first_element('country').text if first_element('country')
    end

datum() click to toggle source

Get the datum attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 96
    def datum
      first_element('datum').text if first_element('datum')
    end

description() click to toggle source

Get the description attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 102
    def description
      first_element('description').text if first_element('description')
    end

floor() click to toggle source

Get the floor attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 108
    def floor
      first_element('floor').text if first_element('floor')
    end

lat() click to toggle source

Get the lat attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 114
    def lat
      first_element('lat').text if first_element('lat')
    end

locality() click to toggle source

Get the locality attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 120
    def locality
      first_element('locality').text if first_element('locality')
    end

lon() click to toggle source

Get the lon attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 126
    def lon
      first_element('lon').text if first_element('lon')
    end

postalcode() click to toggle source

Get the postalcode attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 132
    def postalcode
      first_element('postalcode').text if first_element('postalcode')
    end

published?() click to toggle source

Returns true if a location is currently being published, otherwise false.

    # File lib/xmpp4r/location/location.rb, line 54
    def published?
      (elements.size > 0)
    end

region() click to toggle source

Get the region attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 138
    def region
      first_element('region').text if first_element('region')
    end

room() click to toggle source

Get the room attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 144
    def room
      first_element('room').text if first_element('room')
    end

speed() click to toggle source

Get the speed attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 150
    def speed
      first_element('speed').text if first_element('speed')
    end

street() click to toggle source

Get the street attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 156
    def street
      first_element('street').text if first_element('street')
    end

text() click to toggle source

Get the text attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 162
    def text
      first_element('text').text if first_element('text')
    end

timestamp() click to toggle source

Get the timestamp attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 168
    def timestamp
      first_element('timestamp').text if first_element('timestamp')
    end

uri() click to toggle source

Get the uri attribute of this location.

    # File lib/xmpp4r/location/location.rb, line 174
    def uri
      first_element('uri').text if first_element('uri')
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.