Class: Openname::User

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, openname) ⇒ User

Returns a new instance of User.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/openname.rb', line 104

def initialize(json,openname)
  @openname = openname
  @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"]
  @github_username = json["github"]["username"] if json["github"]
  @facebook_username = json["facebook"]["username"] if json["facebook"]
  @twitter_username = json["twitter"]["username"] if json["twitter"]
  @linkedin_username = json["linkedin"]["username"] if json["linkedin"]
  @bitcoin_address = json["bitcoin"]["address"] if json["bitcoin"]
  @bitmessage_address = json["bitmessage"]["username"] 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["url"]
  @schema_version = json["v"]
  @orgs = parse_orgs(json["orgs"])
end

Instance Attribute Details

#avatar_urlObject (readonly)

Returns the value of attribute avatar_url.



86
87
88
# File 'lib/openname.rb', line 86

def avatar_url
  @avatar_url
end

#bioObject (readonly)

Returns the value of attribute bio.



90
91
92
# File 'lib/openname.rb', line 90

def bio
  @bio
end

#bitcoin_addressObject (readonly)

Returns the value of attribute bitcoin_address.



95
96
97
# File 'lib/openname.rb', line 95

def bitcoin_address
  @bitcoin_address
end

#bitcoinotc_usernameObject (readonly)

Returns the value of attribute bitcoinotc_username.



97
98
99
# File 'lib/openname.rb', line 97

def bitcoinotc_username
  @bitcoinotc_username
end

#bitmessage_addressObject (readonly)

Returns the value of attribute bitmessage_address.



96
97
98
# File 'lib/openname.rb', line 96

def bitmessage_address
  @bitmessage_address
end

#cover_urlObject (readonly)

Returns the value of attribute cover_url.



87
88
89
# File 'lib/openname.rb', line 87

def cover_url
  @cover_url
end

#facebook_usernameObject (readonly)

Returns the value of attribute facebook_username.



92
93
94
# File 'lib/openname.rb', line 92

def facebook_username
  @facebook_username
end

#github_usernameObject (readonly)

Returns the value of attribute github_username.



91
92
93
# File 'lib/openname.rb', line 91

def github_username
  @github_username
end

#linkedin_usernameObject (readonly)

Returns the value of attribute linkedin_username.



94
95
96
# File 'lib/openname.rb', line 94

def linkedin_username
  @linkedin_username
end

#location_formattedObject (readonly)

Returns the value of attribute location_formatted.



88
89
90
# File 'lib/openname.rb', line 88

def location_formatted
  @location_formatted
end

#name_formattedObject (readonly)

Returns the value of attribute name_formatted.



85
86
87
# File 'lib/openname.rb', line 85

def name_formatted
  @name_formatted
end

#opennameObject (readonly)

Returns the value of attribute openname.



84
85
86
# File 'lib/openname.rb', line 84

def openname
  @openname
end

#orgsObject (readonly)

Returns the value of attribute orgs.



100
101
102
# File 'lib/openname.rb', line 100

def orgs
  @orgs
end

#pgp_fingerprintObject (readonly)

Returns the value of attribute pgp_fingerprint.



98
99
100
# File 'lib/openname.rb', line 98

def pgp_fingerprint
  @pgp_fingerprint
end

#pgp_urlObject (readonly)

Returns the value of attribute pgp_url.



99
100
101
# File 'lib/openname.rb', line 99

def pgp_url
  @pgp_url
end

#schema_versionObject (readonly)

Returns the value of attribute schema_version.



101
102
103
# File 'lib/openname.rb', line 101

def schema_version
  @schema_version
end

#twitter_usernameObject (readonly)

Returns the value of attribute twitter_username.



93
94
95
# File 'lib/openname.rb', line 93

def twitter_username
  @twitter_username
end

#websiteObject (readonly)

Returns the value of attribute website.



89
90
91
# File 'lib/openname.rb', line 89

def website
  @website
end

Class Method Details

.from_json(json, openname) ⇒ Object



80
81
82
# File 'lib/openname.rb', line 80

def self.from_json(json,openname)
  User.new(json,openname)
end