gecko-ruby 0.9.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/config/rubocop_linter_action.yml +7 -0
  3. data/.github/workflows/testing.yml +26 -0
  4. data/.rubocop.yml +23 -16
  5. data/CHANGELOG.md +18 -0
  6. data/Gemfile +2 -0
  7. data/README.md +1 -1
  8. data/Rakefile +3 -1
  9. data/gecko-ruby.gemspec +11 -10
  10. data/generate.thor +4 -1
  11. data/lib/gecko-ruby.rb +2 -0
  12. data/lib/gecko.rb +2 -0
  13. data/lib/gecko/client.rb +16 -14
  14. data/lib/gecko/ext/liquid_compat.rb +11 -9
  15. data/lib/gecko/ext/log_subscriber.rb +6 -6
  16. data/lib/gecko/helpers/association_helper.rb +14 -12
  17. data/lib/gecko/helpers/inspection_helper.rb +4 -2
  18. data/lib/gecko/helpers/record_helper.rb +2 -0
  19. data/lib/gecko/helpers/serialization_helper.rb +5 -1
  20. data/lib/gecko/helpers/validation_helper.rb +3 -1
  21. data/lib/gecko/record/account.rb +3 -1
  22. data/lib/gecko/record/address.rb +2 -0
  23. data/lib/gecko/record/base.rb +5 -3
  24. data/lib/gecko/record/base_adapter.rb +33 -22
  25. data/lib/gecko/record/company.rb +2 -0
  26. data/lib/gecko/record/contact.rb +2 -0
  27. data/lib/gecko/record/currency.rb +2 -0
  28. data/lib/gecko/record/exceptions.rb +2 -0
  29. data/lib/gecko/record/fulfillment.rb +2 -0
  30. data/lib/gecko/record/fulfillment_line_item.rb +2 -1
  31. data/lib/gecko/record/image.rb +13 -8
  32. data/lib/gecko/record/invoice.rb +7 -3
  33. data/lib/gecko/record/invoice_line_item.rb +2 -1
  34. data/lib/gecko/record/location.rb +2 -0
  35. data/lib/gecko/record/note.rb +2 -0
  36. data/lib/gecko/record/order.rb +2 -0
  37. data/lib/gecko/record/order_line_item.rb +3 -0
  38. data/lib/gecko/record/payment_term.rb +2 -1
  39. data/lib/gecko/record/product.rb +4 -0
  40. data/lib/gecko/record/purchase_order.rb +2 -1
  41. data/lib/gecko/record/purchase_order_line_item.rb +2 -1
  42. data/lib/gecko/record/tax_type.rb +2 -1
  43. data/lib/gecko/record/user.rb +3 -1
  44. data/lib/gecko/record/variant.rb +9 -7
  45. data/lib/gecko/record/webhook.rb +3 -1
  46. data/lib/gecko/version.rb +3 -1
  47. data/test/client_test.rb +4 -2
  48. data/test/fixtures/vcr_cassettes/images.yml +1 -1
  49. data/test/gecko_test.rb +2 -0
  50. data/test/helpers/association_helper_test.rb +7 -5
  51. data/test/helpers/inspection_helper_test.rb +6 -4
  52. data/test/helpers/serialization_helper_test.rb +16 -14
  53. data/test/helpers/validation_helper_test.rb +3 -1
  54. data/test/record/account_adapter_test.rb +2 -0
  55. data/test/record/address_adapter_test.rb +2 -0
  56. data/test/record/address_test.rb +2 -0
  57. data/test/record/company_adapter_test.rb +2 -0
  58. data/test/record/company_test.rb +2 -0
  59. data/test/record/contact_adapter_test.rb +2 -0
  60. data/test/record/contact_test.rb +3 -1
  61. data/test/record/currency_adapter_test.rb +2 -0
  62. data/test/record/currency_test.rb +2 -0
  63. data/test/record/fulfillment_adapter_test.rb +2 -0
  64. data/test/record/fulfillment_line_item_adapter_test.rb +2 -0
  65. data/test/record/fulfillment_line_item_test.rb +2 -0
  66. data/test/record/fulfillment_test.rb +4 -2
  67. data/test/record/image_adapter_test.rb +2 -0
  68. data/test/record/image_test.rb +18 -0
  69. data/test/record/invoice_adapter_test.rb +2 -0
  70. data/test/record/invoice_line_item_adapter_test.rb +2 -0
  71. data/test/record/invoice_line_item_test.rb +2 -0
  72. data/test/record/invoice_test.rb +2 -0
  73. data/test/record/location_adapter_test.rb +2 -0
  74. data/test/record/location_test.rb +2 -0
  75. data/test/record/note_test.rb +2 -0
  76. data/test/record/order_adapter_test.rb +2 -0
  77. data/test/record/order_line_item_adapter_test.rb +2 -0
  78. data/test/record/order_line_item_test.rb +2 -0
  79. data/test/record/order_test.rb +2 -0
  80. data/test/record/payment_term_adapter_test.rb +2 -0
  81. data/test/record/payment_term_test.rb +2 -0
  82. data/test/record/product_adapter_test.rb +2 -0
  83. data/test/record/product_test.rb +2 -0
  84. data/test/record/purchase_order_adapter_test.rb +2 -0
  85. data/test/record/purchase_order_line_item_adapter_test.rb +2 -0
  86. data/test/record/purchase_order_line_item_test.rb +2 -0
  87. data/test/record/purchase_order_test.rb +2 -0
  88. data/test/record/tax_type_adapter_test.rb +2 -0
  89. data/test/record/tax_type_test.rb +2 -0
  90. data/test/record/user_adapter_test.rb +2 -0
  91. data/test/record/user_test.rb +2 -0
  92. data/test/record/variant_adapter_test.rb +2 -0
  93. data/test/record/variant_test.rb +6 -4
  94. data/test/record/webhook_test.rb +2 -0
  95. data/test/support/let.rb +2 -0
  96. data/test/support/shared_adapter_examples.rb +35 -31
  97. data/test/support/shared_record_examples.rb +3 -1
  98. data/test/support/shared_sideloaded_data_parsing_examples.rb +2 -1
  99. data/test/support/testing_adapter.rb +2 -0
  100. data/test/support/vcr_support.rb +2 -0
  101. data/test/test_helper.rb +2 -0
  102. metadata +24 -23
  103. data/.travis.yml +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b82efcf479bde2b049bfd09f55185e8c4c5fd29377ca35a8865dc2816c6cba0c
