Class: Aladin::User
- Inherits:
-
Object
- Object
- Aladin::User
- Defined in:
- lib/aladin/user.rb
Instance Attribute Summary collapse
-
#angellist_username ⇒ Object
readonly
Returns the value of attribute angellist_username.
-
#avatar_url ⇒ Object
readonly
Returns the value of attribute avatar_url.
-
#bio ⇒ Object
readonly
Returns the value of attribute bio.
-
#bitcoin_address ⇒ Object
readonly
Returns the value of attribute bitcoin_address.
-
#bitcoinotc_username ⇒ Object
readonly
Returns the value of attribute bitcoinotc_username.
-
#bitmessage_address ⇒ Object
readonly
Returns the value of attribute bitmessage_address.
-
#cover_url ⇒ Object
readonly
Returns the value of attribute cover_url.
-
#facebook_username ⇒ Object
readonly
Returns the value of attribute facebook_username.
-
#github_username ⇒ Object
readonly
Returns the value of attribute github_username.
-
#instagram_username ⇒ Object
readonly
Returns the value of attribute instagram_username.
-
#linkedin_url ⇒ Object
readonly
Returns the value of attribute linkedin_url.
-
#location_formatted ⇒ Object
readonly
Returns the value of attribute location_formatted.
-
#name_formatted ⇒ Object
readonly
Returns the value of attribute name_formatted.
-
#orgs ⇒ Object
readonly
Returns the value of attribute orgs.
-
#pgp_fingerprint ⇒ Object
readonly
Returns the value of attribute pgp_fingerprint.
-
#pgp_url ⇒ Object
readonly
Returns the value of attribute pgp_url.
-
#schema_version ⇒ Object
readonly
Returns the value of attribute schema_version.
-
#twitter_username ⇒ Object
readonly
Returns the value of attribute twitter_username.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json, username) ⇒ User
constructor
A new instance of User.
- #openname ⇒ Object
Constructor Details
#initialize(json, username) ⇒ User
Returns a new instance of User.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/aladin/user.rb', line 28 def initialize(json, username) json = json['profile'] if json['profile'] if json['v'] == '0.2' @username = username @name_formatted = json['name']['formatted'] if json['name'] @avatar_url = json['avatar']['url'] if json['avatar'] @cover_url = json['cover']['url'] if json['cover'] @location_formatted = json['location']['formatted'] if json['location'] @website = json['website'] @bio = json['bio'] @angellist_username = json['angellist']['username'] if json['angellist'] @github_username = json['github']['username'] if json['github'] @facebook_username = json['facebook']['username'] if json['facebook'] @twitter_username = json['twitter']['username'] if json['twitter'] @instagram_username = json['instagram']['username'] if json['instagram'] @linkedin_url = json['linkedin']['url'] if json['linkedin'] @bitcoin_address = json['bitcoin']['address'] if json['bitcoin'] @bitmessage_address = json['bitmessage']['address'] if json['bitmessage'] @bitcoinotc_username = json['bitcoinotc']['username'] if json['bitcoinotc'] @pgp_fingerprint = json['pgp']['fingerprint'] if json['pgp'] @pgp_url = json['pgp']['url'] if json['pgp'] @schema_version = json['v'] @orgs = parse_orgs(json['orgs']) else @username = username @name_formatted = json['name'] if json['name'] @avatar_url = find_image_url(json, 'avatar') @cover_url = find_image_url(json, 'cover') @location_formatted = json['address']['addressLocality'] if json['address'] @website = json['website'][0]['url'] if json['website'] && json['website'][0] @bio = json['description'] @angellist_username = find_account_username(json, 'angellist') @github_username = find_account_username(json, 'github') @facebook_username = find_account_username(json, 'facebook') @twitter_username = find_account_username(json, 'twitter') @instagram_username = find_account_username(json, 'instagram') @linkedin_url = find_account_username(json, 'linkedin') @bitcoin_address = find_account_username(json, 'bitcoin') @bitmessage_address = find_account_username(json, 'bitmessage') @bitcoinotc_username = find_account_username(json, 'bitcoinotc') @pgp_fingerprint = find_account_username(json, 'pgp') @pgp_url = find_account(json, 'pgp')['contentUrl'] if @pgp_fingerprint @schema_version = '0.3' @orgs = parse_orgs(json['orgs']) end end |
Instance Attribute Details
#angellist_username ⇒ Object (readonly)
Returns the value of attribute angellist_username.
14 15 16 |
# File 'lib/aladin/user.rb', line 14 def angellist_username @angellist_username end |
#avatar_url ⇒ Object (readonly)
Returns the value of attribute avatar_url.
9 10 11 |
# File 'lib/aladin/user.rb', line 9 def avatar_url @avatar_url end |
#bio ⇒ Object (readonly)
Returns the value of attribute bio.
13 14 15 |
# File 'lib/aladin/user.rb', line 13 def bio @bio end |
#bitcoin_address ⇒ Object (readonly)
Returns the value of attribute bitcoin_address.
20 21 22 |
# File 'lib/aladin/user.rb', line 20 def bitcoin_address @bitcoin_address end |
#bitcoinotc_username ⇒ Object (readonly)
Returns the value of attribute bitcoinotc_username.
22 23 24 |
# File 'lib/aladin/user.rb', line 22 def bitcoinotc_username @bitcoinotc_username end |
#bitmessage_address ⇒ Object (readonly)
Returns the value of attribute bitmessage_address.
21 22 23 |
# File 'lib/aladin/user.rb', line 21 def @bitmessage_address end |
#cover_url ⇒ Object (readonly)
Returns the value of attribute cover_url.
10 11 12 |
# File 'lib/aladin/user.rb', line 10 def cover_url @cover_url end |
#facebook_username ⇒ Object (readonly)
Returns the value of attribute facebook_username.
16 17 18 |
# File 'lib/aladin/user.rb', line 16 def facebook_username @facebook_username end |
#github_username ⇒ Object (readonly)
Returns the value of attribute github_username.
15 16 17 |
# File 'lib/aladin/user.rb', line 15 def github_username @github_username end |
#instagram_username ⇒ Object (readonly)
Returns the value of attribute instagram_username.
18 19 20 |
# File 'lib/aladin/user.rb', line 18 def instagram_username @instagram_username end |
#linkedin_url ⇒ Object (readonly)
Returns the value of attribute linkedin_url.
19 20 21 |
# File 'lib/aladin/user.rb', line 19 def linkedin_url @linkedin_url end |
#location_formatted ⇒ Object (readonly)
Returns the value of attribute location_formatted.
11 12 13 |
# File 'lib/aladin/user.rb', line 11 def location_formatted @location_formatted end |
#name_formatted ⇒ Object (readonly)
Returns the value of attribute name_formatted.
8 9 10 |
# File 'lib/aladin/user.rb', line 8 def name_formatted @name_formatted end |
#orgs ⇒ Object (readonly)
Returns the value of attribute orgs.
25 26 27 |
# File 'lib/aladin/user.rb', line 25 def orgs @orgs end |
#pgp_fingerprint ⇒ Object (readonly)
Returns the value of attribute pgp_fingerprint.
23 24 25 |
# File 'lib/aladin/user.rb', line 23 def pgp_fingerprint @pgp_fingerprint end |
#pgp_url ⇒ Object (readonly)
Returns the value of attribute pgp_url.
24 25 26 |
# File 'lib/aladin/user.rb', line 24 def pgp_url @pgp_url end |
#schema_version ⇒ Object (readonly)
Returns the value of attribute schema_version.
26 27 28 |
# File 'lib/aladin/user.rb', line 26 def schema_version @schema_version end |
#twitter_username ⇒ Object (readonly)
Returns the value of attribute twitter_username.
17 18 19 |
# File 'lib/aladin/user.rb', line 17 def twitter_username @twitter_username end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/aladin/user.rb', line 7 def username @username end |
#website ⇒ Object (readonly)
Returns the value of attribute website.
12 13 14 |
# File 'lib/aladin/user.rb', line 12 def website @website end |
Class Method Details
Instance Method Details
#openname ⇒ Object
76 77 78 79 |
# File 'lib/aladin/user.rb', line 76 def openname warn '[DEPRECATION] `openname` is deprecated. Please use `username` instead.' username end |