files.com 1.1.544 → 1.1.545

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: 99416e483b1f01d27a445dc13ae0ebf97e724b518802bb722c5f03a03185310c
4
- data.tar.gz: 1a535f817fb3742c8f09ae461aeeeb679489ecf85939b91ec4284be314324223
3
+ metadata.gz: 4c44315686089e50b9256305ca06e991475cecdc9319e67e576a711d3689b0ad
4
+ data.tar.gz: d68ac9cb5b143b2f3383ad35059a82f428a0ace1144b7ba0ec630dcb6e721ad4
5
5
  SHA512:
6
- metadata.gz: 3e6013ba49d1a1bd3871049e0a7b971f0b0e676e1f055eea0841f35f464db49dcd4c5a49fcf2c3494e07e386110ced55c4e03ef47481385557fdca12c31a7a2c
7
- data.tar.gz: bcff75605887a5fd6550a24a993685288c49a072b301b725de1d7b630c8e30c87991339f3c2077fd4d713f814ec2c0ca7290a5d5306901243d7c8829fb3005f8
6
+ metadata.gz: 5c481b1bf241dee22faa4c69ecd0c164a65e268b23c811786f7ae5651abbe118e223c4a1af743472dd131bbaf3f2f83a0d940d05574b9282130f6b968dbc8dda
7
+ data.tar.gz: d97620d577d1e3daef32becf8c359c6ca4edb94bea486d1d16b1af21c16342858128ee404f202f73d0528116d0b3596b3065706d449ef630c3ea274800142d87
data/Gemfile.lock CHANGED
@@ -4,6 +4,7 @@ PATH
4
4
  files.com (1.1.0)
5
5
  addressable (>= 2.8.0)
6
6
  base64 (~> 0.2)
7
+ bigdecimal
7
8
  concurrent-ruby (>= 1.1.3)
8
9
  faraday (>= 1.0.1)
9
10
  faraday-multipart (>= 1.0)
@@ -20,6 +21,7 @@ GEM
20
21
  ast (2.4.2)
21
22
  base64 (0.2.0)
22
23
  benchmark (0.4.1)
24
+ bigdecimal (4.0.1)
23
25
  byebug (11.1.3)
24
26
  coderay (1.1.3)
25
27
  concurrent-ruby (1.1.10)
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.544
1
+ 1.1.545
@@ -44,8 +44,8 @@
44
44
  ```
45
45
 
46
46
  * `id` (int64): Line item Id
47
- * `amount` (double): Line item amount
48
- * `balance` (double): Line item balance
47
+ * `amount` (decimal): Line item amount
48
+ * `balance` (decimal): Line item balance
49
49
  * `created_at` (date-time): Line item created at
50
50
  * `currency` (string): Line item currency
51
51
  * `download_uri` (string): Line item download uri
data/docs/invoice.md CHANGED
@@ -44,8 +44,8 @@
44
44
  ```
45
45
 
46
46
  * `id` (int64): Line item Id
47
- * `amount` (double): Line item amount
48
- * `balance` (double): Line item balance
47
+ * `amount` (decimal): Line item amount
48
+ * `balance` (decimal): Line item balance
49
49
  * `created_at` (date-time): Line item created at
50
50
  * `currency` (string): Line item currency
51
51
  * `download_uri` (string): Line item download uri
@@ -21,7 +21,7 @@
21
21
  ```
22
22
 
23
23
  * `id` (int64): Invoice Line item Id
24
- * `amount` (double): Invoice line item amount
24
+ * `amount` (decimal): Invoice line item amount
25
25
  * `created_at` (date-time): Invoice line item created at date/time
26
26
  * `description` (string): Invoice line item description
27
27
  * `type` (string): Invoice line item type
data/docs/payment.md CHANGED
@@ -44,8 +44,8 @@
44
44
  ```
45
45
 
46
46
  * `id` (int64): Line item Id
47
- * `amount` (double): Line item amount
48
- * `balance` (double): Line item balance
47
+ * `amount` (decimal): Line item amount
48
+ * `balance` (decimal): Line item balance
49
49
  * `created_at` (date-time): Line item created at
50
50
  * `currency` (string): Line item currency
51
51
  * `download_uri` (string): Line item download uri
@@ -11,7 +11,7 @@
11
11
  }
