Module: DistritoTracking
- Defined in:
- lib/distrito_tracking.rb,
lib/distrito_tracking/error.rb,
lib/distrito_tracking/client.rb,
lib/distrito_tracking/schema.rb,
lib/distrito_tracking/version.rb,
lib/distrito_tracking/configuration.rb
Defined Under Namespace
Classes: Client, Configuration, Error, Schema
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
29
30
31
|
# File 'lib/distrito_tracking.rb', line 29
def self.client
@client ||= Client.new
end
|
.configuration ⇒ Object
25
26
27
|
# File 'lib/distrito_tracking.rb', line 25
def self.configuration
@configuration ||= Configuration.new
end
|
11
12
13
|
# File 'lib/distrito_tracking.rb', line 11
def self.configure
yield(configuration)
end
|
.publish(data:) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/distrito_tracking.rb', line 15
def self.publish(data:)
false unless configuration.validate!
if schema.validate(data: data)
client.publish(data)
else
{ errors: schema.errors }
end
end
|
.schema ⇒ Object
33
34
35
|
# File 'lib/distrito_tracking.rb', line 33
def self.schema
@schema ||= Schema.new
end
|