4
- data.tar.gz: 838ba153b885dcbca0accf42143733b4e9d79478bcd1d26d57001c3cfda9f4ca
3
+ metadata.gz: ebfbdacb19b2e0dbc4478c614578298de91e01e1ee79d29ace8833da5ef5ce4d
4
+ data.tar.gz: 4d4e8551a79728045733fb7fa336a30b655e779c152ae7d0a8ec49af1c746aff
5
5
  SHA512:
6
- metadata.gz: 607951bf8f6958c8b11814dcaa5c9f8d3d24517dcf0ae2f34e2b443358abdf1f27354a53f227baba505a1bfebae42891519b17cdadecde23c5fd696d0a9ff087
7
- data.tar.gz: da203fe38e4d22f35de38d56217489338a5319de2f6cdd82fb8a67d9533a5f97969e2397010323f53598c19203c0e63b422211cf2b296d2db4ca67877ab9d7ee
6
+ metadata.gz: 92333d13c62ab98a009c8d8a6396dcd89be342fa3d58fb152a024330f419d44d113aaa19aedbe34de10ba7a3741bb8fd54bab20ee6bb33597edee8131629f386
7
+ data.tar.gz: e74fb5237da5c6a1a023517c6cc8fa76f5f45f4674362f887ccb82d7887d159aa95f3e329a6faf65fa8bcdfe359874735791db1d3d1b08362e5c2a67afee28cb
@@ -0,0 +1,7 @@
1
+ ---
2
+ check_name: 'Rubocop Results'
3
+ check_scope: 'modified'
4
+ versions:
5
+ - rubocop
6
+ - rubocop-minitest
7
+ - rubocop-performance
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Ruby Tests
3
+
4
+ 'on': [push, pull_request]
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ ruby: ['2.4', '2.5', '2.6', '2.7']
12
+ name: Ruby ${{ matrix.ruby }}
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - name: Run Tests
19
+ run: |
20
+ gem install bundler --no-document
21
+ bundle install --jobs 4 --retry 3
22
+ bundle exec rake
23
+ - name: Rubocop
24
+ uses: andrewmcodes/rubocop-linter-action@v3.1.0
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,5 +1,8 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
+ Exclude:
4
+ - 'bin/*'
5
+ - 'generate.thor'
3
6
 
