Coder Social home page Coder Social logo

highrise's Introduction

Highrise (master) Build Status Code Climate

What is it?

This gem provides a set of classes to access information on Highrise via the published API:

Account, Comment, Company, Deal, DealCategory, Email, Group, Case, Membership,
Note, Party, Person, Recording, Subject, Tag, Task, TaskCategory and User.

All these classes are inherited from ActiveResouce::Base. Refer to the ActiveResouce documentation for more information.

Installing

    gem install highrise

Dependencies (see highrise.gemspec or run bundle check)

Documentation

I'm on rdoc.info (or am I?)

Cookbook

Configure your key

    require 'highrise'

    Highrise::Base.site = 'https://your_site.highrisehq.com'
    Highrise::Base.user = 'api-auth-token'
    Highrise::Base.format = :xml

If you are using this in a Rails application, putting this code in a config/initializers/highrise.rb file is recommended. See config_initializers_highrise.rb in the examples/ directory.

Usage

    @tags = Highrise::Tag.find(:all)

    @people = Highrise::Person.find_all_across_pages(:params => {:tag_id => 12345})

    @person.tag!("VIP")

License

This code is free to be used under the terms of the MIT license.

Bugs, Issues, Kudos and Catcalls

Comments are welcome. Send your feedback through the issue tracker on GitHub

If you have fixes: Submit via pull requests. Do not include version changes to the version file.

Authors

[]

highrise's People

Contributors

amartinfraguas avatar andymorris avatar basvodde avatar bmsatierf avatar chrmod avatar demonbane avatar dependabot[bot] avatar dior001 avatar jeremy avatar kmayer avatar luisbebop avatar merleb avatar minhajuddin avatar odorcicd avatar rogerio-augusto avatar rubenstolk avatar tapajos avatar thiagolelis avatar tjsousa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

highrise's Issues

Please add SubjectField

Hi,

I'm using the custom subject fields in highrise, but I need this code to create and get them:

module Highrise
class SubjectField < Base
end
end

Can you please add this to a future version?

Cheers,

Vincent

Cannot create a person with tags in it

Hi there,

I tried to do some research for this case but I'm not able to find anything similar to what I have. I'm trying to do a POST request to /people.xml to create a new person. It works well and all until I add tags to it. Here is the XML snippet I'm talking about

<person>
    <first-name>first</first-name>
    <last-name>last</last-name>
    <title>Mr.</title>
    <company-name>Saeed Inc.</company-name>
    <contact-data>
        <email-addresses type="array">
            <email-address>
                <address>[email protected]</address>
            </email-address>
        </email-addresses>
    </contact-data>
    <tags type="array">
        <tag>
            <id type="integer">312763</id>
            <name>Person</name>
        </tag>
    </tags>
</person>

Without the tags XML part, this works fine. I'm not sure why I'm getting this. The response has code 422 unprocessable entity. The error message is empty. Not sure what I'm missing

Can't Add a Contact to a Case

I'm trying to use this api to create cases and add existing contacts to them. I tried code like this, but it didn't seem to work:

people = Highrise::Person.find_all_across_pages()
kase = Highrise::Kase.new
kase.name = "Test Case"
kase.parties = [people[0]]
kase.save

Could the API be expanded to support this operation?

Can't update Person's phone number

When I find a person via:

@person = Highrise::Person.find_all_across_pages(:params => {:email => @user.email}).first

I can save the first and last name fine via:

@person.first_name = @user.first_name
@person.last_name = @user.last_name
@person.save

Then I requested this persons phone numbers in rails console, there is one currently on the profile:

