Sha256: d980e15bc768c78922898bdd3de3f28521dab447dd30f002ab6f38156da6a91a

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require "zendesk2/version"

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

# stdlib
require 'forwardable'
require 'logger'
require 'time'
require 'yaml'

module Zendesk2
  autoload :Attributes, 'zendesk2/attributes'
  autoload :Error, 'zendesk2/error'
  autoload :Client, 'zendesk2/client'
  autoload :Searchable, 'zendesk2/searchable'
  autoload :Logger, 'zendesk2/logger'
  autoload :Model, 'zendesk2/model'
  autoload :Collection, 'zendesk2/collection'

  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.nil? || string == ""
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zendesk2-0.4.4 lib/zendesk2.rb
zendesk2-0.4.3 lib/zendesk2.rb
zendesk2-0.4.2 lib/zendesk2.rb
zendesk2-0.4.1 lib/zendesk2.rb
zendesk2-0.4.0 lib/zendesk2.rb