4
7
  # class Example
5
8
  # ...
@@ -9,33 +12,34 @@ AllCops:
9
12
  Layout/AccessModifierIndentation:
10
13
  EnforcedStyle: outdent
11
14
 
12
- Style/Blocks:
13
- Enabled: false
14
-
15
- # Allows foo(bar: baz)
16
- Style/BracesAroundHashParameters:
17
- Enabled: false
18
-
19
15
  Layout/DotPosition:
20
16
  EnforcedStyle: leading
21
17
 
22
- Layout/IndentHash:
18
+ Layout/FirstHashElementIndentation:
23
19
  EnforcedStyle: consistent
24
20
 
25
- Metrics/LineLength:
21
+ Layout/LineLength:
26
22
  Max: 120
27
23
 
28
- Style/RedundantSelf:
29
- Enabled: false
24
+ Layout/HashAlignment:
25
+ EnforcedColonStyle: table
30
26
 
31
- # We like neatly-aligned code
32
- Layout/SpaceBeforeFirstArg:
27
+ Metrics/AbcSize:
28
+ Exclude:
29
+ - 'test/**/*.rb'
30
+
31
+ Naming/FileName:
32
+ Exclude:
33
+ - 'lib/gecko-ruby.rb'
34
+
35
+ Naming/PredicateName:
33
36
  Enabled: false
34
37
 
35
- Layout/SpaceAroundEqualsInParameterDefault:
38
+ Naming/AccessorMethodName:
36
39
  Enabled: false
37
40
 
38
- Layout/SpaceInsideHashLiteralBraces:
41
+ # We like neatly-aligned code
42
+ Layout/SpaceBeforeFirstArg:
39
43
  Enabled: false
40
44
 
41
45
  # Allow single or double quotes
@@ -63,7 +67,10 @@ Layout/MultilineOperationIndentation:
63
67
  Enabled: false
64
68
 
65
69
  Style/ClassAndModuleChildren:
66
- EnforcedStyle: compact
70
+ Enabled: false
71
+
72
+ Style/Documentation:
73
+ Enabled: false
67
74
 
68
75
  Style/DoubleNegation:
69
76
  Enabled: false
@@ -1,3 +1,21 @@
1
+ ## 0.12.0 (2020-07-09)
2
+ - Silence warnings in Ruby 2.7
3
+ - Ensure response is passed to `ActiveSupport::Notifications` on error
4
+ - Ensure `adapter.last_response` is set on error response
5
+
6
+ ## 0.11.1 (2020-04-30)
7
+ - Fix addresses on Invoice
8
+
9
+ ## 0.11.0 (2020-04-29)
10
+ - Store create/update responses under `adapter.last_response` as well.
11
+
12
+ ## 0.10.0 (2020-04-06)
13
+ - Add extra delegated attributes to invoice record
14
+ - [BREAKING] Update Image record to latest API with product and multiple variant support
15
+
16
+ ## 0.9.1 (2019-07-29)
17
+ - Fix issue with LiquidCompat that broke during refactor
18
+
1
19
  ## 0.9.0 (2019-07-24)
