class Zzlink::User
A zzLink user.
Attributes
access_token[RW]
avatar_url[RW]
created_at[RW]
email[RW]
home_url[RW]
id[RW]
name[RW]
oauth_id[RW]
oauth_provider[RW]
oauth_scope[RW]
token_type[RW]
updated_at[RW]
Public Class Methods
new(attributes = {})
click to toggle source
New a User
object. @param attributes [Hash] attributes of the new user.
# File lib/zzlink/users.rb, line 14 def initialize(attributes = {}) from_hash(attributes) end
Public Instance Methods
from_hash(attributes)
click to toggle source
Assign attributes from a Hash. @param attributes [Hash] attributes.
# File lib/zzlink/users.rb, line 20 def from_hash(attributes) attributes.each_pair do |k, v| setter = case k.to_sym when :avatarURL then :avatar_url= when :homeURL then :home_url= when :accessToken then :access_token= when :tokenType then :token_type= when :oauthScope then :oauth_scope= when :oauthId then :oauth_id= when :oauthProvider then :oauth_provider= when :createdAt then :created_at= when :updatedAt then :created_at= else "#{k}=".to_sym end send(setter, v) if respond_to?(setter) end end
to_hash()
click to toggle source
# File lib/zzlink/users.rb, line 38 def to_hash hash = {} hash['id'] = id unless id.nil? hash['name'] = name unless name.nil? hash['avatarURL'] = avatar_url unless avatar_url.nil? hash['homeURL'] = home_url unless home_url.nil? hash['email'] = email unless email.nil? hash['accessToken'] = access_token unless access_token.nil? hash['tokenType'] = token_type unless token_type.nil? hash['oauthScope'] = oauth_scope unless oauth_scope.nil? hash['oauthId'] = oauth_id unless oauth_id.nil? hash['oauthProvider'] = oauth_provider unless oauth_provider.nil? hash['createdAt'] = created_at unless created_at.nil? hash['updatedAt'] = updated_at unless updated_at.nil? hash end