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



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)



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)



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)



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

def name
  @name
end

#pathString (readonly)



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)



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)



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



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.


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



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