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

  • account_sid (String)

    The SID of the Account that created this UserInfo resource.

  • sid (String)

    The SID of the Call resource to fetch.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 122

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:



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

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.



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

def email
    @properties['email']
end

#fetchUserInfoInstance

Fetch the UserInfoInstance

Returns:



190
191
192
193
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 190

def fetch

    context.fetch
end

#first_nameString

Returns The first name of the end-user.

Returns:

  • (String)

    The first name of the end-user.



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

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.



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



204
205
206
207
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 204

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.



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

def last_name
    @properties['last_name']
end

#to_sObject

Provide a user friendly representation



197
198
199
200
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 197

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

#urlString

Returns:

  • (String)


183
184
185
# File 'lib/twilio-ruby/rest/oauth/v1/user_info.rb', line 183

def url
    @properties['url']
end

#user_sidString

Returns The URL of the party that will create the token and sign it with its private key.

Returns:

  • (String)

    The URL of the party that will create the token and sign it with its private key.



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

def user_sid
    @properties['user_sid']
end