Skip to content

Commit

Permalink
chore: add preview-iam examples to ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Dec 12, 2024
1 parent 8c1b3c4 commit 1df483d
Show file tree
Hide file tree
Showing 10 changed files with 426 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/ruby/lib/twilio-ruby/rest/api/v2010/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def create(
data = Twilio::Values.of({
'RecordingStatusCallback' => recording_status_callback,
'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e|
e
},
e
},
'Twiml' => twiml,
})

Expand Down
4 changes: 2 additions & 2 deletions examples/ruby/lib/twilio-ruby/rest/api/v2010/account/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def create(
'RequiredStringProperty' => required_string_property,
'TestMethod' => test_method,
'TestArrayOfStrings' => Twilio.serialize_list(test_array_of_strings) { |e|
e
},
e
},
'TestArrayOfUri' => Twilio.serialize_list(test_array_of_uri) { |e| e },
})

Expand Down
4 changes: 4 additions & 0 deletions examples/ruby/lib/twilio-ruby/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def versionless
@versionless ||= Versionless.new self
end

def preview_iam
@previewiam ||= PreviewIam.new self
end

##
# @param [integer] testInteger INTEGER ID param!!!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ def create(
'TestDate' => Twilio.serialize_iso8601_date(test_date),
'TestEnum' => test_enum,
'TestObjectArray' => Twilio.serialize_list(test_object_array) { |e|
Twilio.serialize_object(e)
},
Twilio.serialize_object(e)
},
'TestAnyType' => Twilio.serialize_object(test_any_type),
'TestAnyArray' => Twilio.serialize_list(test_any_array) { |e|
Twilio.serialize_object(e)
},
Twilio.serialize_object(e)
},
'Permissions' => Twilio.serialize_list(permissions) { |e| e },
'SomeA2PThing' => some_a2p_thing,
})
Expand Down
9 changes: 9 additions & 0 deletions examples/ruby/lib/twilio-ruby/rest/preview_iam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Twilio
module REST
class PreviewIam < PreviewIamBase
def organizations(organization_sid = nil)
@organizations ||= PreviewIam::Versionless.new(self).organization(organization_sid)
end
end
end
end
48 changes: 48 additions & 0 deletions examples/ruby/lib/twilio-ruby/rest/preview_iam/v1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
##
# This code was generated by
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
#
# Organization Public API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#
# NOTE: This class is auto generated by OpenAPI Generator.
# https://openapi-generator.tech
# Do not edit the class manually.
#

module Twilio
module REST
class PreviewIam
class V1 < Version
##
# Initialize the V1 version of PreviewIam
def initialize(domain)
super
@version = 'v1'
@authorize = nil
@token = nil
end

##
# @return [Twilio::REST::PreviewIam::V1::AuthorizeList]
def authorize
@authorize ||= AuthorizeList.new self
end

##
# @return [Twilio::REST::PreviewIam::V1::TokenList]
def token
@token ||= TokenList.new self
end

##
# Provide a user friendly representation
def to_s
'<Twilio::REST::PreviewIam::V1>';
end
end
end
end
end
138 changes: 138 additions & 0 deletions examples/ruby/lib/twilio-ruby/rest/preview_iam/v1/authorize.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
##
# This code was generated by
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
#
# Organization Public API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#
# NOTE: This class is auto generated by OpenAPI Generator.
# https://openapi-generator.tech
# Do not edit the class manually.
#

module Twilio
module REST
class PreviewIam < PreviewIamBase
class V1 < Version
class AuthorizeList < ListResource
##
# Initialize the AuthorizeList
# @param [Version] version Version that contains the resource
# @return [AuthorizeList] AuthorizeList
def initialize(version)
super(version)
# Path Solution
@solution = {}
@uri = "/authorize"
end

##
# Fetch the AuthorizeInstance
# @param [String] response_type Response Type
# @param [String] client_id The Client Identifier
# @param [String] redirect_uri The url to which response will be redirected to
# @param [String] scope The scope of the access request
# @param [String] state An opaque value which can be used to maintain state between the request and callback
# @return [AuthorizeInstance] Fetched AuthorizeInstance
def fetch(
response_type: :unset,
client_id: :unset,
redirect_uri: :unset,
scope: :unset,
state: :unset
)

params = Twilio::Values.of({
'response_type' => response_type,
'client_id' => client_id,
'redirect_uri' => redirect_uri,
'scope' => scope,
'state' => state,
})
headers = Twilio::Values.of({ 'Content-Type' => 'application/x-www-form-urlencoded', })

payload = @version.fetch('GET', @uri, params: params, headers: headers)
AuthorizeInstance.new(
@version,
payload,
)
end

# Provide a user friendly representation
def to_s
'#<Twilio.PreviewIam.V1.AuthorizeList>'
end
end

class AuthorizePage < Page
##
# Initialize the AuthorizePage
# @param [Version] version Version that contains the resource
# @param [Response] response Response from the API
# @param [Hash] solution Path solution for the resource
# @return [AuthorizePage] AuthorizePage
def initialize(version, response, solution)
super(version, response)

# Path Solution
@solution = solution
end

##
# Build an instance of AuthorizeInstance
# @param [Hash] payload Payload response from the API
# @return [AuthorizeInstance] AuthorizeInstance
def get_instance(payload)
AuthorizeInstance.new(@version, payload)
end

##
# Provide a user friendly representation
def to_s
'<Twilio.PreviewIam.V1.AuthorizePage>'
end
end

class AuthorizeInstance < InstanceResource
##
# Initialize the AuthorizeInstance
# @param [Version] version Version that contains the resource
# @param [Hash] payload payload that contains response from Twilio
# @param [String] account_sid The SID of the
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Authorize
# resource.
# @param [String] sid The SID of the Call resource to fetch.
# @return [AuthorizeInstance] AuthorizeInstance
def initialize(version, payload)
super(version)

# Marshaled Properties
@properties = {
'redirect_to' => payload['redirect_to'],
}
end

##
# @return [String] The callback URL
def redirect_to
@properties['redirect_to']
end

##
# Provide a user friendly representation
def to_s
"<Twilio.PreviewIam.V1.AuthorizeInstance>"
end

##
# Provide a detailed, user friendly representation
def inspect
"<Twilio.PreviewIam.V1.AuthorizeInstance>"
end
end
end
end
end
end
Loading

0 comments on commit 1df483d

Please sign in to comment.