Class: Twilio::REST::Trusthub::V1::PoliciesInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ PoliciesInstance

Initialize the PoliciesInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The unique string that identifies the Policy resource.


187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 187

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'friendly_name' => payload['friendly_name'],
      'requirements' => payload['requirements'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#contextPoliciesContext

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

Returns:


207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 207

def context
  unless @instance_context
    @instance_context = PoliciesContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#fetchPoliciesInstance

Fetch the PoliciesInstance

Returns:


241
242
243
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 241

def fetch
  context.fetch
end

#friendly_nameString

Returns A human-readable description of the Policy resource.

Returns:

  • (String)

    A human-readable description of the Policy resource


222
223
224
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 222

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


254
255
256
257
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 254

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

#requirementsHash

Returns The sid of a Policy object that dictates requirements.

Returns:

  • (Hash)

    The sid of a Policy object that dictates requirements


228
229
230
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 228

def requirements
  @properties['requirements']
end

#sidString

Returns The unique string that identifies the Policy resource.

Returns:

  • (String)

    The unique string that identifies the Policy resource


216
217
218
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 216

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


247
248
249
250
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 247

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

#urlString

Returns The absolute URL of the Policy resource.

Returns:

  • (String)

    The absolute URL of the Policy resource


234
235
236
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 234

def url
  @properties['url']
end