Sha256: 867e5d71904e4c698ca10f9436385a389da7181d19023b04e9f70624d88c8edb

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require "zendesk2/version"

# dependencies
require 'cistern'
require 'addressable/uri'
require 'faraday'
require 'faraday_middleware'

# stdlib
require 'time'
require 'logger'

module Zendesk2
  autoload :Attributes, 'zendesk2/attributes'
  autoload :Error, 'zendesk2/error'
  autoload :Client, 'zendesk2/client'
  autoload :PagedCollection, 'zendesk2/paged_collection'
  autoload :Searchable, 'zendesk2/searchable'
  autoload :Logger, 'zendesk2/logger'

  def self.defaults
    @defaults ||= if File.exists?(File.expand_path("~/.zendesk2"))
                    YAML.load_file(File.expand_path("~/.zendesk2"))
                  else
                    {}
                  end
  end

  def self.paging_parameters(options={})
    if url = options["url"]
      uri = Addressable::URI.parse(url)
      uri.query_values
    else
      Cistern::Hash.slice(options, "page", "per_page")
    end
  end

  def self.uuid
    [8,4,4,4,12].map{|i| Cistern::Mock.random_hex(i)}.join("-")
  end

  def self.stringify_keys(hash)
    hash.inject({}){|r,(k,v)| r.merge(k.to_s => v)}
  end

  def self.blank?(string)
    !!string || string == ""
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zendesk2-0.0.18 lib/zendesk2.rb
zendesk2-0.0.17 lib/zendesk2.rb
zendesk2-0.0.16 lib/zendesk2.rb
zendesk2-0.0.15 lib/zendesk2.rb
zendesk2-0.0.14 lib/zendesk2.rb