Class: Infostrada::PersonInfo

Inherits:
BaseRequest show all
Defined in:
lib/infostrada/person_info.rb

Constant Summary collapse

URL =
'/GetPersonInfo'

Constants inherited from BaseRequest

BaseRequest::RETRIES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseRequest

get!

Constructor Details

#initialize(id, info) ⇒ PersonInfo

Returns a new instance of PersonInfo.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/infostrada/person_info.rb', line 18

def initialize(id, info)
  @id = id

  # Sometimes info comes as an empty array...
  return unless info && !info.empty?

  @first_name = info['c_FirstName']
  @last_name = info['c_LastName']
  @public_name = info['c_PublicName']
  @nickname = info['c_Nickname']
  @birthdate = Formatter.format_date(info['d_BirthDate'])
  @height = info['n_Height']
  @weight = info['n_Weight']
  @birth_city = info['c_BirthCity']
  @birth_country = info['c_BirthCountry']
end

Instance Attribute Details

#birth_cityObject

Returns the value of attribute birth_city.



8
9
10
# File 'lib/infostrada/person_info.rb', line 8

def birth_city
  @birth_city
end

#birth_countryObject

Returns the value of attribute birth_country.



8
9
10
# File 'lib/infostrada/person_info.rb', line 8

def birth_country
  @birth_country
end

#birthdateObject

Returns the value of attribute birthdate.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def birthdate
  @birthdate
end

#first_nameObject

Returns the value of attribute first_name.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def first_name
  @first_name
end

#heightObject

Returns the value of attribute height.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def height
  @height
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def last_name
  @last_name
end

#nicknameObject

Returns the value of attribute nickname.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def nickname
  @nickname
end

#public_nameObject

Returns the value of attribute public_name.



7
8
9
# File 'lib/infostrada/person_info.rb', line 7

def public_name
  @public_name
end

#weightObject

Returns the value of attribute weight.



8
9
10
# File 'lib/infostrada/person_info.rb', line 8

def weight
  @weight
end

Class Method Details

.where(options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/infostrada/person_info.rb', line 10

def self.where(options)
  id = options.delete(:person_id)

  info = get!(URL, query: { personid: id }).first

  new(id, info)
end