=> @person.contact_data.phone_numbers
=> [#<Highrise::Person::ContactData::PhoneNumber:0x007fcc14be0a40 @attributes={"id"=>79214279, "location"=>"Work", "number"=>"647 966 7986"}, @prefix_options={}, @persisted=false>] 

But when I try to add a new phone number, it doesn't save for some reason (even though @person.save returns true)

@person.contact_data.phone_numbers << Highrise::Person::ContactData::PhoneNumber.new({:number => @user.company.phone, :location => "Work"})
@person.save

When I request the phone numbers again, it doesn't appear to add the new number its just the same one as before.

Am I missing something?

account.xml endpoint

We deployed a new API to get detailed info about the current user's Highrise account.

Includes:

  • account id, subdomain, and name - plan name (max, plus, solo, etc.) - account owner's user_id - total number of people (not companies) on the account - total space used in bytes - color theme name (see /stylesheets/color/#{name}.css) - whether SSL is enabled - creation and last-update timestamps

See http://developer.37signals.com/highrise/account for example XML.

We hope you find this extra info helpful in your developing your apps. Enjoy

Unable to update custom fields

After several unsuccessful attempts at updating the value of a given custom field for a given person, I was unable to do so. There doesn't appear to be any support for this, nor was I able to find any documentation or successful examples of anyone being able to do this.

Documentation - Searching for records

I'm trying to do a search for a contact like this:

List By Search Criteria

GET /people/search.xml?criteria[state]=CA&criteria[zip]=90210
Returns a collection of people that match the criteria passed in through the URL.

For example I want to find the person with the email address [email protected].

For the life of me I can't figure what call I need to make using the gem. Any suggestions? It could be a good idea to add a few more examples to the examples file showing each of the different calls.

Question serializing results...

I am serializing and storing the results of:
contacts = Highrise::Person.find(:all)

When trying to de-serialize this object using Marshal.load() I get this error.
ArgumentError: undefined class/module Highrise::Person::ContactData

Is there a way to instantiate the object "Highrise::Person::ContactData" without Highrise::Person.find(:all).

If I could this would clear up my error.

Thanks

Adding A Note To A Person

I am doing the following.

person= Highrise::Person.find_all_across_pages(:params => {:name => 'David'}).first

note = Highrise::Note.new

note.body = 'Test.'
note.subject_id = person.id

note.save

And I get a 404 - how can I add a note? person.note.new doesn't work either.

(PS I'll do a example file and send a pull request if I find it out!)

Saving a Note

What requirements are needed to save a note?

find a note then try to note.save
=> false

Narrowed it down to cant save a note that has an attachment

Dependency tangle with activeresource/activesupport prevents installation

I get this:

root@ds-live-0:/# gem install highrise
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: activeresource requires activesupport (~> 4.0); railties requires activesupport (= 4.0.0.rc2); actionpack requires activesupport (= 4.0.0.rc2); activemodel requires activesupport (= 4.0.0)

No problem with 3.0.3

Thanks for updating this package like you are, much appreciated!

Avatar URL causing 422s

Hi, I am encountering an odd behaviour from the API. Maybe it's because I am not using the wrapper right, if so please correct me.
I try to create a person in Highrise like this:

person = Highrise::Person.new
person.first_name = 'some name'
person.last_name = 'some last name'
person.avatar_url = 'https://my-url.com/image.jpg'
person.contact_data =  { email_addresses: [{ address: '[email protected]' }] }
person.save

I am getting a 422 error like this one:

irb(main):024:0> person.errors
=> #<ActiveResource::Errors:0x007f41828777b8 @base=#<Highrise::Person:0x007f4182cb43d0 @attributes={"subject_datas"=>[], "first_name"=>"some name", "last_name"=>"some last name"
, "email"=>"[email protected]", "avatar_url"=>"https://my-url.com/image.jpg", "contact_data"=>{"email_addresses"=>[{"address"=>"[email protected]"}]}}, @prefix_options={}, @persisted=false,
 @remote_errors=#<ActiveResource::ResourceInvalid: Failed.  Response code = 422.  Response message = Unprocessable Entity.>, @validation_context=nil, @errors=
#<ActiveResource::Errors:0x007f41828777b8 ...>>, @messages={}>

The save is successful if I remove the avatar_url attribute.
Am I doing this wrong? The official API repo has that avatar-url attribute too.
Thanks a lot

Caching doesn't appear to work with subclasses

In my config, I set Highrise::Base.cache_store = ActiveSupport::Cache.lookup_store :memory_store. In script/console I call Highrise::Base.cache_store & it returns the Cache object. However, if I call Highrise::Person.cache_store, it returns nil. The only way to get caching is to manually set it on each sub class.

Note don't respond to :since

Highrise::Note includes the Pagination Module, yet I don't see documentation supporting the ?since= parameter. I can confirm as much in the rails console.

Objects wont save

I can't get any objects to save (Deals, People, Tags, etc). Thanks

d.save
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.delete
from /usr/local/lib/ruby/gems/1.8/gems/highrise-2.0.1/lib/highrise/../cachable.rb:67:in put' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.8/lib/active_resource/base.rb:1077:inupdate'
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.8/lib/active_resource/base.rb:867:in save_without_validation' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.3.8/lib/active_resource/validations.rb:259:insave'
from (irb):2

Party "type" field

I can't seem to work around accessing the "type" field from Parties, Rails throws a bit of a fit as this is a built in method name?

Is it possible to write an accessor method to rename this?

422 Unprocessable Entity on update due to nested models

When updating a Deal, if a nested Party model is included in the post body, a 422 error is being returned.

According to this message, Highrise has recently started returning 422 errors in cases where it hadn't before.

Testing manually, I found this to work fine

<deal>
  <name>Deal</name>
</deal>

While this 422'd

<deal>
  <name>Deal</name>
  <party>
  </party>
</deal>

I got around it for my immediate needs by monkey-patching the Deal class as follows, but there's surely a more elegant solution to be had.

module Highrise
  class Deal
    def encode_with_nested_attribute_exclusion(options={})
      encode_without_nested_attribute_exclusion({:except => [:party, :parties]}.merge(options))
    end
    alias_method_chain :encode, :nested_attribute_exclusion
  end
end

company.save method returning false

Hi there!

The company and people objects have "update" methods available through the Highrise API

I need to be able to add addresses to companies. I see there is a way to add tags and notes, but I don't see any current ways to add addresses. I also don't seem to be able to save the objects using ActiveResource's 'save' method.

Example of save not working :

company.name = 'Test Co'
=> "Test Co"
company.save
=> false

It would be awesome to have the ability to update those objects, and the ability to add addresses. I'll see if I can add them myself, but there's maybe something already available that I just can't see.

Unable to install highrise for Ruby 2.3.1 & Rails 5.0.0

Hi @tapajos & Team,

I'm working on upgrading Rails App from 4.2.8 to 5.0.0. Highrise is throwing error when I run 'bundle install'. If I comment this gem, I'm good to install rest of the gems and run application successfully. Here is my GEMFILE:

`source 'https://rubygems.org'
ruby "2.3.1"

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end

#-> Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '> 5.0.0'
gem 'mongoid-observers', '
> 0.3.0'
gem 'rails-observers', github: 'rails/rails-observers'
gem "bson"#, '~> 3.0'
gem "moped"#, git: 'https://github.com/mongoid/moped.git'

#-> Gems used only for assets and not required
#-> in production environments by default.
gem 'coffee-rails'#, '> 4.1.0'
gem 'zurb-foundation'#, '
> 2.2.0.2'
gem 'uglifier'#, '>= 1.0.3'

gem 'jquery-rails'#, '> 2.1.4'
#-> Use Redis adapter to run Action Cable in production
#-> gem 'redis', '
> 3.0'

#-> To use ActiveModel has_secure_password
#-> gem 'bcrypt-ruby', '~> 3.1.7'

#-> gem 'thin'
gem 'newrelic_rpm'
gem "mongoid"
gem 'mongoid-slug'
gem 'stripe'
gem 'stripe_event'
gem 'country_select'
gem 'mandrill-api'
gem 'gibbon'
gem 'honeybadger'
gem 'chronic'
gem 'highrise'
gem 'will_paginate'

#-> Use Puma as the app server
gem 'puma'
#-> gem 'sass-rails', github: "rails/sass-rails"
gem 'responders'

group :development do
gem 'rb-fsevent'#, '> 0.9.1'
gem 'guard'
gem 'guard-rspec'
#-> gem 'guard-cucumber'
gem 'guard-spork'
gem 'forward' # use this to test https
gem 'foreman'
gem 'byebug', platforms: :mri
#-> Adds support for Capybara system testing and selenium driver
gem 'capybara', '
> 2.13.0'
gem 'selenium-webdriver'
#-> gem 'capistrano-rails'
#-> Spring speeds up development by keeping your application running in the background.
#-> Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'

#-> Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
end

group :development, :test do
gem 'fabrication'
gem "factory_girl_rails"#, ">= 4.1.0"
gem 'rspec-rails'#, ">= 2.14.0"
gem 'mongoid-rspec'
gem 'spork'
gem 'fuubar'
end

#->Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

#->gem 'canvas', path: '../canvas'
gem 'canvas', :git => "https://github.com/jfranz/canvas.git"`

When I run bundle install, I get this:

`Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies..................................................................................................................................................................................................................................................................................................................................................................................................................................
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (= 5.0.2)

In Gemfile:
highrise was resolved to 1.0.2, which depends on
activeresource (>= 2.1) was resolved to 2.1.0, which depends on
activesupport (= 2.1.0)

factory_girl_rails was resolved to 4.8.0, which depends on
  factory_girl (~> 4.8.0) was resolved to 4.8.0, which depends on
    activesupport (>= 3.0.0)

rails (~> 5.0.0) was resolved to 5.0.2, which depends on
  activejob (= 5.0.2) was resolved to 5.0.2, which depends on
    globalid (>= 0.3.6) was resolved to 0.3.7, which depends on
      activesupport (>= 4.1.0)

highrise was resolved to 1.0.2, which depends on
  activesupport (>= 2.1)

mongoid-slug was resolved to 5.3.0, which depends on
  mongoid-compatibility was resolved to 0.4.1, which depends on
    activesupport

rspec-rails was resolved to 3.5.2, which depends on
  actionpack (>= 3.0) was resolved to 5.0.2, which depends on
    rails-dom-testing (~> 2.0) was resolved to 2.0.2, which depends on
      activesupport (< 6.0, >= 4.2.0)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

jquery-rails was resolved to 4.3.1, which depends on
  railties (>= 4.2.0) was resolved to 5.0.2, which depends on
    activesupport (= 5.0.2)

rspec-rails was resolved to 3.5.2, which depends on
  activesupport (>= 3.0)

spring was resolved to 2.0.1, which depends on
  activesupport (>= 4.2)

rails (~> 5.0.0) was resolved to 5.0.2, which depends on
  sprockets-rails (>= 2.0.0) was resolved to 3.2.0, which depends on
    activesupport (>= 4.0)

stripe_event was resolved to 1.6.0, which depends on
  activesupport (>= 3.1)

Running bundle update will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

I tried running bundle update as well but in vain. Please help me out as this is somewhat urgent task.

Waiting for your response.

Thanks,
Adeel

New caching seems problematic with memory store

Set your site as normal:

Highrise::Base.site = "https://[email protected]"

Set your cache to use the memory store

Highrise::Base.connection.cache_store = ActiveSupport::Cache.lookup_store :memory_store

try to load tags

@tags = Highrise::Tag.find(:all)

TypeError: can't modify frozen array
from /Library/Ruby/Gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:662:in collect!' from /Library/Ruby/Gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:662:ininstantiate_collection'
from /Library/Ruby/Gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:639:in find_every' from /Library/Ruby/Gems/1.8/gems/activeresource-2.3.5/lib/active_resource/base.rb:582:infind'
from (irb):2

Taggable method "tags" returning a 404 error

when calling the ".tags" method on a company object, my app crashes and returns a 404 error.

this is done in a loop running over a bunch of companies. I suspect that maybe one of those companies have either no tags or have a tag that might have been deleted... However, I think that this should be handled when calling the self.get(:tags) in the Taggable object instead of crashing...

What do you think is happening here? What should I look to? Do you think that the "tag deleted" scenario has a good chance to be the source of the problem here? Have anyone had the same issue? Thanks!!!!

Unable to include highrise in a Rails project

I'm attempting to use Highrise in a vanilla Rails 4.1 project. I've added gem "highrise" to my Gemfile and installed the gem with bundle install. Then I added the following to config/initializers/highrise.rb:

Highrise::Base.site = Figaro.env.highrise_site!
Highrise::Base.user = Figaro.env.highrise_authentication_token!
Highrise::Base.format = :xml

When I try to run spring rails s, I get the following error:

/Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb
:247:in `require': cannot load such file -- highrise/subject_data (LoadError)
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/de
pendencies.rb:247:in `block in require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/de
pendencies.rb:232:in `load_dependency'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/de
pendencies.rb:247:in `require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/highrise-3.2.0/lib/highrise.rb:23:in `<to
p (required)>'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:i
n `require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:i
n `block (2 levels) in require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:i
n `each'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:i
n `block in require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:i
n `each'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
        from /Users/landonschropp/Development/surf_receptionist/config/application.rb:7:in `<top (required)>'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/command
s_tasks.rb:79:in `require'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/command
s_tasks.rb:79:in `block in server'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/command
s_tasks.rb:76:in `tap'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/command
s_tasks.rb:76:in `server'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/command
s_tasks.rb:40:in `run_command!'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/commands.rb:17:i
n `<top (required)>'
        from /Users/landonschropp/Development/surf_receptionist/bin/rails:8:in `require'
        from /Users/landonschropp/Development/surf_receptionist/bin/rails:8:in `<top (required)>'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.2/lib/spring/client/rails.rb:2
7:in `load'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.2/lib/spring/client/rails.rb:2
7:in `call'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.2/lib/spring/client/command.rb
:7:in `call'
 from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/bin/spring:23:in `load'
        from /Users/landonschropp/.rbenv/versions/2.0.0-p247/bin/spring:23:in `<main>'

Please replace email_id with id in Highrise::Emails.comments

Should be id instead of email_id

Comment.find(:all, :from => "/emails/#{id}/comments.xml") - correct
Comment.find(:all, :from => "/emails/#{email_id}/comments.xml") - wrong

module Highrise
  class Email < Base
    include Pagination

    def comments
      Comment.find(:all, :from => "/emails/#{email_id}/comments.xml")
    end
  end
end
opt/local/lib/ruby/gems/1.8/gems/activeresource-3.0.10/lib/active_resource/base.rb:1401:in `method_missing': undefined local variable or method `email_id' for #<Highrise::Email:0x1027237d0> (NameError)
    from /opt/local/lib/ruby/gems/1.8/gems/highrise-3.0.0/lib/highrise/email.rb:6:in `comments'

Saving a person with an email

I think I am just being really stupid...but

In console I am doing:

person = Highrise::Person.create(:name => "charlie")

Which saves fine, but if I do something like

person = Highrise::Person.create(:name => "charlie", :email => "[email protected]")

then I get:

Unprocessable Entity

I can not get my head around this, I essentially want to add a full record:

person = Highrise::Person.create(:name => "charlie", :params => {:contact_data => {:email_addresses => "[email protected]"}})

but still i get the same error and can not find any examples online

I have also tried:
person = Highrise::Person
person.name = "charlie"
person.save

that works

but when I do...
person = Highrise::Person
person.email = "[email protected]"
person.save

I get a false...

Can someone help me?

Cannot get more than 500 deals at a time

How do I grab more than 500 deals at a time. I seem to be hitting a limit, and am not sure how to get the next lot of deals. I am using .find(:all) but this simply results in the same 500 records being returned.

Impossible to create an address for a company

I need to create an entry in the company.contact_data.addresses list, and I don't see how this can be currently achieved.

We can add notes, tasks, tags, but no addresses... Is this something that is already possible and that I simply cannot find? Or is this really a missing option?

Thanks a lot!

Populating person contact-data fields

Hello,

In /lib/highrise/person.rb I see fields for company, name, address, web_address, and label, which I'm using like this:

@highriser = Highrise::Person.new(:name => @profile.get_name)

Is it possible to pass in attributes to populate the fields in Highrise's 'contact-data' element, like 'web-addresses', 'email-addresses', and 'twitter-accounts'?

Best,
John

Saving a Deal

deal = Highrise::Deal.find 2137365

then deal.save
returns false

hows that??

So i though maybe something has to changed so

deal.background = "example"
deal.save
returns false

Person.tags doesn't always return a Highrise::Tag array

The current tags implementation (in taggable) uses get(:tags) which returns a Hash and not a Highrise::Tag. This causes trouble when adding tags and retrieving them later.

There are probably two solutions:

  1. Pass the Hash to a create of the Highrise::Tag and return that (ugly)
  2. Do a find instead of a get, so that the Hash gets recordized.

Other ideas welcome :) Fixed it locally but it breaks the taggable behavior as defined by the current specs, so will need more work before doing a PR

Slow response from HighRise API

Hi, I'm using your plugin to try to find all people with a particular last name:

@people = Highrise::Person.find_by_last_name(params[:last_name])

The search works, but takes about 5 minutes to respond. Our HighRise
account has about 5,000 contacts.

When I raised this issue with 37 signals, they suggested the problem was with the plugin, not the API. I find this unlikely as a test on a smaller HighRise account using the same plugin produced near instant responses. Do you have any idea what the issue could be?

Thanks

Set site/user fields in a thread safe manner?

Hi Tapajos,

I am building my first sinatra app that will use highrise gem to access highrise data. The example code to use this gem from the wiki

require 'highrise'

Highrise::Base.site = 'https://your_site.highrisehq.com'
Highrise::Base.user = 'api-auth-token'

But I want to change user and site field for every request. Because each request can be for a different user. Currently these are class variables. Even if I set these fields for every request, wouldn't this cause race conditions when there are multiple requests in a multi threading scenario? This might not even be a question specific to your gem, its more of an active resource related question. Could you suggest what are the best practices around setting user/site fields for every request in a threadsafe manner?

Add data to a customer field for new record

Hi,

First of all, thanks for your work on the gem, it's very helpful.

I'm trying to add data into a custom filed in a new record, but am unable to.

contact = Highrise::Person.new
contact.first_name = "John"
contact.last_name = "Doe"
contact.save!

First, I save the person once, as the person will then have a Highrise::Person::ContactData instance associated with it, which will allow me to add phone numbers, addresses, etc. to the person. (I was unable to add a new Person with a phone number before figuring out this workaround).

However, I'm unable to get access to the subject_datas array for a new field (even after the save trick used above). I get the following error

/home/david/.rvm/gems/ruby-1.9.3-p0/gems/activeresource-3.2.1/lib/active_resource/base.rb:1471:in method_missing': undefined methodsubject_datas' for #Highrise::Person:0x9c64c84 (NoMethodError)

If I retrieve an existing record that already data in a custom field, I'm able to change and save the data without any problems.

How can I save data into custom fields when creating a new person ?

Monkey-patching

Here's the monkey patching I had to do to make my code work. The whole thing is at https://www.dropbox.com/sh/hckqzeeexk0l4sa/84W-DzCLRz/programming/ruby_highrise_api.md

module Highrise
class Person
class SubjectData < Subject
include Pagination
include Taggable
include Searchable
end
end
end

module Highrise
class CustomField < Subject
include Pagination
include Taggable
include Searchable

self.element_name = 'subject_fields'

def label
  @attributes['label']
end

def id
  @attributes['id']
end

def custom_field_label
  @attributes['label']
end

def custom_field_id
  @attributes['id']
end

def to_hash
  { :label => @attributes['label'], :id => @attributes['id'] }
end

end
end

ActiveResource 3.1 and default format

ActiveResource 3.1 defaults to JSON format. This will cause 406 error responses from Highrise. You may want to add into the code, or add to the documentation that you needed to change the format to xml.

 Highrise::Base.format = :xml

gem version

Is the latest version of this gem published? This seems to say the version is 2.0.0 but gem install gets you 1.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.