Class: Svix::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_token, options = SvixOptions.new) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/svix/svix.rb', line 23

def initialize(auth_token, options = SvixOptions.new)

    region = auth_token.split(".").last
    if region == "us"
        regional_url = "https://api.us.svix.com"
    elsif region == "eu"
        regional_url = "https://api.eu.svix.com"
    elsif region == "in"
        regional_url = "https://api.in.svix.com"
    else
        regional_url = "https://api.svix.com"
    end

    uri = URI(options.server_url || regional_url)

    configuration = Configuration.new
    configuration.debugging = options.debug
    configuration.scheme = uri.scheme
    configuration.host = uri.port ? "#{uri.host}:#{uri.port}" : uri.host
    configuration.access_token = auth_token
    configuration.server_index = nil

    api_client = ApiClient.new(configuration)
    api_client.user_agent = "svix-libs/#{VERSION}/ruby"

    @application = ApplicationAPI.new(api_client)
    @authentication = AuthenticationAPI.new(api_client)
    @endpoint = EndpointAPI.new(api_client)
    @event_type = EventTypeAPI.new(api_client)
    @integration = IntegrationAPI.new(api_client)
    @message = MessageAPI.new(api_client)
    @message_attempt = MessageAttemptAPI.new(api_client)
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



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

def application
  @application
end

#authenticationObject

Returns the value of attribute authentication.



16
17
18
# File 'lib/svix/svix.rb', line 16

def authentication
  @authentication
end

#endpointObject

Returns the value of attribute endpoint.



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

def endpoint
  @endpoint
end

#event_typeObject

Returns the value of attribute event_type.



18
19
20
# File 'lib/svix/svix.rb', line 18

def event_type
  @event_type
end

#integrationObject

Returns the value of attribute integration.



19
20
21
# File 'lib/svix/svix.rb', line 19

def integration
  @integration
end

#messageObject

Returns the value of attribute message.



20
21
22
# File 'lib/svix/svix.rb', line 20

def message
  @message
end

#message_attemptObject

Returns the value of attribute message_attempt.



21
22
23
# File 'lib/svix/svix.rb', line 21

def message_attempt
  @message_attempt
end