12
12
  ```
13
13
 
14
- * `amount` (double): Payment line item amount
14
+ * `amount` (decimal): Payment line item amount
15
15
  * `created_at` (date-time): Payment line item created at date/time
16
16
  * `invoice_id` (int64): Invoice ID
17
17
  * `payment_id` (int64): Payment ID
@@ -43,8 +43,8 @@
43
43
  * `health_check_type` (string): Type of health check to perform.
44
44
  * `id` (int64): Unique identifier for this backend.
45
45
  * `interval` (int64): Interval in seconds between health checks.
46
- * `min_free_cpu` (double): Minimum free CPU percentage required for this backend to be considered healthy.
47
- * `min_free_mem` (double): Minimum free memory percentage required for this backend to be considered healthy.
46
+ * `min_free_cpu` (decimal): Minimum free CPU percentage required for this backend to be considered healthy.
47
+ * `min_free_mem` (decimal): Minimum free memory percentage required for this backend to be considered healthy.
48
48
  * `priority` (int64): Priority of this backend.
49
49
  * `remote_path` (string): Path on the remote server to treat as the root of this mount.
50
50
  * `remote_server_id` (int64): The remote server that this backend is associated with.
data/docs/site.md CHANGED
@@ -418,7 +418,7 @@
418
418
  * `motd_text` (string): A message to show users when they connect via FTP or SFTP.
419
419
  * `motd_use_for_ftp` (boolean): Show message to users connecting via FTP
420
420
  * `motd_use_for_sftp` (boolean): Show message to users connecting via SFTP
421
- * `next_billing_amount` (double): Next billing amount
421
+ * `next_billing_amount` (decimal): Next billing amount
422
422
  * `next_billing_date` (string): Next billing date
423
423
  * `office_integration_available` (boolean): If true, allows users to use a document editing integration.
424
424
  * `office_integration_type` (string): Which document editing integration to support. Files.com Editor or Microsoft Office for the Web.
data/files.com.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.required_ruby_version = ">= 2.7"
14
14
  s.add_dependency 'addressable', ">= 2.8.0"
15
15
  s.add_dependency 'base64', "~> 0.2"
16
+ s.add_dependency 'bigdecimal', ">= 0"
16
17
  s.add_dependency 'concurrent-ruby', ">= 1.1.3"
17
18
  s.add_dependency 'faraday', ">= 1.0.1"
18
19
  s.add_dependency 'faraday-multipart', ">= 1.0"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class AccountLineItem
5
7
  attr_reader :options, :attributes
@@ -14,14 +16,20 @@ module Files
14
16
  @attributes[:id]
15
17
  end
16
18
 
17
- # double - Line item amount
19
+ # decimal - Line item amount
18
20
  def amount
19
- @attributes[:amount]
21
+ value = @attributes[:amount]
22
+ return value if value.nil? || value.is_a?(BigDecimal)
23
+
24
+ BigDecimal(value.to_s)
20
25
  end
21
26
 
22
- # double - Line item balance
27
+ # decimal - Line item balance
23
28
  def balance
24
- @attributes[:balance]
29
+ value = @attributes[:balance]
30
+ return value if value.nil? || value.is_a?(BigDecimal)
31
+
32
+ BigDecimal(value.to_s)
25
33
  end
26
34
 
27
35
  # date-time - Line item created at
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class Invoice
5
7
  attr_reader :options, :attributes
@@ -14,14 +16,20 @@ module Files
14
16
  @attributes[:id]
15
17
  end
16
18
 
17
- # double - Line item amount
19
+ # decimal - Line item amount
18
20
  def amount
19
- @attributes[:amount]
21
+ value = @attributes[:amount]
22
+ return value if value.nil? || value.is_a?(BigDecimal)
23
+
24
+ BigDecimal(value.to_s)
20
25
  end
21
26
 
22
- # double - Line item balance
27
+ # decimal - Line item balance
23
28
  def balance
24
- @attributes[:balance]
29
+ value = @attributes[:balance]
30
+ return value if value.nil? || value.is_a?(BigDecimal)
31
+
32
+ BigDecimal(value.to_s)
25
33
  end
26
34
 
27
35
  # date-time - Line item created at
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class InvoiceLineItem
5
7
  attr_reader :options, :attributes
@@ -14,9 +16,12 @@ module Files
14
16
  @attributes[:id]
15
17
  end
16
18
 
17
- # double - Invoice line item amount
19
+ # decimal - Invoice line item amount
18
20
  def amount
19
- @attributes[:amount]
21
+ value = @attributes[:amount]
22
+ return value if value.nil? || value.is_a?(BigDecimal)
23
+
24
+ BigDecimal(value.to_s)
20
25
  end
21
26
 
22
27
  # date-time - Invoice line item created at date/time
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class Payment
5
7
  attr_reader :options, :attributes
@@ -14,14 +16,20 @@ module Files
14
16
  @attributes[:id]
15
17
  end
16
18
 
17
- # double - Line item amount
19
+ # decimal - Line item amount
18
20
  def amount
19
- @attributes[:amount]
21
+ value = @attributes[:amount]
22
+ return value if value.nil? || value.is_a?(BigDecimal)
23
+
24
+ BigDecimal(value.to_s)
20
25
  end
21
26
 
22
- # double - Line item balance
27
+ # decimal - Line item balance
23
28
  def balance
24
- @attributes[:balance]
29
+ value = @attributes[:balance]
30
+ return value if value.nil? || value.is_a?(BigDecimal)
31
+
32
+ BigDecimal(value.to_s)
25
33
  end
26
34
 
27
35
  # date-time - Line item created at
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class PaymentLineItem
5
7
  attr_reader :options, :attributes
@@ -9,9 +11,12 @@ module Files
9
11
  @options = options || {}
10
12
  end
11
13
 
12
- # double - Payment line item amount
14
+ # decimal - Payment line item amount
13
15
  def amount
14
- @attributes[:amount]
16
+ value = @attributes[:amount]
17
+ return value if value.nil? || value.is_a?(BigDecimal)
18
+
19
+ BigDecimal(value.to_s)
15
20
  end
16
21
 
17
22
  # date-time - Payment line item created at date/time
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class RemoteMountBackend
5
7
  attr_reader :options, :attributes
@@ -81,18 +83,24 @@ module Files
81
83
  @attributes[:interval] = value
82
84
  end
83
85
 
84
- # double - Minimum free CPU percentage required for this backend to be considered healthy.
86
+ # decimal - Minimum free CPU percentage required for this backend to be considered healthy.
85
87
  def min_free_cpu
86
- @attributes[:min_free_cpu]
88
+ value = @attributes[:min_free_cpu]
89
+ return value if value.nil? || value.is_a?(BigDecimal)
90
+
91
+ BigDecimal(value.to_s)
87
92
  end
88
93
 
89
94
  def min_free_cpu=(value)
90
95
  @attributes[:min_free_cpu] = value
91
96
  end
92
97
 
93
- # double - Minimum free memory percentage required for this backend to be considered healthy.
98
+ # decimal - Minimum free memory percentage required for this backend to be considered healthy.
94
99
  def min_free_mem
95
- @attributes[:min_free_mem]
100
+ value = @attributes[:min_free_mem]
101
+ return value if value.nil? || value.is_a?(BigDecimal)
102
+
103
+ BigDecimal(value.to_s)
96
104
  end
97
105
 
98
106
  def min_free_mem=(value)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bigdecimal"
4
+
3
5
  module Files
4
6
  class Site
5
7
  attr_reader :options, :attributes
@@ -529,9 +531,12 @@ module Files
529
531
  @attributes[:motd_use_for_sftp]
530
532
  end
531
533
 
532
- # double - Next billing amount
534
+ # decimal - Next billing amount
533
535
  def next_billing_amount
534
- @attributes[:next_billing_amount]
536
+ value = @attributes[:next_billing_amount]
537
+ return value if value.nil? || value.is_a?(BigDecimal)
538
+
539
+ BigDecimal(value.to_s)
535
540
  end
536
541
 
537
542
  # string - Next billing date
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.1.544"
4
+ VERSION = "1.1.545"
5
5
  end
@@ -0,0 +1,44 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Decimal contract" do
4
+ it "loads BigDecimal as a runtime dependency" do
5
+ expect { require "bigdecimal" }.not_to raise_error
6
+ expect(defined?(BigDecimal)).to be_truthy
7
+ end
8
+
9
+ it "parses decimal model attributes as BigDecimal" do
10
+ models_dir = File.expand_path("../lib/files.com/models", __dir__)
11
+ model_files = Dir.glob(File.join(models_dir, "*.rb"))
12
+
13
+ decimal_getter = nil
14
+
15
+ model_files.each do |path|
16
+ src = File.read(path)
17
+ class_name = src[/class\s+(\w+)/, 1]
18
+ next unless class_name
19
+
20
+ # Match the decimal getter pattern generated by the templates.
21
+ match = src.match(
22
+ /def\s+(?<method>\w+)\n\s+value\s*=\s*@attributes\[:(?<attr>\w+)\]\n\s+return\s+value\s+if\s+value\.nil\?\s*\|\|\s+value\.is_a\?\(BigDecimal\)\n\n\s+BigDecimal\(value\.to_s\)/
23
+ )
24
+
25
+ next unless match
26
+
27
+ decimal_getter = {
28
+ class_name: class_name,
29
+ method: match[:method],
30
+ attr: match[:attr].to_sym,
31
+ }
32
+ break
33
+ end
34
+
35
+ expect(decimal_getter).not_to be_nil
36
+
37
+ klass = Files.const_get(decimal_getter[:class_name])
38
+ obj = klass.new({ decimal_getter[:attr] => "1.2300" })
39
+
40
+ value = obj.public_send(decimal_getter[:method])
41
+ expect(value).to be_a(BigDecimal)
42
+ expect(value).to eq(BigDecimal("1.2300"))
43
+ end
44
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.544
4
+ version: 1.1.545
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bigdecimal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: concurrent-ruby
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -406,6 +420,7 @@ files:
406
420
  - shared/header_test_data.json
407
421
  - shared/normalization_for_comparison_test_data.json
408
422
  - shared/url_test_data.json
423
+ - spec/decimal_contract_spec.rb
409
424
  - spec/language_spec.rb
410
425
  - spec/lib/api_client_spec.rb
411
426
  - spec/list_spec.rb