Skip to content
This repository was archived by the owner on Apr 26, 2018. It is now read-only.

Fixes for activeresource 3.1 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions lib/batchbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
#
module BatchBook
VERSION = '1.0.4'
VERSION = '1.0.5'

class Error < StandardError; end
class << self
Expand Down Expand Up @@ -59,8 +59,9 @@ class << base
attr_accessor :site_format
end
base.site_format = '%s'
self.format = ActiveResource::Formats::XmlFormat
super
end
end
end

class Activities < Base
Expand All @@ -75,6 +76,7 @@ class Affiliation < Base

end


class Person < Base
#http://developer.batchblue.com/people.html
def tags
Expand Down Expand Up @@ -107,7 +109,16 @@ def location label
# location[country] Country
def add_location(params = {})
params.update(:label => 'home') unless params[:label].present?
self.post(:locations, :location => params)

location = Location.new(params)
location.person = self
location.save
end

class Location < Base
def person=(person)
self.prefix_options[:person_id] = person.id
end
end

def supertags
Expand Down Expand Up @@ -368,7 +379,13 @@ def comment(id)
end

class Comment < Base

def initialize(attributes = {})
if(attributes[:comment])
attributes[:comment] = {:comment => attributes[:comment]}
end
super(attributes)
end

def communication
Communication.find(self.prefix_options[:communication_id])
end
Expand Down Expand Up @@ -416,7 +433,6 @@ def todo
def todo=(todo)
self.prefix_options[:todo_id] = todo.id
end

end

class List < Base
Expand Down Expand Up @@ -445,7 +461,6 @@ class User < Base

end
end

__END__

require 'batchbook'
Expand Down