Class: IpwhoApi::UserAgent

Inherits:
Struct
  • Object
show all
Defined in:
lib/ipwho.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#browserObject

Returns the value of attribute browser

Returns:

  • (Object)

    the current value of browser



154
155
156
# File 'lib/ipwho.rb', line 154

def browser
  @browser
end

#cpuObject

Returns the value of attribute cpu

Returns:

  • (Object)

    the current value of cpu



154
155
156
# File 'lib/ipwho.rb', line 154

def cpu
  @cpu
end

#deviceObject

Returns the value of attribute device

Returns:

  • (Object)

    the current value of device



154
155
156
# File 'lib/ipwho.rb', line 154

def device
  @device
end

#engineObject

Returns the value of attribute engine

Returns:

  • (Object)

    the current value of engine



154
155
156
# File 'lib/ipwho.rb', line 154

def engine
  @engine
end

#osObject

Returns the value of attribute os

Returns:

  • (Object)

    the current value of os



154
155
156
# File 'lib/ipwho.rb', line 154

def os
  @os
end

Class Method Details

.from_hash(hash) ⇒ Object



155
156
157
158
159
160
161
162
163
# File 'lib/ipwho.rb', line 155

def self.from_hash(hash)
  new(
    browser: hash["browser"] ? UserAgentBrowser.from_hash(hash["browser"]) : nil,
    engine:  hash["engine"]  ? UserAgentEngine.from_hash(hash["engine"])   : nil,
    os:      hash["os"]      ? UserAgentOS.from_hash(hash["os"])           : nil,
    device:  hash["device"]  ? UserAgentDevice.from_hash(hash["device"])   : nil,
    cpu:     hash["cpu"]     ? UserAgentCPU.from_hash(hash["cpu"])         : nil
  )
end