2
20
  - Added an optional `ActiveSupport::LogSubscriber` class for easy logging,
3
21
  can be enabled via `Gecko.enable_logging`.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in gecko.gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # TradeGecko RubyGem [![Build Status](https://travis-ci.org/tradegecko/gecko.png)](https://travis-ci.org/tradegecko/gecko) [![Code Climate](https://codeclimate.com/github/tradegecko/gecko.png)](https://codeclimate.com/github/tradegecko/gecko)
1
+ # TradeGecko RubyGem ![Build Status](https://github.com/tradegecko/gecko/workflows/Ruby%20Tests/badge.svg) [![Code Climate](https://codeclimate.com/github/tradegecko/gecko.png)](https://codeclimate.com/github/tradegecko/gecko)
2
2
  The official TradeGecko API RubyGem
3
3
 
4
4
  ## Introduction
data/Rakefile CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
 
3
5
  require 'rake/testtask'
4
6
 
5
- task :default => [:test]
7
+ task default: [:test]
6
8
 
7
9
  Rake::TestTask.new do |t|
8
10
  t.libs << 'test'
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'gecko/version'
5
6
 
@@ -8,7 +9,7 @@ Gem::Specification.new do |spec|
8
9
  spec.version = Gecko::VERSION
9
10
  spec.authors = ["Bradley Priest"]
10
11
  spec.email = ['bradley@tradegecko.com']
11
- spec.description = %q{A Ruby interface to the TradeGecko API.}
12
+ spec.description = 'A Ruby interface to the TradeGecko API.'
12
13
  spec.summary = spec.description
13
14
  spec.homepage = 'https://github.com/tradegecko/gecko/'
14
15
  spec.license = 'MIT'
@@ -19,17 +20,17 @@ Gem::Specification.new do |spec|
19
20
  spec.require_paths = ["lib"]
20
21
 
21
22
  spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "dotenv"
23
24
  spec.add_development_dependency "minitest"
24
- spec.add_development_dependency "vcr"
25
- spec.add_development_dependency "webmock"
26
25
  spec.add_development_dependency "mocha"
27
- spec.add_development_dependency "timecop"
28
- spec.add_development_dependency "dotenv"
29
- spec.add_development_dependency "thor"
30
26
  spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "thor"
29
+ spec.add_development_dependency "timecop"
30
+ spec.add_development_dependency "vcr"
31
+ spec.add_development_dependency "webmock"
31
32
 
33
+ spec.add_dependency "activesupport"
32
34
  spec.add_dependency "oauth2", "> 1.1.0"
33
35
  spec.add_dependency "virtus"
34
- spec.add_dependency "activesupport"
35
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/inflector'
2
4
  class Generate < Thor
3
5
  include Thor::Actions
@@ -7,7 +9,7 @@ class Generate < Thor
7
9
  @model_name = model_name
8
10
  @file_name = model_name.underscore
9
11
  @plural = ask "What is the underscore plural of #{@model_name}? (#{@file_name}s):"
10
- @plural = @plural.to_s.length > 0 ? @plural : @file_name + "s"
12
+ @plural = !@plural.to_s.empty? ? @plural : @file_name + "s"
11
13
  create_file "lib/gecko/record/#{@file_name}.rb", model_template
12
14
  create_file "test/record/#{@file_name}_adapter_test.rb", test_adapter_template
13
15
  create_file "test/record/#{@file_name}_test.rb", test_template
@@ -16,6 +18,7 @@ class Generate < Thor
16
18
  end
17
19
 
18
20
  private
21
+
19
22
  def default_plural?
20
23
  @plural == @file_name + "s"
21
24
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gecko'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'virtus'
2
4
  require 'active_support/inflector'
3
5
  require 'active_support/notifications'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'oauth2/version'
3
5
  require 'gecko/version'
