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

  • account_sid (String)

    The SID of the Account that created this Policies resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 208

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:



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

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

#fetchPoliciesInstance

Fetch the PoliciesInstance

Returns:



262
263
264
265
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 262

def fetch

    context.fetch
end

#friendly_nameString

Returns A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy.

Returns:

  • (String)

    A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



276
277
278
279
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 276

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

#requirementsHash

Returns The SID of an object that holds the policy information.

Returns:

  • (Hash)

    The SID of an object that holds the policy information



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

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.



237
238
239
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 237

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/trusthub/v1/policies.rb', line 269

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.



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

def url
    @properties['url']
end