peterosullivan-highrise 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ##whats in this fork
1
+ ##Whats in this fork
2
2
 
3
3
  This fork is very close to the orginal gem. I have added a few features and shortcut methods;
4
4
 
@@ -7,9 +7,19 @@ This fork is very close to the orginal gem. I have added a few features and shor
7
7
 
8
8
  Highrise::Person.url_for(123)
9
9
  Highrise::Person.find(123).tagged?('tag_name')
10
+ Highrise::Person.find(123).tagged_with_name('tag_name')
10
11
  Highrise::Person.find(123).email_address
11
12
  Highrise::Person.find(123).email_valid?
12
13
  Highrise::Person.find(123).phone_number
14
+
15
+ ###Highrise Custom Fields read only (called "subject_datas" in the Highrise API)
16
+
17
+ p = Highrise::Person.find(123)
18
+ p.subject_data_fields #{"favourite_color"=>"red"}
19
+ p.field("FavouriteColor") #<Highrise::SubjectData:0xb5e3442c @attributes={"subject_field_label"=>"FavouriteColor", "id"=>12065552, "value"=>"red", "subject_field_id"=>123}, @prefix_options={}>
20
+ p.favourite_color #"red"
21
+
22
+
13
23
 
14
24
  # Highrise (3.0.0) [![Build Status](https://secure.travis-ci.org/tapajos/highrise.png)](http://travis-ci.org/tapajos/highrise)
15
25
 
@@ -24,6 +34,9 @@ All these classes are inherited from ActiveResouce::Base. Refer to the [ActiveRe
24
34
  ## Installing
25
35
 
26
36
  gem install peterosullivan-highrise
37
+
38
+ ## Gemfile
39
+ gem 'peterosullivan-highrise', :require => 'highrise'
27
40
 
28
41
  ### Dependencies (see <code>highrise.gemspec</code> or run <code>bundle check</code>)
29
42
 
data/highrise.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.summary = %q{Ruby wrapper around Highrise API}
23
23
  s.description = <<-EOT
24
24
  Based on the original API module from DHH, http://developer.37signals.com/highrise/, this
25
- gem is a cleaned up, tested version of the same. A fork of Tapaj gem. See the homepage for add features.
25
+ gem is a cleaned up, tested version of the same. A fork of Tapaj gem. See the homepage for added features.
26
26
 
27
27
  Configure by adding the following:
28
28
 
data/lib/highrise/base.rb CHANGED
@@ -3,6 +3,8 @@ require 'active_resource'
3
3
  module Highrise
4
4
  class Base < ActiveResource::Base
5
5
 
6
+ self.format = :xml #Higrise API only works with xml and not JSON
7
+
6
8
  def self.url_for(n)
7
9
  base = site.to_s.split('@')[1]
8
10
  File.join('https://', base, element_path(n)).gsub(".xml",'')
@@ -4,6 +4,12 @@ module Highrise
4
4
  include Pagination
5
5
  include Taggable
6
6
  include Searchable
7
+ include SubjectData::Mixin
8
+
9
+ def initialize(*args)
10
+ super(*args)
11
+ create_subject_fields_accessors
12
+ end
7
13
 
8
14
  def company
9
15
  Company.find(company_id) if company_id
@@ -40,6 +46,18 @@ module Highrise
40
46
  def tagged? name
41
47
  tags.any?{ | tag | tag['name'].to_s == name}
42
48
  end
49
+ alias :tagged_with_name :tagged?
50
+
51
+ def create_subject_fields_accessors
52
+ subject_data_fields.each do |subject_field_name, value|
53
+ # for this instance only
54
+ singleton_class.instance_eval do
55
+ define_method subject_field_name do
56
+ value
57
+ end
58
+ end
59
+ end
60
+ end
43
61
 
44
62
  end
45
63
  end
@@ -28,4 +28,4 @@ module Highrise
28
28
  self.class.name.split('::').last
29
29
  end
30
30
  end
31
- end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Highrise
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
data/lib/highrise.rb CHANGED
@@ -2,6 +2,7 @@ require 'highrise/base'
2
2
  require 'highrise/pagination'
3
3
  require 'highrise/taggable'
4
4
  require 'highrise/searchable'
5
+ require 'highrise/subject_data'
5
6
  require 'highrise/subject'
6
7
  require 'highrise/comment'
7
8
  require 'highrise/company'
@@ -20,3 +21,4 @@ require 'highrise/deal_category'
20
21
  require 'highrise/task_category'
21
22
  require 'highrise/party'
22
23
  require 'highrise/recording'
24
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peterosullivan-highrise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 2
10
- version: 3.0.2
9
+ - 3
10
+ version: 3.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Marcos Tapaj\xC3\xB3s"
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-09-21 00:00:00 +10:00
20
+ date: 2011-09-22 00:00:00 +10:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: 0.8.7
68
68
  type: :development
69
69
  version_requirements: *id003
70
- description: " Based on the original API module from DHH, http://developer.37signals.com/highrise/, this\n gem is a cleaned up, tested version of the same. A fork of Tapaj gem. See the homepage for add features.\n\n Configure by adding the following:\n\n require 'highrise'\n Highrise::Base.site = 'http://your_site.highrisehq.com/'\n Highrise::Base.user = 'your_api_auth_token'\n"
70
+ description: " Based on the original API module from DHH, http://developer.37signals.com/highrise/, this\n gem is a cleaned up, tested version of the same. A fork of Tapaj gem. See the homepage for added features.\n\n Configure by adding the following:\n\n require 'highrise'\n Highrise::Base.site = 'http://your_site.highrisehq.com/'\n Highrise::Base.user = 'your_api_auth_token'\n"
71
71
  email:
72
72
  - marcos@tapajos.me
73
73
  - kmayer@bitwrangler.com