Class: Twilio::REST::PreviewIam::Versionless::OrganizationContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::PreviewIam::Versionless::OrganizationContext
- Defined in:
- lib/twilio-ruby/rest/preview_iam/versionless/organization.rb,
lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb,
lib/twilio-ruby/rest/preview_iam/versionless/organization/account.rb,
lib/twilio-ruby/rest/preview_iam/versionless/organization/role_assignment.rb
Defined Under Namespace
Classes: AccountContext, AccountInstance, AccountList, AccountPage, RoleAssignmentContext, RoleAssignmentInstance, RoleAssignmentList, RoleAssignmentPage, UserContext, UserInstance, UserList, UserPage
Instance Method Summary collapse
-
#accounts(account_sid = :unset) ⇒ AccountList, AccountContext
Access the accounts.
-
#fetch ⇒ OrganizationInstance
Fetch the OrganizationInstance.
-
#initialize(version, organization_sid) ⇒ OrganizationContext
constructor
Initialize the OrganizationContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#resource_types ⇒ ResourceTypeList, ResourceTypeContext
Access the resource_types.
-
#role_assignments(sid = :unset) ⇒ RoleAssignmentList, RoleAssignmentContext
Access the role_assignments.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#users(id = :unset) ⇒ UserList, UserContext
Access the users.
Constructor Details
#initialize(version, organization_sid) ⇒ OrganizationContext
Initialize the OrganizationContext
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 49 def initialize(version, organization_sid) super(version) # Path Solution @solution = { organization_sid: organization_sid, } @uri = "/#{@solution[:organization_sid]}" # Dependents @resource_types = nil @role_assignments = nil @accounts = nil @users = nil end |
Instance Method Details
#accounts(account_sid = :unset) ⇒ AccountList, AccountContext
Access the accounts
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 115 def accounts(account_sid=:unset) raise ArgumentError, 'account_sid cannot be nil' if account_sid.nil? if account_sid != :unset return AccountContext.new(@version, @solution[:organization_sid],account_sid ) end unless @accounts @accounts = AccountList.new( @version, organization_sid: @solution[:organization_sid], ) end @accounts end |
#fetch ⇒ OrganizationInstance
Fetch the OrganizationInstance
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 65 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Accept'] = 'application/scim+json' payload = @version.fetch('GET', @uri, headers: headers) OrganizationInstance.new( @version, payload, organization_sid: @solution[:organization_sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
159 160 161 162 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 159 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.PreviewIam.Versionless.OrganizationContext #{context}>" end |
#resource_types ⇒ ResourceTypeList, ResourceTypeContext
Access the resource_types
85 86 87 88 89 90 91 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 85 def resource_types unless @resource_types @resource_types = ResourceTypeList.new( @version, ) end @resource_types end |
#role_assignments(sid = :unset) ⇒ RoleAssignmentList, RoleAssignmentContext
Access the role_assignments
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 96 def role_assignments(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return RoleAssignmentContext.new(@version, @solution[:organization_sid],sid ) end unless @role_assignments @role_assignments = RoleAssignmentList.new( @version, organization_sid: @solution[:organization_sid], ) end @role_assignments end |
#to_s ⇒ Object
Provide a user friendly representation
152 153 154 155 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 152 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.PreviewIam.Versionless.OrganizationContext #{context}>" end |
#users(id = :unset) ⇒ UserList, UserContext
Access the users
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization.rb', line 134 def users(id=:unset) raise ArgumentError, 'id cannot be nil' if id.nil? if id != :unset return UserContext.new(@version, @solution[:organization_sid],id ) end unless @users @users = UserList.new( @version, organization_sid: @solution[:organization_sid], ) end @users end |