Skip to content

Commit

Permalink
Merge branch 'public-oauth' into oauth-ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
manisha1997 authored Dec 6, 2024
2 parents f938ca3 + e4e5199 commit f0d1668
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 53 deletions.
4 changes: 0 additions & 4 deletions lib/twilio-ruby/rest/preview_iam/v1/authorize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ def fetch(
})
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })





payload = @version.fetch('GET', @uri, params: params, headers: headers)
AuthorizeInstance.new(
@version,
Expand Down
4 changes: 0 additions & 4 deletions lib/twilio-ruby/rest/preview_iam/v1/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ def create(

headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })





payload = @version.create('POST', @uri, data: data, headers: headers)
TokenInstance.new(
@version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def initialize(version, organization_sid)
def fetch

headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })



headers['Accept'] = 'application/scim+json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ def fetch

headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })





payload = @version.fetch('GET', @uri, headers: headers)
AccountInstance.new(
@version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Versionless < Version
class OrganizationContext < InstanceContext

class RoleAssignmentList < ListResource

class PublicApiCreateRoleAssignmentRequest
# @param [role_sid]: [String] Twilio Role Sid representing assigned role
# @param [scope]: [String] Twilio Sid representing scope of this assignment
Expand All @@ -40,7 +40,6 @@ def to_json(options = {})
end
end


##
# Initialize the RoleAssignmentList
# @param [Version] version Version that contains the resource
Expand All @@ -65,6 +64,7 @@ def create(public_api_create_role_assignment_request: nil


headers['Accept'] = '*/*'

payload = @version.create('POST', @uri, headers: headers, data: public_api_create_role_assignment_request.to_json)
RoleAssignmentInstance.new(
@version,
Expand All @@ -73,13 +73,10 @@ def create(public_api_create_role_assignment_request: nil
)
end


##
# Lists RoleAssignmentInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
# memory before returning.
# @param [String] identity
# @param [String] scope
# @param [Integer] limit Upper limit for the number of records to return. stream()
# guarantees to never return more than limit. Default is no limit
# @param [Integer] page_size Number of records to fetch per request, when
Expand All @@ -88,6 +85,7 @@ def create(public_api_create_role_assignment_request: nil
# efficient page size, i.e. min(limit, 1000)
# @return [Array] Array of up to limit results
def list(identity: :unset, scope: :unset, limit: nil, page_size: nil)

self.stream(
identity: identity,
scope: scope,
Expand Down Expand Up @@ -172,7 +170,6 @@ def get_page(target_url)
)
RoleAssignmentPage.new(@version, response, @solution)
end



# Provide a user friendly representation
Expand All @@ -196,7 +193,6 @@ def initialize(version, organization_sid, sid)
@solution = { organization_sid: organization_sid, sid: sid, }
@uri = "/#{@solution[:organization_sid]}/RoleAssignments/#{@solution[:sid]}"


end
##
# Delete the RoleAssignmentInstance
Expand Down Expand Up @@ -300,49 +296,41 @@ def context
def sid
@properties['sid']
end

##
# @return [String] Twilio Role Sid representing assigned role
def role_sid
@properties['role_sid']
end

##
# @return [String] Twilio Sid representing identity of this assignment
def scope
@properties['scope']
end

##
# @return [String] Twilio Sid representing scope of this assignment
def identity
@properties['identity']
end

##
# @return [String] Twilio-specific error code
def code
@properties['code']
end

##
# @return [String] Error message
def message
@properties['message']
end

##
# @return [String] Link to Error Code References
def more_info
@properties['more_info']
end

##
# @return [String] HTTP response status code
def status
@properties['status']
end

##
# Delete the RoleAssignmentInstance
# @return [Boolean] True if delete succeeds, false otherwise
Expand Down
39 changes: 14 additions & 25 deletions lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Versionless < Version
class OrganizationContext < InstanceContext

class UserList < ListResource

class ScimUser
# @param [id]: [String] Unique Twilio user sid
# @param [external_id]: [String] External unique resource id defined by provisioning client
Expand Down Expand Up @@ -78,8 +77,6 @@ def to_json(options = {})
}.to_json(options)
end
end


##
# Initialize the UserList
# @param [Version] version Version that contains the resource
Expand All @@ -103,7 +100,7 @@ def create(scim_user: nil
headers['Content-Type'] = 'application/scim+json'

headers['Accept'] = 'application/scim+json'

payload = @version.create('POST', @uri, headers: headers, data: scim_user.to_json)
UserInstance.new(
@version,
Expand All @@ -112,7 +109,6 @@ def create(scim_user: nil
)
end


##
# Lists UserInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
Expand Down Expand Up @@ -205,8 +201,6 @@ def get_page(target_url)
)
UserPage.new(@version, response, @solution)
end



# Provide a user friendly representation
def to_s
Expand All @@ -228,8 +222,6 @@ def initialize(version, organization_sid, id)
# Path Solution
@solution = { organization_sid: organization_sid, id: id, }
@uri = "/#{@solution[:organization_sid]}/scim/Users/#{@solution[:id]}"


end
##
# Delete the UserInstance
Expand All @@ -253,8 +245,7 @@ def fetch


headers['Accept'] = 'application/scim+json'

payload = @version.fetch('GET', @uri, headers: headers)
payload = @version.fetch('GET', @uri, headers: headers)
UserInstance.new(
@version,
payload,
Expand Down Expand Up @@ -385,19 +376,18 @@ def context
def id
@properties['id']
end

##
# @return [String] External unique resource id defined by provisioning client
def external_id
@properties['external_id']
end

##
# @return [String] Unique username, MUST be same as primary email address
def user_name
@properties['user_name']
end

##
# @return [String] User friendly display name
def display_name
Expand All @@ -409,31 +399,30 @@ def display_name
def name
@properties['name']
end

##

# @return [Array<UserList.ScimEmailAddress>] Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.
def emails
@properties['emails']
end

##
# @return [Boolean] Indicates whether the user is active
def active
@properties['active']
end

##
# @return [String] User's locale
def locale
@properties['locale']
end

##
# @return [String] User's time zone
def timezone
@properties['timezone']
end

##
# @return [Array<String>] An array of URIs that indicate the schemas supported for this user resource
def schemas
Expand All @@ -451,31 +440,30 @@ def meta
def detail
@properties['detail']
end

##
# @return [String] A scimType error code as defined in RFC7644
def scim_type
@properties['scim_type']
end

##
# @return [String] Http status code
def status
@properties['status']
end

##
# @return [String] Twilio-specific error code
def code
@properties['code']
end

##
# @return [String] Link to Error Code References
def more_info
@properties['more_info']
end

##
# Delete the UserInstance
# @return [Boolean] True if delete succeeds, false otherwise
Expand Down Expand Up @@ -503,6 +491,7 @@ def update(

context.update(
if_match: if_match,

)
end

Expand Down

0 comments on commit f0d1668

Please sign in to comment.