Class: Twilio::REST::Oauth::V1::OauthInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ OauthInstance

Initialize the OauthInstance

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 Oauth resource.

  • sid (String)

    The SID of the Call resource to fetch.



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

def initialize(version, payload )
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'keys' => payload['keys'],
        'url' => payload['url'],
    }

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

Instance Method Details

#contextOauthContext

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

Returns:



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

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

#fetchOauthInstance

Fetch the OauthInstance

Returns:



162
163
164
165
# File 'lib/twilio-ruby/rest/oauth/v1/oauth.rb', line 162

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#keysHash

Returns A collection of certificates where are signed Twilio-issued tokens.

Returns:

  • (Hash)

    A collection of certificates where are signed Twilio-issued tokens.



149
150
151
# File 'lib/twilio-ruby/rest/oauth/v1/oauth.rb', line 149

def keys
    @properties['keys']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns:

  • (String)


155
156
157
# File 'lib/twilio-ruby/rest/oauth/v1/oauth.rb', line 155

def url
    @properties['url']
end