Class: Twilio::REST::PreviewIam::Versionless::OrganizationContext::AccountInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, organization_sid: nil, account_sid: nil) ⇒ AccountInstance

Initialize the AccountInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Account resource.

  • sid (String)

    The SID of the Call resource to fetch.



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 222

def initialize(version, payload , organization_sid: nil, account_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'status' => payload['status'],
        'owner_sid' => payload['owner_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
    }

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

Instance Method Details

#account_sidString

Returns Twilio account sid.

Returns:

  • (String)

    Twilio account sid



252
253
254
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 252

def 
    @properties['account_sid']
end

#contextAccountContext

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

Returns:



243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 243

def context
    unless @instance_context
        @instance_context = AccountContext.new(@version , @params['organization_sid'], @params['account_sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time when the account was created in the system.

Returns:

  • (Time)

    The date and time when the account was created in the system



276
277
278
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 276

def date_created
    @properties['date_created']
end

#fetchAccountInstance

Fetch the AccountInstance

Returns:



283
284
285
286
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 283

def fetch

    context.fetch
end

#friendly_nameString

Returns Account friendly name.

Returns:

  • (String)

    Account friendly name



258
259
260
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 258

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



297
298
299
300
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 297

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

#owner_sidString

Returns Twilio account sid.

Returns:

  • (String)

    Twilio account sid



270
271
272
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 270

def owner_sid
    @properties['owner_sid']
end

#statusString

Returns Account status.

Returns:

  • (String)

    Account status



264
265
266
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 264

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



290
291
292
293
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb', line 290

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