## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Events # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Events < EventsBase class V1 < Version class SchemaList < ListResource ## # Initialize the SchemaList # @param [Version] version Version that contains the resource # @return [SchemaList] SchemaList def initialize(version) super(version) # Path Solution @solution = { } end # Provide a user friendly representation def to_s '#' end end class SchemaContext < InstanceContext ## # Initialize the SchemaContext # @param [Version] version Version that contains the resource # @param [String] id The unique identifier of the schema. Each schema can have multiple versions, that share the same id. # @return [SchemaContext] SchemaContext def initialize(version, id) super(version) # Path Solution @solution = { id: id, } @uri = "/Schemas/#{@solution[:id]}" # Dependents @versions = nil end ## # Fetch the SchemaInstance # @return [SchemaInstance] Fetched SchemaInstance def fetch payload = @version.fetch('GET', @uri) SchemaInstance.new( @version, payload, id: @solution[:id], ) end ## # Access the versions # @return [SchemaVersionList] # @return [SchemaVersionContext] if sid was passed. def versions(schema_version=:unset) raise ArgumentError, 'schema_version cannot be nil' if schema_version.nil? if schema_version != :unset return SchemaVersionContext.new(@version, @solution[:id],schema_version ) end unless @versions @versions = SchemaVersionList.new( @version, id: @solution[:id], ) end @versions end ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class SchemaPage < Page ## # Initialize the SchemaPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [SchemaPage] SchemaPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of SchemaInstance # @param [Hash] payload Payload response from the API # @return [SchemaInstance] SchemaInstance def get_instance(payload) SchemaInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class SchemaInstance < InstanceResource ## # Initialize the SchemaInstance # @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 Schema # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [SchemaInstance] SchemaInstance def initialize(version, payload , id: nil) super(version) # Marshaled Properties @properties = { 'id' => payload['id'], 'url' => payload['url'], 'links' => payload['links'], 'latest_version_date_created' => Twilio.deserialize_iso8601_datetime(payload['latest_version_date_created']), 'latest_version' => payload['latest_version'] == nil ? payload['latest_version'] : payload['latest_version'].to_i, } # Context @instance_context = nil @params = { 'id' => id || @properties['id'] , } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [SchemaContext] CallContext for this CallInstance def context unless @instance_context @instance_context = SchemaContext.new(@version , @params['id']) end @instance_context end ## # @return [String] The unique identifier of the schema. Each schema can have multiple versions, that share the same id. def id @properties['id'] end ## # @return [String] The URL of this resource. def url @properties['url'] end ## # @return [Hash] Contains a dictionary of URL links to nested resources of this schema. def links @properties['links'] end ## # @return [Time] The date that the latest schema version was created, given in ISO 8601 format. def latest_version_date_created @properties['latest_version_date_created'] end ## # @return [String] The latest version published of this schema. def latest_version @properties['latest_version'] end ## # Fetch the SchemaInstance # @return [SchemaInstance] Fetched SchemaInstance def fetch context.fetch end ## # Access the versions # @return [versions] versions def versions context.versions end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end