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.
- checksums.yaml +4 -4
- data/.github/config/rubocop_linter_action.yml +7 -0
- data/.github/workflows/testing.yml +26 -0
- data/.rubocop.yml +23 -16
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/gecko-ruby.gemspec +11 -10
- data/generate.thor +4 -1
- data/lib/gecko-ruby.rb +2 -0
- data/lib/gecko.rb +2 -0
- data/lib/gecko/client.rb +16 -14
- data/lib/gecko/ext/liquid_compat.rb +11 -9
- data/lib/gecko/ext/log_subscriber.rb +6 -6
- data/lib/gecko/helpers/association_helper.rb +14 -12
- data/lib/gecko/helpers/inspection_helper.rb +4 -2
- data/lib/gecko/helpers/record_helper.rb +2 -0
- data/lib/gecko/helpers/serialization_helper.rb +5 -1
- data/lib/gecko/helpers/validation_helper.rb +3 -1
- data/lib/gecko/record/account.rb +3 -1
- data/lib/gecko/record/address.rb +2 -0
- data/lib/gecko/record/base.rb +5 -3
- data/lib/gecko/record/base_adapter.rb +33 -22
- data/lib/gecko/record/company.rb +2 -0
- data/lib/gecko/record/contact.rb +2 -0
- data/lib/gecko/record/currency.rb +2 -0
- data/lib/gecko/record/exceptions.rb +2 -0
- data/lib/gecko/record/fulfillment.rb +2 -0
- data/lib/gecko/record/fulfillment_line_item.rb +2 -1
- data/lib/gecko/record/image.rb +13 -8
- data/lib/gecko/record/invoice.rb +7 -3
- data/lib/gecko/record/invoice_line_item.rb +2 -1
- data/lib/gecko/record/location.rb +2 -0
- data/lib/gecko/record/note.rb +2 -0
- data/lib/gecko/record/order.rb +2 -0
- data/lib/gecko/record/order_line_item.rb +3 -0
- data/lib/gecko/record/payment_term.rb +2 -1
- data/lib/gecko/record/product.rb +4 -0
- data/lib/gecko/record/purchase_order.rb +2 -1
- data/lib/gecko/record/purchase_order_line_item.rb +2 -1
- data/lib/gecko/record/tax_type.rb +2 -1
- data/lib/gecko/record/user.rb +3 -1
- data/lib/gecko/record/variant.rb +9 -7
- data/lib/gecko/record/webhook.rb +3 -1
- data/lib/gecko/version.rb +3 -1
- data/test/client_test.rb +4 -2
- data/test/fixtures/vcr_cassettes/images.yml +1 -1
- data/test/gecko_test.rb +2 -0
- data/test/helpers/association_helper_test.rb +7 -5
- data/test/helpers/inspection_helper_test.rb +6 -4
- data/test/helpers/serialization_helper_test.rb +16 -14
- data/test/helpers/validation_helper_test.rb +3 -1
- data/test/record/account_adapter_test.rb +2 -0
- data/test/record/address_adapter_test.rb +2 -0
- data/test/record/address_test.rb +2 -0
- data/test/record/company_adapter_test.rb +2 -0
- data/test/record/company_test.rb +2 -0
- data/test/record/contact_adapter_test.rb +2 -0
- data/test/record/contact_test.rb +3 -1
- data/test/record/currency_adapter_test.rb +2 -0
- data/test/record/currency_test.rb +2 -0
- data/test/record/fulfillment_adapter_test.rb +2 -0
- data/test/record/fulfillment_line_item_adapter_test.rb +2 -0
- data/test/record/fulfillment_line_item_test.rb +2 -0
- data/test/record/fulfillment_test.rb +4 -2
- data/test/record/image_adapter_test.rb +2 -0
- data/test/record/image_test.rb +18 -0
- data/test/record/invoice_adapter_test.rb +2 -0
- data/test/record/invoice_line_item_adapter_test.rb +2 -0
- data/test/record/invoice_line_item_test.rb +2 -0
- data/test/record/invoice_test.rb +2 -0
- data/test/record/location_adapter_test.rb +2 -0
- data/test/record/location_test.rb +2 -0
- data/test/record/note_test.rb +2 -0
- data/test/record/order_adapter_test.rb +2 -0
- data/test/record/order_line_item_adapter_test.rb +2 -0
- data/test/record/order_line_item_test.rb +2 -0
- data/test/record/order_test.rb +2 -0
- data/test/record/payment_term_adapter_test.rb +2 -0
- data/test/record/payment_term_test.rb +2 -0
- data/test/record/product_adapter_test.rb +2 -0
- data/test/record/product_test.rb +2 -0
- data/test/record/purchase_order_adapter_test.rb +2 -0
- data/test/record/purchase_order_line_item_adapter_test.rb +2 -0
- data/test/record/purchase_order_line_item_test.rb +2 -0
- data/test/record/purchase_order_test.rb +2 -0
- data/test/record/tax_type_adapter_test.rb +2 -0
- data/test/record/tax_type_test.rb +2 -0
- data/test/record/user_adapter_test.rb +2 -0
- data/test/record/user_test.rb +2 -0
- data/test/record/variant_adapter_test.rb +2 -0
- data/test/record/variant_test.rb +6 -4
- data/test/record/webhook_test.rb +2 -0
- data/test/support/let.rb +2 -0
- data/test/support/shared_adapter_examples.rb +35 -31
- data/test/support/shared_record_examples.rb +3 -1
- data/test/support/shared_sideloaded_data_parsing_examples.rb +2 -1
- data/test/support/testing_adapter.rb +2 -0
- data/test/support/vcr_support.rb +2 -0
- data/test/test_helper.rb +2 -0
- metadata +24 -23
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebfbdacb19b2e0dbc4478c614578298de91e01e1ee79d29ace8833da5ef5ce4d
|
4
|
+
data.tar.gz: 4d4e8551a79728045733fb7fa336a30b655e779c152ae7d0a8ec49af1c746aff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92333d13c62ab98a009c8d8a6396dcd89be342fa3d58fb152a024330f419d44d113aaa19aedbe34de10ba7a3741bb8fd54bab20ee6bb33597edee8131629f386
|
7
|
+
data.tar.gz: e74fb5237da5c6a1a023517c6cc8fa76f5f45f4674362f887ccb82d7887d159aa95f3e329a6faf65fa8bcdfe359874735791db1d3d1b08362e5c2a67afee28cb
|
@@ -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 }}
|
data/.rubocop.yml
CHANGED
@@ -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/
|
18
|
+
Layout/FirstHashElementIndentation:
|
23
19
|
EnforcedStyle: consistent
|
24
20
|
|
25
|
-
|
21
|
+
Layout/LineLength:
|
26
22
|
Max: 120
|
27
23
|
|
28
|
-
|
29
|
-
|
24
|
+
Layout/HashAlignment:
|
25
|
+
EnforcedColonStyle: table
|
30
26
|
|
31
|
-
|
32
|
-
|
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
|
-
|
38
|
+
Naming/AccessorMethodName:
|
36
39
|
Enabled: false
|
37
40
|
|
38
|
-
|
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
|
-
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Style/Documentation:
|
73
|
+
Enabled: false
|
67
74
|
|
68
75
|
Style/DoubleNegation:
|
69
76
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -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
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# TradeGecko RubyGem
|
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
data/gecko-ruby.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
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 =
|
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 "
|
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
|
data/generate.thor
CHANGED
@@ -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 =
|
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
|
data/lib/gecko-ruby.rb
CHANGED
data/lib/gecko.rb
CHANGED
data/lib/gecko/client.rb
CHANGED
@@ -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
|
-
|
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:
|
118
|
-
authorize_url:
|
128
|
+
site: 'https://api.tradegecko.com',
|
129
|
+
authorize_url: 'https://go.tradegecko.com/oauth/authorize',
|
119
130
|
connection_opts: {
|
120
|
-
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
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
available_methods = (
|
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
|
80
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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 =
|
67
|
-
if ids.any?
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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(
|
44
|
+
%("#{value.strftime('%Y-%m-%d %H:%M:%S')}")
|
43
45
|
elsif value.is_a?(Date)
|
44
|
-
%("#{value.strftime(
|
46
|
+
%("#{value.strftime('%Y-%m-%d')}")
|
45
47
|
else
|
46
48
|
value.inspect
|
47
49
|
end
|