apiverve_unitconverter 1.2.4 → 1.2.6
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/README.md +15 -3
- data/lib/apiverve_unitconverter/client.rb +2 -2
- data/lib/apiverve_unitconverter.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8d13c6904cffe0cbf35259cffde4c3daa473f3d503193dcfbf4411f2c7508d7
|
|
4
|
+
data.tar.gz: bc901596ef40531ffac2dfba8bef37bf531776560e9f40ab2074e3b631b6f58b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a480c3b863e4b348d5fd0e9322ff7ed2adeeebd5c8d8d9af06881f00170662573074c4ad39461f6b89b077092d27aaefdd07bc184a8a03b52433c34c9bb34aad
|
|
7
|
+
data.tar.gz: fda6c10230a95db4122b5246b4c30f34a10093afc10dd1832adf7c9a11a604a2423c61f8a3386d814bbd55699300e9170e9150c3e37abbc8d870bd4718a9891a
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Unit Converter API - Ruby Gem
|
|
2
2
|
|
|
3
|
-
Unit Converter converts values between
|
|
3
|
+
Unit Converter converts values between 185 units across 23 measures, from length, mass and volume to speed, pressure, data size, energy and electrical units. Pass a numeric value with source and target unit codes to get the converted result and unit abbreviations. On paid plans, precision sets the decimal places and conversions=true adds the value in every unit of the same measure.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -38,7 +38,9 @@ client = APIVerve::Unitconverter::Client.new(api_key: "YOUR_API_KEY")
|
|
|
38
38
|
response = client.execute({
|
|
39
39
|
value: 100,
|
|
40
40
|
from: "lb",
|
|
41
|
-
to: "kg"
|
|
41
|
+
to: "kg",
|
|
42
|
+
precision: 2,
|
|
43
|
+
conversions: true
|
|
42
44
|
})
|
|
43
45
|
|
|
44
46
|
# Print the response
|
|
@@ -50,7 +52,7 @@ puts response
|
|
|
50
52
|
|
|
51
53
|
```ruby
|
|
52
54
|
begin
|
|
53
|
-
response = client.execute({ value: 100, from: "lb", to: "kg" })
|
|
55
|
+
response = client.execute({ value: 100, from: "lb", to: "kg", precision: 2, conversions: true })
|
|
54
56
|
puts response["data"]
|
|
55
57
|
rescue APIVerve::Unitconverter::ValidationError => e
|
|
56
58
|
puts "Validation error: #{e.errors.join(', ')}"
|
|
@@ -97,6 +99,16 @@ client = APIVerve::Unitconverter::Client.new(
|
|
|
97
99
|
"singular": "Kilogram",
|
|
98
100
|
"plural": "Kilograms"
|
|
99
101
|
}
|
|
102
|
+
},
|
|
103
|
+
"conversions": {
|
|
104
|
+
"mcg": 45359200000,
|
|
105
|
+
"mg": 45359200,
|
|
106
|
+
"g": 45359.2,
|
|
107
|
+
"kg": 45.36,
|
|
108
|
+
"mt": 0.05,
|
|
109
|
+
"oz": 1600,
|
|
110
|
+
"lb": 100,
|
|
111
|
+
"t": 0.05
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
}
|
|
@@ -10,7 +10,7 @@ module APIVerve
|
|
|
10
10
|
#
|
|
11
11
|
# @example Basic usage
|
|
12
12
|
# client = APIVerve::Unitconverter::Client.new(api_key: "your_api_key")
|
|
13
|
-
# response = client.execute({ value: 100, from: "lb", to: "kg" })
|
|
13
|
+
# response = client.execute({ value: 100, from: "lb", to: "kg", precision: 2, conversions: true })
|
|
14
14
|
# puts response
|
|
15
15
|
#
|
|
16
16
|
# @see https://apiverve.com/marketplace/unitconverter?utm_source=ruby&utm_medium=referral&utm_content=readme
|
|
@@ -19,7 +19,7 @@ module APIVerve
|
|
|
19
19
|
DEFAULT_TIMEOUT = 30
|
|
20
20
|
|
|
21
21
|
# Validation rules for parameters
|
|
22
|
-
VALIDATION_RULES = { 'value' => { type: 'number', required: true }, 'from' => { type: 'string', required: true }, 'to' => { type: 'string', required: true } }
|
|
22
|
+
VALIDATION_RULES = { 'value' => { type: 'number', required: true }, 'from' => { type: 'string', required: true }, 'to' => { type: 'string', required: true }, 'precision' => { type: 'integer', required: false, min: 0, max: 10 }, 'conversions' => { type: 'boolean', required: false } }
|
|
23
23
|
|
|
24
24
|
# Format validation patterns
|
|
25
25
|
FORMAT_PATTERNS = {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apiverve_unitconverter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- APIVerve
|
|
@@ -57,9 +57,11 @@ dependencies:
|
|
|
57
57
|
- - "~>"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '2.0'
|
|
60
|
-
description: Unit Converter converts values between
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
description: Unit Converter converts values between 185 units across 23 measures,
|
|
61
|
+
from length, mass and volume to speed, pressure, data size, energy and electrical
|
|
62
|
+
units. Pass a numeric value with source and target unit codes to get the converted
|
|
63
|
+
result and unit abbreviations. On paid plans, precision sets the decimal places
|
|
64
|
+
and conversions=true adds the value in every unit of the same measure.
|
|
63
65
|
email:
|
|
64
66
|
- hello@apiverve.com
|
|
65
67
|
executables: []
|