@@ -57,7 +59,7 @@ module Gecko
57
59
  # @return [undefined]
58
60
  #
59
61
  # @api private
60
- def initialize(client_id, client_secret, options={})
62
+ def initialize(client_id, client_secret, options = {})
61
63
  setup_oauth_client(client_id, client_secret, options)
62
64
  end
63
65
 
@@ -107,29 +109,29 @@ module Gecko
107
109
  #
108
110
  # @api private
109
111
  def adapter_for(klass_name)
110
- self.public_send(klass_name.to_sym)
112
+ public_send(klass_name.to_sym)
113
+ end
114
+
115
+ def self.default_headers
116
+ {
117
+ 'User-Agent' => ["Gecko/#{Gecko::VERSION}",
118
+ "OAuth2/#{OAuth2::Version}",
119
+ "Faraday/#{Faraday::VERSION}",
120
+ "Ruby/#{RUBY_VERSION}"].join(' ')
121
+ }
111
122
  end
112
123
 
113
124
  private
114
125
 
115
126
  def setup_oauth_client(client_id, client_secret, options)
116
127
  defaults = {
117
- site: 'https://api.tradegecko.com',
118
- authorize_url: 'https://go.tradegecko.com/oauth/authorize',
128
+ site: 'https://api.tradegecko.com',
129
+ authorize_url: 'https://go.tradegecko.com/oauth/authorize',
119
130
  connection_opts: {
120
- headers: self.class.default_headers
131
+ headers: self.class.default_headers
121
132
  }
122
133
  }
123
134
  @oauth_client = OAuth2::Client.new(client_id, client_secret, defaults.merge(options))
124
135
  end
125
-
126
- def self.default_headers
127
- {
128
- 'User-Agent' => ["Gecko/#{Gecko::VERSION}",
129
- "OAuth2/#{OAuth2::Version.to_s}",
130
- "Faraday/#{Faraday::VERSION}",
131
- "Ruby/#{RUBY_VERSION}"].join(' ')
132
- }
133
- end
134
136
  end
135
137
  end
@@ -56,18 +56,20 @@ module Gecko
56
56
 
57
57
  ## Override Liquid::Drop#invoke_drop to also check method arity
58
58
  def invoke_drop(method_or_key)
59
- if self.invokable_methods.include?(method_or_key.to_s) && self.method_arity(method_or_key.to_sym) <= 0
60
- self.public_send(method_or_key)
61
- end
59
+ return unless invokable_methods.include?(method_or_key.to_s) && method_arity(method_or_key.to_sym) <= 0
60
+
61
+ public_send(method_or_key)
62
62
  end
63
63
 
64
+ alias [] invoke_drop
65
+
64
66
  ## Override Liquid::Drop#invokable_methods to add extra checks
65
67
  def invokable_methods
66
68
  @invokable_methods ||= begin
67
- blacklist = Gecko::Record::Base.public_instance_methods + Liquid::Drop.public_instance_methods
68
- blacklist -= [:to_liquid, :id, :created_at, :updated_at]
69
- whitelist = self.public_methods + @delegate.public_methods
70
- available_methods = (whitelist - blacklist).map(&:to_s)
69
+ denylist = Gecko::Record::Base.public_instance_methods + Liquid::Drop.public_instance_methods
70
+ denylist -= %i[to_liquid id created_at updated_at]
71
+ allowlist = public_methods + @delegate.public_methods
72
+ available_methods = (allowlist - denylist).map(&:to_s)
71
73
  available_methods.reject! { |method_name| method_name.ends_with?("=") }
72
74
  Set.new(available_methods)
73
75
  end
@@ -76,8 +78,8 @@ module Gecko
76
78
  protected
77
79
 
78
80
  def method_arity(method_name)
79
- if self.methods.include?(method_name)
80
- self.method(method_name).arity
81
+ if methods.include?(method_name)
82
+ method(method_name).arity
81
83
  else
82
84
  @delegate.method(method_name).arity
