Class: KondutoDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/konduto-ruby/konduto_device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KondutoDevice

Returns a new instance of KondutoDevice.


4
5
6
7
8
9
10
# File 'lib/konduto-ruby/konduto_device.rb', line 4

def initialize(*args)
  unless args[0].nil?
    args[0].each do |k,v|
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end
end

Instance Attribute Details

#browserObject

Returns the value of attribute browser


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def browser
  @browser
end

Returns the value of attribute cookie


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def cookie
  @cookie
end

#fingerprintObject

Returns the value of attribute fingerprint


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def fingerprint
  @fingerprint
end

#flashObject

Returns the value of attribute flash


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def flash
  @flash
end

#ipObject

Returns the value of attribute ip


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def ip
  @ip
end

#javascriptObject

Returns the value of attribute javascript


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def javascript
  @javascript
end

#languageObject

Returns the value of attribute language


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def language
  @language
end

#platformObject

Returns the value of attribute platform


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def platform
  @platform
end

#timezoneObject

Returns the value of attribute timezone


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def timezone
  @timezone
end

#user_idObject

Returns the value of attribute user_id


2
3
4
# File 'lib/konduto-ruby/konduto_device.rb', line 2

def user_id
  @user_id
end

Instance Method Details

#to_hashObject


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/konduto-ruby/konduto_device.rb', line 12

def to_hash
  hash = {
      user_id: self.user_id,
      fingerprint: self.fingerprint,
      platform: self.platform,
      browser: self.browser,
      language: self.language,
      timezone: self.timezone,
      cookie: self.cookie,
      javascript: self.javascript,
      flash: self.flash,
      ip: self.ip
  }
  KondutoUtils.remove_nil_keys_from_hash(hash)
end

#to_jsonObject


28
29
30
# File 'lib/konduto-ruby/konduto_device.rb', line 28

def to_json
  self.to_hash.to_json
end