Sha256: e6a44cc756fa9969a127cc0de11fe022550792cafeb62458631e44f634abba23

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

require 'date'

module Shutterstock
	class Driver

		def respond_to(method)
			return true if @hash[method.to_s]
			super()
		end

		def methods
			methods = super()
			[methods, @hash.keys.map{ |k| k.to_sym} ].flatten
		end

		TRUTHY_JSON_VALUES = [ "1", 1, true, "true"]
		def json_true?(thing)
			TRUTHY_JSON_VALUES.include? thing
		end

    def to_date(text_date)
      return nil if text_date.nil?
      DateTime.parse(text_date)
    end

		def client
			Client.instance
		end

		def self.client
			Client.instance
		end

    def self.api(*params)
      client.api(*params)
    end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shutterstock-v2-0.0.1 lib/client/driver.rb