Class: LookerSDK::Client::Serializer
- Inherits:
-
Sawyer::Serializer
- Object
- Sawyer::Serializer
- LookerSDK::Client::Serializer
- Defined in:
- lib/looker-sdk/client.rb
Instance Method Summary collapse
-
#decode_hash_value(key, value) ⇒ Object
slight modification to the base class’ decode_hash_value function to less permissive when decoding time values.
- #encode(data) ⇒ Object
Instance Method Details
#decode_hash_value(key, value) ⇒ Object
slight modification to the base class’ decode_hash_value function to less permissive when decoding time values. also prevent conversion from non-string types to Time e.g. integer/float timestamp
See github.com/looker/looker-sdk-ruby/issues/53 for more details
Base class function that we’re overriding: github.com/lostisland/sawyer/blob/master/lib/sawyer/serializer.rb#L101-L121
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/looker-sdk/client.rb', line 437 def decode_hash_value(key, value) if time_field?(key, value) if value.is_a?(String) begin Time.iso8601(value) rescue ArgumentError value end else value end else super end end |
#encode(data) ⇒ Object
422 423 424 425 426 427 428 |
# File 'lib/looker-sdk/client.rb', line 422 def encode(data) if Gem.loaded_specs['faraday'].version < Gem::Version.new('2.0') data.kind_of?(Faraday::UploadIO) ? data : super else defined?(Faraday::FilePart) && data.kind_of?(Faraday::FilePart) ? data : super end end |