Class: Svix::EventTypeImportOpenApiIn

Inherits:
Object
  • Object
show all
Defined in:
lib/svix/models/event_type_import_open_api_in.rb

Overview

Import a list of event types from webhooks defined in an OpenAPI spec.

The OpenAPI spec can be specified as either ‘spec` given the spec as a JSON object, or as `specRaw` (a `string`) which will be parsed as YAML or JSON by the server. Sending neither or both is invalid, resulting in a `400` **Bad Request**.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EventTypeImportOpenApiIn

Returns a new instance of EventTypeImportOpenApiIn.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 22

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail(
      ArgumentError,
      "The input argument (attributes) must be a hash in `Svix::EventTypeImportOpenApiIn` new method"
    )
  end

  attributes.each do |k, v|
    unless ALL_FIELD.include?(k.to_s)
      fail(ArgumentError, "The field #{k} is not part of Svix::EventTypeImportOpenApiIn")
    end

    instance_variable_set("@#{k}", v)
    instance_variable_set("@__#{k}_is_defined", true)
  end
end

Instance Attribute Details

#dry_runObject

If ‘true`, return the event types that would be modified without actually modifying them.



11
12
13
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 11

def dry_run
  @dry_run
end

#replace_allObject

If ‘true`, all existing event types that are not in the spec will be archived.



13
14
15
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 13

def replace_all
  @replace_all
end

#specObject

A pre-parsed JSON spec.



15
16
17
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 15

def spec
  @spec
end

#spec_rawObject

A string, parsed by the server as YAML or JSON.



17
18
19
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 17

def spec_raw
  @spec_raw
end

Class Method Details

.deserialize(attributes = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 40

def self.deserialize(attributes = {})
  attributes = attributes.transform_keys(&:to_s)
  attrs = Hash.new
  attrs["dry_run"] = attributes["dryRun"]
  attrs["replace_all"] = attributes["replaceAll"]
  attrs["spec"] = attributes["spec"]
  attrs["spec_raw"] = attributes["specRaw"]
  new(attrs)
end

Instance Method Details

#serializeObject



50
51
52
53
54
55
56
57
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 50

def serialize
  out = Hash.new
  out["dryRun"] = Svix::serialize_primitive(@dry_run) if @dry_run
  out["replaceAll"] = Svix::serialize_primitive(@replace_all) if @replace_all
  out["spec"] = Svix::serialize_primitive(@spec) if @spec
  out["specRaw"] = Svix::serialize_primitive(@spec_raw) if @spec_raw
  out
end

#to_jsonObject

Serializes the object to a json string

Returns:

  • String



61
62
63
# File 'lib/svix/models/event_type_import_open_api_in.rb', line 61

def to_json
  JSON.dump(serialize)
end