rosette_api 1.37.0 → 1.39.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 +4 -4
- data/lib/record_similarity_parameters.rb +28 -4
- data/lib/rosette_api.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b42de9a42f1c759a302a9a3b0f294043af5497ca008beae9fe65c4237c0296f7
|
|
4
|
+
data.tar.gz: 1bdd902d3e79abc9e3ccaac62db43b545ac5c97e254b0e8b54811355adb1ecd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb81f982495d805b8cb049966bac828cb6afe29a0c5636b046db51c3966fc2faa23bdcdc2a899b9ca0e68454b561d25be0214c6fab47f1b7c306fd0dd2cb51e8
|
|
7
|
+
data.tar.gz: bd02c52aed880614d08eb347de9a952d028d450c1b870fe05a18b10a5d8ba50d1aa276640183f9e9dd5a97e710dbab8b4d3fba0052146b88f352d21c96718b67
|
|
@@ -14,14 +14,35 @@ class RecordSimilarityParameters
|
|
|
14
14
|
# Optional properties map sent to the API (optional, should be a hash)
|
|
15
15
|
attr_accessor :properties
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
# Comparison method (one_to_one, one_to_n, n_to_m) (optional)
|
|
18
|
+
attr_accessor :comparison_method
|
|
19
|
+
|
|
20
|
+
VALID_COMPARISON_METHODS = %w[one_to_one one_to_n n_to_m].freeze
|
|
21
|
+
|
|
22
|
+
def initialize(fields, records, properties = nil, comparison_method: nil, **property_keywords) # :notnew:
|
|
23
|
+
properties_msg = 'properties must be passed either positionally or as keywords, not both'
|
|
24
|
+
raise ArgumentError.new(properties_msg) unless properties.nil? || property_keywords.empty?
|
|
25
|
+
|
|
18
26
|
@fields = fields
|
|
19
27
|
@records = records
|
|
20
|
-
|
|
28
|
+
# Preserve legacy calls such as new(fields, records, threshold: 0.7).
|
|
29
|
+
@properties = property_keywords.empty? ? properties : property_keywords
|
|
30
|
+
@comparison_method = comparison_method
|
|
31
|
+
|
|
32
|
+
validate_comparison_method
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def validate_comparison_method
|
|
36
|
+
return if @comparison_method.nil?
|
|
37
|
+
|
|
38
|
+
normalized = @comparison_method.to_s.downcase
|
|
39
|
+
return if VALID_COMPARISON_METHODS.include?(normalized)
|
|
40
|
+
|
|
41
|
+
raise ArgumentError.new("comparison_method must be one of: #{VALID_COMPARISON_METHODS.join(', ')}")
|
|
21
42
|
end
|
|
22
43
|
|
|
23
44
|
# Validates the parameters by checking if required fields are present and
|
|
24
|
-
# optional properties is a Hash if provided.
|
|
45
|
+
# optional properties is a Hash and comparison method is valid if provided.
|
|
25
46
|
def validate_params
|
|
26
47
|
f_msg = 'fields option is required'
|
|
27
48
|
raise BadRequestError.new(f_msg) if @fields.nil?
|
|
@@ -43,6 +64,8 @@ class RecordSimilarityParameters
|
|
|
43
64
|
|
|
44
65
|
p_msg = 'properties can only be an instance of a Hash'
|
|
45
66
|
raise BadRequestError.new(p_msg) if @properties && !(@properties.is_a? Hash)
|
|
67
|
+
|
|
68
|
+
validate_comparison_method
|
|
46
69
|
end
|
|
47
70
|
|
|
48
71
|
# Converts this class to Hash with its keys in lower CamelCase.
|
|
@@ -62,7 +85,8 @@ class RecordSimilarityParameters
|
|
|
62
85
|
{
|
|
63
86
|
fields: @fields,
|
|
64
87
|
records: @records,
|
|
65
|
-
properties: @properties
|
|
88
|
+
properties: @properties,
|
|
89
|
+
comparison_method: @comparison_method&.to_s&.downcase
|
|
66
90
|
}
|
|
67
91
|
end
|
|
68
92
|
end
|
data/lib/rosette_api.rb
CHANGED
|
@@ -15,7 +15,7 @@ require 'logger'
|
|
|
15
15
|
# This class allows you to access all Analytics API endpoints.
|
|
16
16
|
class RosetteAPI
|
|
17
17
|
# Version of Ruby binding
|
|
18
|
-
BINDING_VERSION = '1.
|
|
18
|
+
BINDING_VERSION = '1.39.0'
|
|
19
19
|
# API address-similarity endpoint
|
|
20
20
|
ADDRESS_SIMILARITY_ENDPOINT = '/address-similarity'
|
|
21
21
|
# API categories endpoint
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rosette_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.39.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Analytics by Babel Street
|
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
90
|
version: '0'
|
|
91
91
|
requirements: []
|
|
92
|
-
rubygems_version: 4.0.
|
|
92
|
+
rubygems_version: 4.0.20
|
|
93
93
|
specification_version: 4
|
|
94
94
|
summary: A Ruby interface for Babel Street Analytics Server and Hosted Services
|
|
95
95
|
test_files: []
|