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.24 examples/highrise.rb
api_client-0.5.22 examples/highrise.rb
api_client-0.5.21 examples/highrise.rb
api_client-0.5.20 examples/highrise.rb
api_client-0.5.19 examples/highrise.rb
api_client-0.5.18 examples/highrise.rb
api_client-0.5.17 examples/highrise.rb
api_client-0.5.16 examples/highrise.rb
api_client-0.5.15 examples/highrise.rb
api_client-0.5.14 examples/highrise.rb
api_client-0.5.13 examples/highrise.rb
api_client-0.5.12 examples/highrise.rb
api_client-0.5.11 examples/highrise.rb
api_client-0.5.9 examples/highrise.rb
api_client-0.5.7 examples/highrise.rb
api_client-0.5.6 examples/highrise.rb
api_client-0.5.5 examples/highrise.rb
api_client-0.5.4 examples/highrise.rb
api_client-0.5.3 examples/highrise.rb
api_client-0.5.2 examples/highrise.rb