Class: Twilio::REST::Oauth::V1::UserInfoInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/oauth/v1/user_info.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ UserInfoInstance

Initialize the UserInfoInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 104

def initialize(version, payload)
  super(version)

  # Marshaled Properties
  @properties = {
      'user_sid' => payload['user_sid'],
      'first_name' => payload['first_name'],
      'last_name' => payload['last_name'],
      'friendly_name' => payload['friendly_name'],
      'email' => payload['email'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {}
end

Instance Method Details

#contextUserInfoContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



126
127
128
129
130
131
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 126

def context
  unless @instance_context
    @instance_context = UserInfoContext.new(@version, )
  end
  @instance_context
end

#emailString

Returns The end-user’s preferred email address.

Returns:

  • (String)

    The end-user’s preferred email address



159
160
161
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 159

def email
  @properties['email']
end

#fetchUserInfoInstance

Fetch the UserInfoInstance

Returns:



172
173
174
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 172

def fetch
  context.fetch
end

#first_nameString

Returns The first name of the end-user.

Returns:

  • (String)

    The first name of the end-user



141
142
143
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 141

def first_name
  @properties['first_name']
end

#friendly_nameString

Returns The friendly name of the end-user.

Returns:

  • (String)

    The friendly name of the end-user



153
154
155
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 153

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



185
186
187
188
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 185

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Oauth.V1.UserInfoInstance #{values}>"
end

#last_nameString

Returns The last name of the end-user.

Returns:

  • (String)

    The last name of the end-user



147
148
149
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 147

def last_name
  @properties['last_name']
end

#to_sObject

Provide a user friendly representation



178
179
180
181
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 178

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Oauth.V1.UserInfoInstance #{values}>"
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



165
166
167
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 165

def url
  @properties['url']
end

#user_sidString

Returns The user sid.

Returns:

  • (String)

    The user sid



135
136
137
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 135

def user_sid
  @properties['user_sid']
end