informant-common 1.1.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 305b1c15c677be7f3223912403790371aeaa2983b2e58a325680797967b66cf9
4
- data.tar.gz: e6e8b39b1bb3216621e27a78e6d2b82969e2815ed6b9abee1e6c2b28dbae947e
3
+ metadata.gz: 702054d537adb792b65754f4fb418ec7b07e5b103c2b09148fa147abd2b74fe5
4
+ data.tar.gz: 6e063df535bc3c723c0af1bbfe19a7c3f7598b5344fd304000e698a2de957881
5
5
  SHA512:
6
- metadata.gz: 3cc6d1543811b1ecd81e4cb59d98727caa3b0f6b2a61ef2a81b541d5214d51b2c1aaf6f1052d084dc12495b3e3dd7154d45410e07622971f24464298b28bb19a
7
- data.tar.gz: d0c0afce4cc65bbd2993086f1ea4388999e97d3c1863cc69825088b84dfaec2f0c564d154481dea3ba1a1577a991f07614b6d5b484ac8a313d8c9dd19ed7a7b2
6
+ metadata.gz: 9d9a5ed4cc9496a203eba8edee1b4302f24cc9a3f29599ca9871c834233f2144518f2dbcd9350c1b4a2c0a98d354c706672170c953e8d739efcf7158780d29ea
7
+ data.tar.gz: 03217a93301d05ee70a84192ce4f4bb28b7ac4413ae02b6aaacdd470995a6f105753b0548cf5b32d1c84c32dbda3ce3921330840cf49063f7471f1dbd538a438
data/README.markdown CHANGED
@@ -1,5 +1,3 @@
1
- # Overview
2
-
3
1
  ## Informant Common
4
2
 
5
3
  The informant-common gem provides underlying common functionality for building
data/Rakefile CHANGED
@@ -1,9 +1,12 @@
1
- if !ENV['APPRAISAL_INITIALIZED']
2
- require 'appraisal/task'
3
- Appraisal::Task.new
4
- task default: :appraisal
5
- else
1
+ default_task = :spec
2
+
3
+ if ENV['APPRAISAL_INITIALIZED']
6
4
  require 'rspec/core/rake_task'
7
5
  RSpec::Core::RakeTask.new
8
- task default: :spec
6
+ else
7
+ require 'appraisal/task'
8
+ Appraisal::Task.new
9
+ default_task = :appraisal
9
10
  end
11
+
12
+ task default: default_task
@@ -4,36 +4,34 @@ module InformantCommon
4
4
  @instance ||= InformantCommon::Config.new
5
5
  end
6
6
 
7
- attr_writer :api_token
7
+ attr_writer :api_token, :exclude_models, :filter_parameters, :value_tracking
8
+
8
9
  def api_token
9
- @api_token ||= ENV['INFORMANT_API_KEY']
10
+ @api_token ||= ENV.fetch('INFORMANT_API_KEY', nil)
10
11
  end
11
12
 
12
13
  def enabled?
13
14
  !api_token.nil? && api_token != ''
14
15
  end
15
16
 
16
- attr_writer :exclude_models
17
17
  def exclude_models
18
18
  @exclude_models ||= []
19
19
  end
20
20
 
21
- attr_writer :filter_parameters
22
21
  def filter_parameters
23
22
  @filter_parameters ||= []
24
23
  end
25
24
 
26
- attr_writer :value_tracking
27
25
  def value_tracking?
28
- if !defined?(@value_tracking)
29
- @value_tracking = true
30
- else
26
+ if defined?(@value_tracking)
31
27
  @value_tracking
28
+ else
29
+ @value_tracking = true
32
30
  end
33
31
  end
34
32
 
35
33
  def self.collector_host
36
- @collector_host ||= ENV['INFORMANT_COLLECTOR_HOST'] || 'https://collector-api.informantapp.com'
34
+ @collector_host ||= ENV.fetch('INFORMANT_COLLECTOR_HOST', 'https://collector-api.informantapp.com')
37
35
  end
38
36
 
39
37
  def self.configure
@@ -1,9 +1,10 @@
1
1
  module InformantCommon
2
2
  module Event
3
- class AgentInfo < InformantCommon::Event::Base
3
+ class AgentInfo < Base
4
4
  attr_accessor :agent_identifier, :framework_version
5
5
 
6
6
  def initialize(agent_identifier: nil, framework_version: nil)
7
+ super()
7
8
  self.agent_identifier = agent_identifier
8
9
  self.framework_version = framework_version
9
10
  end
@@ -17,6 +18,10 @@ module InformantCommon
17
18
  }
18
19
  end
19
20
 
21
+ def to_json(*_args)
22
+ as_json.to_json
23
+ end
24
+
20
25
  def self.endpoint
21
26
  @endpoint ||= URI("#{InformantCommon::Config.collector_host}/v2/client-info")
22
27
  end
@@ -24,7 +24,7 @@ module InformantCommon
24
24
  end
25
25
 
26
26
  def self.net_http_start_arguments
27
- @net_http_start_arguments ||= [endpoint.host, endpoint.port, use_ssl: endpoint.scheme == 'https']
27
+ @net_http_start_arguments ||= [endpoint.host, endpoint.port, { use_ssl: endpoint.scheme == 'https' }]
28
28
  end
29
29
 
30
30
  def net_http_start_arguments
@@ -2,11 +2,14 @@ module InformantCommon
2
2
  module Model
3
3
  class ActiveModel < Base
4
4
  def initialize(active_model)
5
- self.id = active_model.object_id
6
- self.name = active_model.class.name
7
- self.errors = []
8
- active_model.errors.each do |field, error|
9
- add_error(field.to_s, extract_value(active_model, field), error)
5
+ super(
6
+ id: active_model.object_id,
7
+ name: active_model.class.name,
8
+ field_errors: []
9
+ )
10
+
11
+ active_model.errors.messages.each do |field, errors|
12
+ add_error(field.to_s, extract_value(active_model, field), errors.first)
10
13
  end
11
14
  end
12
15
 
@@ -1,3 +1,3 @@
1
1
  module InformantCommon
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: informant-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Informant, LLC
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -50,8 +50,9 @@ files:
50
50
  homepage: https://www.informantapp.com
51
51
  licenses:
52
52
  - MIT
53
- metadata: {}
54
- post_install_message:
53
+ metadata:
54
+ rubygems_mfa_required: 'true'
55
+ post_install_message:
55
56
  rdoc_options: []
56
57
  require_paths:
57
58
  - lib
@@ -59,15 +60,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
60
  requirements:
60
61
  - - ">="
61
62
  - !ruby/object:Gem::Version
62
- version: '0'
63
+ version: 2.7.0
63
64
  required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  requirements:
65
66
  - - ">="
66
67
  - !ruby/object:Gem::Version
67
68
  version: '0'
68
69
  requirements: []
69
- rubygems_version: 3.1.2
70
- signing_key:
70
+ rubygems_version: 3.2.32
71
+ signing_key:
71
72
  specification_version: 4
72
73
  summary: The Informant tracks server-side validation errors and gives you metrics
73
74
  you never dreamed of.