informant-common 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a0530b6e7f368bf9813089d13ae91e6efea52bb86e0aab43b28642988a8ec21
4
- data.tar.gz: 8e485234656bb89473bdbf7d4ae3d5a25652dc2d86440c96f4f801ce4bc8e5ef
3
+ metadata.gz: ed34407cec544b01391b2ac8902ed3a2667ee575976388dc3a2a97afcb0264d3
4
+ data.tar.gz: 0feab82bf1ce36d13a633dad8841b084f889447a36c7145ff8c56366200eac7b
5
5
  SHA512:
6
- metadata.gz: b9c4e2eea975a321d588311fb80fa663e409d787fd5c44bef40ba5e8bceff28ae0c9e0219754410979a08122323d4544b1fb2b3c05a870809c25fb94ab18f38c
7
- data.tar.gz: 349acd7e71ae351263323dcb7da547ccf8614d338df22466a3d583f98c831eefead70815ac5b226446b02d1cd66190c822aa16ef13e07820908d2fa428e94064
6
+ metadata.gz: 6cce15623638121d186749153fe78f1b95e043099e1a41350bf9a92eaecf086e1519ba74729fcb135ff5f37a92e23053a94a718c91fd7f31e36067169a4ef001
7
+ data.tar.gz: 5dc1b56de742f50e76b994c2260e7858ef191f1e031d6ea6a1d76c7b35a8bee32239932dec92a1c578419f443be00439941469aa053423bbb8622351fd72617d
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,34 +4,29 @@ module InformantCommon
4
4
  @instance ||= InformantCommon::Config.new
5
5
  end
6
6
 
7
- attr_accessor :api_token
7
+ attr_writer :api_token, :exclude_models, :filter_parameters, :value_tracking
8
8
 
9
- attr_writer :client_identifier
10
- def client_identifier
11
- @client_identifier ||= "informant-common-#{InformantCommon::VERSION}"
9
+ def api_token
10
+ @api_token ||= ENV['INFORMANT_API_KEY']
12
11
  end
13
- alias agent_identifier client_identifier
14
12
 
15
13
  def enabled?
16
14
  !api_token.nil? && api_token != ''
17
15
  end
18
16
 
19
- attr_writer :exclude_models
20
17
  def exclude_models
21
18
  @exclude_models ||= []
22
19
  end
23
20
 
24
- attr_writer :filter_parameters
25
21
  def filter_parameters
26
22
  @filter_parameters ||= []
27
23
  end
28
24
 
29
- attr_writer :value_tracking
30
25
  def value_tracking?
31
- if !defined?(@value_tracking)
32
- @value_tracking = true
33
- else
26
+ if defined?(@value_tracking)
34
27
  @value_tracking
28
+ else
29
+ @value_tracking = true
35
30
  end
36
31
  end
37
32
 
@@ -3,20 +3,24 @@ module InformantCommon
3
3
  class AgentInfo < InformantCommon::Event::Base
4
4
  attr_accessor :agent_identifier, :framework_version
5
5
 
6
- def initialize(agent_identifier: InformantCommon::Config.client_identifier, framework_version: nil)
6
+ def initialize(agent_identifier: nil, framework_version: nil)
7
7
  self.agent_identifier = agent_identifier
8
8
  self.framework_version = framework_version
9
9
  end
10
10
 
11
11
  def as_json(*_args)
12
12
  {
13
- agent_identifier: agent_identifier || InformantCommon::Config.client_identifier,
13
+ agent_identifier: agent_identifier,
14
14
  framework_version: framework_version,
15
15
  runtime_version: "ruby-#{RUBY_VERSION}",
16
16
  mongoid_version: defined?(Mongoid) ? Mongoid::VERSION : nil
17
17
  }
18
18
  end
19
19
 
20
+ def to_json(*_args)
21
+ as_json.to_json
22
+ end
23
+
20
24
  def self.endpoint
21
25
  @endpoint ||= URI("#{InformantCommon::Config.collector_host}/v2/client-info")
22
26
  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
@@ -5,8 +5,8 @@ module InformantCommon
5
5
  self.id = active_model.object_id
6
6
  self.name = active_model.class.name
7
7
  self.errors = []
8
- active_model.errors.each do |field, error|
9
- add_error(field.to_s, extract_value(active_model, field), error)
8
+ active_model.errors.messages.each do |field, errors|
9
+ add_error(field.to_s, extract_value(active_model, field), errors.first)
10
10
  end
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module InformantCommon
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
@@ -11,6 +11,7 @@ module InformantCommon
11
11
  autoload :FieldError, 'informant-common/field_error'
12
12
  autoload :ParameterFilter, 'informant-common/parameter_filter'
13
13
  autoload :ValidationTracking, 'informant-common/validation_tracking'
14
+ autoload :VERSION, 'informant-common/version'
14
15
 
15
16
  module Model
16
17
  autoload :ActiveModel, 'informant-common/model/active_model'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: informant-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.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-28 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: This gem contains the common components for reporting data to the Informant.
14
28
  email:
15
29
  - support@informantapp.com
@@ -36,8 +50,9 @@ files:
36
50
  homepage: https://www.informantapp.com
37
51
  licenses:
38
52
  - MIT
39
- metadata: {}
40
- post_install_message:
53
+ metadata:
54
+ rubygems_mfa_required: 'true'
55
+ post_install_message:
41
56
  rdoc_options: []
42
57
  require_paths:
43
58
  - lib
@@ -45,15 +60,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
60
  requirements:
46
61
  - - ">="
47
62
  - !ruby/object:Gem::Version
48
- version: '0'
63
+ version: 2.6.0
49
64
  required_rubygems_version: !ruby/object:Gem::Requirement
50
65
  requirements:
51
66
  - - ">="
52
67
  - !ruby/object:Gem::Version
53
68
  version: '0'
54
69
  requirements: []
55
- rubygems_version: 3.1.2
56
- signing_key:
70
+ rubygems_version: 3.2.32
71
+ signing_key:
57
72
  specification_version: 4
58
73
  summary: The Informant tracks server-side validation errors and gives you metrics
59
74
  you never dreamed of.