83
85
  end
@@ -13,7 +13,7 @@ class GeckoLogSubscriber < ActiveSupport::LogSubscriber
13
13
  @odd = false
14
14
  end
15
15
 
16
- def request(event)
16
+ def request(event) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
17
17
  RequestStore.store[ENV_KEY] = []
18
18
  payload = event.payload
19
19
 
@@ -27,11 +27,11 @@ class GeckoLogSubscriber < ActiveSupport::LogSubscriber
27
27
  name = "#{payload[:model_class]} Load (#{event.duration.round(1)}ms)"
28
28
  query = "#{payload[:verb].to_s.upcase} /#{request_path}"
29
29
 
30
- if odd?
31
- name = color(name, CYAN, true)
32
- else
33
- name = color(name, MAGENTA, true)
34
- end
30
+ name = if odd?
31
+ color(name, CYAN, true)
32
+ else
33
+ color(name, MAGENTA, true)
34
+ end
35
35
 
36
36
  query = color(query, nil, true)
37
37
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gecko
2
4
  module Helpers
3
5
  # Helper for has_many/belongs_to relationships
@@ -24,7 +26,7 @@ module Gecko
24
26
  # @return [undefined]
25
27
  #
26
28
  # @api public
27
- def belongs_to(model_name, options={})
29
+ def belongs_to(model_name, options = {})
28
30
  class_name = options[:class_name] || model_name.to_s.classify
29
31
  foreign_key = model_name.to_s.foreign_key.to_sym
30
32
 
@@ -55,22 +57,22 @@ module Gecko
55
57
  # @return [undefined]
56
58
  #
57
59
  # @api public
58
- def has_many(association_name, options={})
60
+ def has_many(association_name, options = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
59
61
  model_name = association_name.to_s.singularize
60
62
  class_name = options[:class_name] || model_name.classify
61
63
  foreign_key = model_name.foreign_key.pluralize.to_sym
62
64
  readonly = options.key?(:readonly) ? options[:readonly] : true
63
65
 
64
- define_method association_name do
66
+ define_method association_name do # rubocop:disable Metrics/MethodLength
65
67
  collection_proxies[association_name] ||= begin
66
- ids = self.attributes[foreign_key]
67
- if ids.any?
68
- collection = @client.adapter_for(class_name).find_many(ids)
69
- else
70
- collection = []
71
- end
72
-
73
- build_collection_proxy(collection, {
68
+ ids = attributes[foreign_key]
69
+ collection = if ids.any?
70
+ @client.adapter_for(class_name).find_many(ids)
71
+ else
72
+ []
73
+ end
74
+
75
+ build_collection_proxy(collection, **{
74
76
  embedded: options[:embedded],
75
77
  class_name: class_name,
76
78
  association_name: association_name
@@ -98,7 +100,7 @@ module Gecko
98
100
  #
99
101
  # @api private
100
102
  def build_collection_proxy(target, association_name:, class_name:, embedded:)
101
- CollectionProxy.new({
103
+ CollectionProxy.new(**{
102
104
  parent: self,
103
105
  target: target,
104
106
  embedded: embedded,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gecko
2
4
  module Helpers
3
5
  # Helper for providing custom #inspect values to Records
@@ -39,9 +41,9 @@ module Gecko
39
41
  if value.is_a?(String) && value.length > 50
40
42
  "#{value[0..50]}...".inspect
41
43
  elsif value.is_a?(DateTime) || value.is_a?(Time)
42
- %("#{value.strftime("%Y-%m-%d %H:%M:%S")}")
44
+ %("#{value.strftime('%Y-%m-%d %H:%M:%S')}")
43
45
  elsif value.is_a?(Date)
44
- %("#{value.strftime("%Y-%m-%d")}")
46
+ %("#{value.strftime('%Y-%m-%d')}")
45
47
  else
46
48
  value.inspect
47
49
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gecko
2
4
  module Helpers
3
5
  # Helper for registering valid record types