Class: Twilio::REST::Iam::V1::NewApiKeyList

Inherits:
ListResource show all
Defined in:
lib/twilio-ruby/rest/iam/v1/new_api_key.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ NewApiKeyList

Initialize the NewApiKeyList

Parameters:

  • version (Version)

    Version that contains the resource



26
27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/iam/v1/new_api_key.rb', line 26

def initialize(version)
    super(version)
    
    # Path Solution
    @solution = {  }
    @uri = "/Keys"
    
end

Instance Method Details

#create(account_sid: nil, friendly_name: :unset, key_type: :unset, policy: :unset) ⇒ NewApiKeyInstance

Create the NewApiKeyInstance

Parameters:

  • account_sid (String) (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Payments resource.

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

  • key_type (Keytype) (defaults to: :unset)
  • policy (Object) (defaults to: :unset)

    The \`Policy\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/twilio-ruby/rest/iam/v1/new_api_key.rb', line 41

def create(
    account_sid: nil, 
    friendly_name: :unset, 
    key_type: :unset, 
    policy: :unset
)

    data = Twilio::Values.of({
        'AccountSid' => ,
        'FriendlyName' => friendly_name,
        'KeyType' => key_type,
        'Policy' => Twilio.serialize_object(policy),
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    NewApiKeyInstance.new(
        @version,
        payload,
    )
end

#create_with_metadata(account_sid: nil, friendly_name: :unset, key_type: :unset, policy: :unset) ⇒ NewApiKeyInstance

Create the NewApiKeyInstanceMetadata

Parameters:

  • account_sid (String) (defaults to: nil)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Payments resource.

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

  • key_type (Keytype) (defaults to: :unset)
  • policy (Object) (defaults to: :unset)

    The \`Policy\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/twilio-ruby/rest/iam/v1/new_api_key.rb', line 75

def (
  account_sid: nil, 
  friendly_name: :unset, 
  key_type: :unset, 
  policy: :unset
)

    data = Twilio::Values.of({
        'AccountSid' => ,
        'FriendlyName' => friendly_name,
        'KeyType' => key_type,
        'Policy' => Twilio.serialize_object(policy),
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    new_api_key_instance = NewApiKeyInstance.new(
        @version,
        response.body,
    )
    .new(
        @version,
        new_api_key_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



112
113
114
# File 'lib/twilio-ruby/rest/iam/v1/new_api_key.rb', line 112

def to_s
    '#<Twilio.Iam.V1.NewApiKeyList>'
end