Class: Vapi::CloudflareR2BucketPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, access_key_id: OMIT, secret_access_key: OMIT, url: OMIT, path: OMIT, additional_properties: nil) ⇒ Vapi::CloudflareR2BucketPlan

Parameters:

  • access_key_id (String) (defaults to: OMIT)

    Cloudflare R2 Access key ID.

  • secret_access_key (String) (defaults to: OMIT)

    Cloudflare R2 access key secret. This is not returned in the API.

  • url (String) (defaults to: OMIT)

    Cloudflare R2 base url.

  • name (String)

    This is the name of the bucket.

  • path (String) (defaults to: OMIT)

    This is the path where call artifacts will be stored. Usage:

    • To store call artifacts in a specific folder, set this to the full path. Eg.

    “/folder-name1/folder-name2”.

    • To store call artifacts in the root of the bucket, leave this blank.

    @default “/”

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 43

def initialize(name:, access_key_id: OMIT, secret_access_key: OMIT, url: OMIT, path: OMIT,
               additional_properties: nil)
  @access_key_id = access_key_id if access_key_id != OMIT
  @secret_access_key = secret_access_key if secret_access_key != OMIT
  @url = url if url != OMIT
  @name = name
  @path = path if path != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "accessKeyId": access_key_id,
    "secretAccessKey": secret_access_key,
    "url": url,
    "name": name,
    "path": path
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#access_key_idString (readonly)

Returns Cloudflare R2 Access key ID.

Returns:

  • (String)

    Cloudflare R2 Access key ID.



9
10
11
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 9

def access_key_id
  @access_key_id
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



24
25
26
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 24

def additional_properties
  @additional_properties
end

#nameString (readonly)

Returns This is the name of the bucket.

Returns:

  • (String)

    This is the name of the bucket.



15
16
17
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 15

def name
  @name
end

#pathString (readonly)

Returns This is the path where call artifacts will be stored. Usage:

  • To store call artifacts in a specific folder, set this to the full path. Eg.

“/folder-name1/folder-name2”.

  • To store call artifacts in the root of the bucket, leave this blank.

@default “/”.

Returns:

  • (String)

    This is the path where call artifacts will be stored. Usage:

    • To store call artifacts in a specific folder, set this to the full path. Eg.

    “/folder-name1/folder-name2”.

    • To store call artifacts in the root of the bucket, leave this blank.

    @default “/”



22
23
24
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 22

def path
  @path
end

#secret_access_keyString (readonly)

Returns Cloudflare R2 access key secret. This is not returned in the API.

Returns:

  • (String)

    Cloudflare R2 access key secret. This is not returned in the API.



11
12
13
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 11

def secret_access_key
  @secret_access_key
end

#urlString (readonly)

Returns Cloudflare R2 base url.

Returns:

  • (String)

    Cloudflare R2 base url.



13
14
15
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 13

def url
  @url
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CloudflareR2BucketPlan

Deserialize a JSON object to an instance of CloudflareR2BucketPlan

Parameters:

  • json_object (String)

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 66

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  access_key_id = parsed_json["accessKeyId"]
  secret_access_key = parsed_json["secretAccessKey"]
  url = parsed_json["url"]
  name = parsed_json["name"]
  path = parsed_json["path"]
  new(
    access_key_id: access_key_id,
    secret_access_key: secret_access_key,
    url: url,
    name: name,
    path: path,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


97
98
99
100
101
102
103
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 97

def self.validate_raw(obj:)
  obj.access_key_id&.is_a?(String) != false || raise("Passed value for field obj.access_key_id is not the expected type, validation failed.")
  obj.secret_access_key&.is_a?(String) != false || raise("Passed value for field obj.secret_access_key is not the expected type, validation failed.")
  obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.path&.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CloudflareR2BucketPlan to a JSON object

Returns:

  • (String)


87
88
89
# File 'lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb', line 87

def to_json(*_args)
  @_field_set&.to_json
end