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, username) ⇒ User

Returns a new instance of User.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/openname.rb', line 177

def initialize(json,username)
    if(json["profile"])
        json = json["profile"]
    end

    @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"])


end

Instance Attribute Details

#angellist_usernameObject (readonly)

Returns the value of attribute angellist_username.



162
163
164
# File 'lib/openname.rb', line 162

def angellist_username
  @angellist_username
end

#avatar_urlObject (readonly)

Returns the value of attribute avatar_url.



157
158
159
# File 'lib/openname.rb', line 157

def avatar_url
  @avatar_url
end

#bioObject (readonly)

Returns the value of attribute bio.



161
162
163
# File 'lib/openname.rb', line 161

def bio
  @bio
end

#bitcoin_addressObject (readonly)

Returns the value of attribute bitcoin_address.



168
169
170
# File 'lib/openname.rb', line 168

def bitcoin_address
  @bitcoin_address
end

#bitcoinotc_usernameObject (readonly)

Returns the value of attribute bitcoinotc_username.



170
171
172
# File 'lib/openname.rb', line 170

def bitcoinotc_username
  @bitcoinotc_username
end

#bitmessage_addressObject (readonly)

Returns the value of attribute bitmessage_address.



169
170
171
# File 'lib/openname.rb', line 169

def bitmessage_address
  @bitmessage_address
end

#cover_urlObject (readonly)

Returns the value of attribute cover_url.



158
159
160
# File 'lib/openname.rb', line 158

def cover_url
  @cover_url
end

#facebook_usernameObject (readonly)

Returns the value of attribute facebook_username.



164
165
166
# File 'lib/openname.rb', line 164

def facebook_username
  @facebook_username
end

#github_usernameObject (readonly)

Returns the value of attribute github_username.



163
164
165
# File 'lib/openname.rb', line 163

def github_username
  @github_username
end

#instagram_usernameObject (readonly)

Returns the value of attribute instagram_username.



166
167
168
# File 'lib/openname.rb', line 166

def instagram_username
  @instagram_username
end

#linkedin_urlObject (readonly)

Returns the value of attribute linkedin_url.



167
168
169
# File 'lib/openname.rb', line 167

def linkedin_url
  @linkedin_url
end

#location_formattedObject (readonly)

Returns the value of attribute location_formatted.



159
160
161
# File 'lib/openname.rb', line 159

def location_formatted
  @location_formatted
end

#name_formattedObject (readonly)

Returns the value of attribute name_formatted.



156
157
158
# File 'lib/openname.rb', line 156

def name_formatted
  @name_formatted
end

#orgsObject (readonly)

Returns the value of attribute orgs.



173
174
175
# File 'lib/openname.rb', line 173

def orgs
  @orgs
end

#pgp_fingerprintObject (readonly)

Returns the value of attribute pgp_fingerprint.



171
172
173
# File 'lib/openname.rb', line 171

def pgp_fingerprint
  @pgp_fingerprint
end

#pgp_urlObject (readonly)

Returns the value of attribute pgp_url.



172
173
174
# File 'lib/openname.rb', line 172

def pgp_url
  @pgp_url
end

#schema_versionObject (readonly)

Returns the value of attribute schema_version.



174
175
176
# File 'lib/openname.rb', line 174

def schema_version
  @schema_version
end

#twitter_usernameObject (readonly)

Returns the value of attribute twitter_username.



165
166
167
# File 'lib/openname.rb', line 165

def twitter_username
  @twitter_username
end

#usernameObject (readonly)

Returns the value of attribute username.



155
156
157
# File 'lib/openname.rb', line 155

def username
  @username
end

#websiteObject (readonly)

Returns the value of attribute website.



160
161
162
# File 'lib/openname.rb', line 160

def website
  @website
end

Class Method Details

.from_json(json, openname) ⇒ Object



151
152
153
# File 'lib/openname.rb', line 151

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

Instance Method Details

#opennameObject



206
207
208
209
# File 'lib/openname.rb', line 206

def openname
    warn "[DEPRECATION] `openname` is deprecated.  Please use `username` instead."
    username
end