customerx_tracking 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 654a0c49afb5830bdda34476e08c92694788f22f39d9cb7f0bb1754dc6a66e48
4
+ data.tar.gz: c6a7534ef6f7bcf5fd69fbc58f7234eb768ef3ad9e2b7117be30c32a9c418d91
5
+ SHA512:
6
+ metadata.gz: 0adde120a49a1bbbc386472ad14fbcffce8b6e139f6aaf1fed97ff098a0617511da07303dbe61189c25af4710309711050d9acdaab35d9b6baabbbd8c9c0ef93
7
+ data.tar.gz: 5c0884b35112fc91854f9c5981bb51f66727e13520071579419ddc73effd1a97dc5ab99af84886cde22423519edb95fcb3910858cd8ce72fec3952dceabfeded
@@ -0,0 +1,32 @@
1
+ require "faraday"
2
+
3
+ require "customerx_tracking/configuration"
4
+
5
+ module CustomerxTracking
6
+ class Client
7
+ # @return [Configuration] Config instance
8
+ attr_reader :config
9
+
10
+ # Creates a new {Client} instance and yields {#config}.
11
+ def initialize
12
+ raise ArgumentError, "block not given" unless block_given?
13
+
14
+ @config = CustomerxTracking::Configuration.new
15
+ yield config
16
+ end
17
+
18
+ # Send tracking of API Tracking CustomerX
19
+ def tracker(external_id_client:, type_tracking:, identifier:, email:, options: {})
20
+ Faraday.new.post do |req|
21
+ req.url "https://tracking.customerx.com.br/api/v1/trackings"
22
+ req.headers = @config.options[:headers]
23
+ req.body = {
24
+ external_id_client: external_id_client,
25
+ type_tracking: type_tracking,
26
+ identifier: identifier,
27
+ email: email
28
+ }.merge(options)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ module CustomerxTracking
2
+ # Holds the configuration options for the client and connection
3
+ class Configuration
4
+ # @return [String] The basic auth credential.
5
+ attr_accessor :credential
6
+
7
+ # @return [String] The basic auth key.
8
+ attr_accessor :key
9
+
10
+ # Sets accept and user_agent headers
11
+ #
12
+ # @return [Hash] Faraday-formatted hash of options.
13
+ def options
14
+ {
15
+ headers: {
16
+ accept: "application/json",
17
+ credential: @credential,
18
+ key: @key
19
+ }
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CustomerxTracking
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Module main of CustomerX Tracking
4
+
5
+ module CustomerxTracking; end
6
+
7
+ require "customerx_tracking/client"
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: customerx_tracking
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Grassi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.0
33
+ description: Ruby wrapper for the REST API at https://www.customerx.cx. Documentation
34
+ at https://www.customerx.cx/developers.
35
+ email:
36
+ - ricardo.grassi@customerx.cx
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - lib/customerx_tracking.rb
42
+ - lib/customerx_tracking/client.rb
43
+ - lib/customerx_tracking/configuration.rb
44
+ - lib/customerx_tracking/version.rb
45
+ homepage: https://www.customerx.cx/developers/
46
+ licenses:
47
+ - MIT
48
+ metadata:
49
+ bug_tracker_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/issues
50
+ changelog_uri: https://github.com/CustomerX-CX/customerx_tracking_client_rb/CHANGELOG.md
51
+ documentation_uri: https://rubygems.org/gems/customerx_tracking/versions/1.0.0
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.3'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.3.6
66
+ requirements: []
67
+ rubygems_version: 3.2.22
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: CustomerX Tracking REST API Client
71
+ test_files: []