Sha256: 5b5c5914a20e90b34e1eb47fe8b3cb8833d71c397c357ab1065294ed8f304834

Contents?: true

Size: 842 Bytes

Versions: 41

Compression:

Stored size: 842 Bytes

Contents

require "rubygems"
require "bundler/setup"
require "./examples/config" if File.exists?('examples/config.rb')
require "api_client"
require "multi_xml"

module Highrise

  class Base < ApiClient::Resource::Base
    format      :xml

    # In this hook we set the basic auth provided in the options
    connection do |connection|
      connection.handler.basic_auth connection.options[:user], connection.options[:pass]
    end

    always do
      endpoint HIGHRISE_URL
      options(:user => HIGHRISE_TOKEN, :pass => 'X')
    end

  end

  class Person < Base
    namespace false

    always do
      path "people"
    end

    def self.build_one(hash)
      hash.has_key?('people') ? build_many(hash['people']) : super(hash)
    end

  end

end

Highrise::Person.find_all.each do |person|
  puts "#{person.first_name} #{person.last_name}"
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
api_client-0.5.1 examples/highrise.rb
api_client-0.5.0 examples/highrise.rb
api_client-0.4.3 examples/highrise.rb
api_client-0.4.2 examples/highrise.rb
api_client-0.4.1 examples/highrise.rb
api_client-0.3.3 examples/highrise.rb
api_client-0.4.0 examples/highrise.rb
api_client-0.3.2 examples/highrise.rb
api_client-0.3.1 examples/highrise.rb
api_client-0.3.0 examples/highrise.rb
api_client-0.2.0 examples/highrise.rb
api_client-0.1.9 examples/highrise.rb
api_client-0.1.8 examples/highrise.rb
api_client-0.1.7 examples/highrise.rb
api_client-0.1.6 examples/highrise.rb
api_client-0.1.5 examples/highrise.rb
api_client-0.1.4 examples/highrise.rb
api_client-0.1.3 examples/highrise.rb
api_client-0.1.2 examples/highrise.rb
api_client-0.1.1 examples/highrise.rb