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



104
105
106
107
108
109
110
111
112
113
# File 'lib/twilio-ruby/rest/oauth/v1/oauth.rb', line 104

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:



119
120
121
122
123
124
# File 'lib/twilio-ruby/rest/oauth/v1/oauth.rb', line 119

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

#fetchOauthInstance

Fetch the OauthInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#keysHash

Returns A collection of certificates.

Returns:

  • (Hash)

    A collection of certificates



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

def keys
  @properties['keys']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end