Skip to content

Commit

Permalink
version 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Waldemar Kusnezow committed Nov 2, 2012
1 parent a974a45 commit a1b85d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/pipedrive/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def self.bad_response(response)
# @param [Hash] attributes
# @return [CloudApp::Base]
def initialize(attrs = {})
super( attrs['data'].is_a?(Hash) ? attrs['data'] : attrs['data'].first )
super( attrs['data'].is_a?(Hash) ? attrs['data'] : (attrs['data'].first unless attrs['data'].nil?) )
end

end
Expand Down
4 changes: 2 additions & 2 deletions lib/pipedrive/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def self.find(id)
end
end

def self.find_by_name(name)
res = get "/organizations/find?term=#{name}"
def self.find_by_name(opts = {})
res = get "/organizations/find", :query => opts
if res.ok?
Organization.new(res)
else
Expand Down
9 changes: 9 additions & 0 deletions lib/pipedrive/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ def self.find(id)
end
end

def self.find_by_name(opts = {})
res = get "/persons/find", :query => opts
if res.ok?
Person.new(res)
else
bad_response(res)
end
end

end

end

0 comments on commit a1b85d5

Please sign in to comment.