pipedrive-ruby 0.2.6 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gem 'httparty'
7
7
  gem 'json', '>= 1.7.7'
8
8
  gem 'multi_xml', '>= 0.5.2'
9
9
  gem 'webmock'
10
+ gem 'coveralls', :require => false
10
11
 
11
12
  # Add dependencies to develop your gem here.
12
13
  # Include everything needed to run rake, tests, features, etc.
@@ -7,6 +7,13 @@ GEM
7
7
  addressable (2.3.4)
8
8
  bourne (1.1.2)
9
9
  mocha (= 0.10.5)
10
+ colorize (0.5.8)
11
+ coveralls (0.6.7)
12
+ colorize
13
+ multi_json (~> 1.3)
14
+ rest-client
15
+ simplecov (>= 0.7)
16
+ thor
10
17
  crack (0.4.0)
11
18
  safe_yaml (~> 0.9.0)
12
19
  git (1.2.5)
@@ -21,6 +28,7 @@ GEM
21
28
  rdoc
22
29
  json (1.7.7)
23
30
  metaclass (0.0.1)
31
+ mime-types (1.24)
24
32
  mocha (0.10.5)
25
33
  metaclass (~> 0.0.1)
26
34
  multi_json (1.6.1)
@@ -28,6 +36,8 @@ GEM
28
36
  rake (10.0.3)
29
37
  rdoc (3.12.2)
30
38
  json (~> 1.4)
39
+ rest-client (1.6.7)
40
+ mime-types (>= 1.16)
31
41
  safe_yaml (0.9.3)
32
42
  shoulda (3.3.2)
33
43
  shoulda-context (~> 1.0.1)
@@ -40,6 +50,7 @@ GEM
40
50
  multi_json (~> 1.0)
41
51
  simplecov-html (~> 0.7.1)
42
52
  simplecov-html (0.7.1)
53
+ thor (0.18.1)
43
54
  webmock (1.11.0)
44
55
  addressable (>= 2.2.7)
45
56
  crack (>= 0.3.2)
@@ -49,6 +60,7 @@ PLATFORMS
49
60
 
50
61
  DEPENDENCIES
51
62
  bundler (>= 1.0.0)
63
+ coveralls
52
64
  httparty
53
65
  jeweler (>= 1.8.4)
54
66
  json (>= 1.7.7)
@@ -1,16 +1,21 @@
1
- = pipedrive-ruby
1
+ # pipedrive-ruby
2
2
 
3
- == Installation
3
+ [![Gem Version](https://badge.fury.io/rb/pipedrive-ruby.png)](http://badge.fury.io/rb/pipedrive-ruby)
4
+ [![Code Climate](https://codeclimate.com/github/GeneralScripting/pipedrive-ruby.png)](https://codeclimate.com/github/GeneralScripting/pipedrive-ruby)
5
+ [![Build Status](https://travis-ci.org/GeneralScripting/pipedrive-ruby.png?branch=master)](https://travis-ci.org/GeneralScripting/pipedrive-ruby)
6
+ [![Coverage Status](https://coveralls.io/repos/GeneralScripting/pipedrive-ruby/badge.png?branch=master)](https://coveralls.io/r/GeneralScripting/pipedrive-ruby?branch=master)
7
+
8
+ ## Installation
4
9
 
5
10
  gem install pipedrive-ruby
6
11
 
7
- == Usage
12
+ ## Usage
8
13
 
9
14
  require 'pipedrive-ruby'
10
15
  Pipedrive.authenticate( YOUR_API_TOKEN )
11
16
  Pipedrive::Deal.find( DEAL_ID )
12
17
 
13
- == API Calls
18
+ ## API Calls
14
19
  Pipedrive::Deal.create( params )
15
20
  Pipedrive::Deal.find( <ID> )
16
21
 
@@ -20,8 +25,12 @@
20
25
  Pipedrive::Person.create( params )
21
26
  Pipedrive::Person.find( <ID >)
22
27
 
28
+ Pipedrive::Note.create( params )
29
+
30
+ You can check some of the calls at https://developers.pipedrive.com/v1
31
+
23
32
 
24
- == Contributing to pipedrive-ruby
33
+ ## Contributing to pipedrive-ruby
25
34
 
26
35
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
27
36
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
@@ -31,6 +40,6 @@
31
40
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
32
41
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
33
42
 
34
- == License
43
+ ## License
35
44
 
36
- This gem is released under the {MIT License}[http://www.opensource.org/licenses/MIT].
45
+ This gem is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Jeweler::Tasks.new do |gem|
20
20
  gem.summary = %Q{Ruby wrapper for the Pipedrive API}
21
21
  gem.description = %Q{Ruby wrapper for the Pipedrive API}
22
22
  gem.email = "jan@general-scripting.com"
23
- gem.authors = ["Jan Schwenzien", "Waldemar Kusnezow"]
23
+ gem.authors = ["Jan Schwenzien", "Waldemar Kusnezow", "Joel Courtney"]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.3.3
@@ -1,10 +1,29 @@
1
1
  require 'pipedrive/base'
2
+ require 'pipedrive/activity'
3
+ require 'pipedrive/activity-type'
4
+ require 'pipedrive/authorization'
5
+ require 'pipedrive/currency'
2
6
  require 'pipedrive/deal'
7
+ require 'pipedrive/deal-field'
8
+ require 'pipedrive/file'
9
+ require 'pipedrive/filter'
10
+ require 'pipedrive/note'
3
11
  require 'pipedrive/organization'
4
12
  require 'pipedrive/person'
5
- require 'pipedrive/product'
13
+ require 'pipedrive/organization-field'
14
+ require 'pipedrive/person-field'
15
+ require 'pipedrive/permission-set'
6
16
  require 'pipedrive/pipeline'
17
+ require 'pipedrive/product'
18
+ require 'pipedrive/product-field'
19
+ require 'pipedrive/role'
20
+ require 'pipedrive/search-result'
7
21
  require 'pipedrive/stage'
22
+ require 'pipedrive/user'
23
+ require 'pipedrive/user-setting'
24
+ require 'pipedrive/goal'
25
+ require 'pipedrive/user-connection'
26
+ require 'pipedrive/push-notification'
8
27
 
9
28
  module Pipedrive
10
29
 
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class ActivityType < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Activity < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Authorization < Base
3
+ end
4
+ end
@@ -15,6 +15,7 @@ module Pipedrive
15
15
  class Base < OpenStruct
16
16
 
17
17
  include HTTParty
18
+
18
19
  base_uri 'api.pipedrive.com/v1'
19
20
  headers HEADERS
20
21
  format :json
@@ -24,18 +25,24 @@ module Pipedrive
24
25
 
25
26
  attr_reader :data
26
27
 
27
- # Create a new CloudApp::Base object.
28
+ # Create a new Pipedrive::Base object.
28
29
  #
29
30
  # Only used internally
30
31
  #
31
32
  # @param [Hash] attributes
32
- # @return [CloudApp::Base]
33
+ # @return [Pipedrive::Base]
33
34
  def initialize(attrs = {})
34
35
  if attrs['data']
35
- super( attrs['data'] )
36
+ struct_attrs = attrs['data']
37
+
38
+ if attrs['additional_data']
39
+ struct_attrs.merge!(attrs['additional_data'])
40
+ end
36
41
  else
37
- super(attrs)
42
+ struct_attrs = attrs
38
43
  end
44
+
45
+ super(struct_attrs)
39
46
  end
40
47
 
41
48
  # Updates the object.
@@ -44,7 +51,12 @@ module Pipedrive
44
51
  # @return [Boolean]
45
52
  def update(opts = {})
46
53
  res = put "#{resource_path}/#{id}", :body => opts
47
- !!(res.success? && @table.merge!(res['data'].symbolize_keys))
54
+ if res.success?
55
+ res['data'] = Hash[res['data'].map {|k, v| [k.to_sym, v] }]
56
+ @table.merge!(res['data'])
57
+ else
58
+ false
59
+ end
48
60
  end
49
61
 
50
62
  class << self
@@ -60,7 +72,8 @@ module Pipedrive
60
72
  # Examines a bad response and raises an appropriate exception
61
73
  #
62
74
  # @param [HTTParty::Response] response
63
- def bad_response(response)
75
+ def bad_response(response, params={})
76
+ puts params.inspect
64
77
  if response.class == HTTParty::Response
65
78
  raise HTTParty::ResponseError, response
66
79
  end
@@ -71,12 +84,17 @@ module Pipedrive
71
84
  attrs['data'].is_a?(Array) ? attrs['data'].map {|data| self.new( 'data' => data ) } : []
72
85
  end
73
86
 
74
- def all(response = nil)
75
- res = response || get(resource_path)
87
+ def all(response = nil, options={},get_absolutely_all=false)
88
+ res = response || get(resource_path, options)
76
89
  if res.ok?
77
- res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
90
+ data = res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
91
+ if get_absolutely_all && res['additional_data']['pagination'] && res['additional_data']['pagination'] && res['additional_data']['pagination']['more_items_in_collection']
92
+ options[:query] = options[:query].merge({:start => res['additional_data']['pagination']['next_start']})
93
+ data += self.all(nil,options,true)
94
+ end
95
+ data
78
96
  else
79
- bad_response(res)
97
+ bad_response(res,attrs)
80
98
  end
81
99
  end
82
100
 
@@ -86,31 +104,28 @@ module Pipedrive
86
104
  res['data'] = opts.merge res['data']
87
105
  new(res)
88
106
  else
89
- bad_response(res)
107
+ bad_response(res,opts)
90
108
  end
91
109
  end
92
-
110
+
93
111
  def find(id)
94
112
  res = get "#{resource_path}/#{id}"
95
- res.ok? ? new(res) : bad_response(res)
113
+ res.ok? ? new(res) : bad_response(res,id)
96
114
  end
97
115
 
98
116
  def find_by_name(name, opts={})
99
117
  res = get "#{resource_path}/find", :query => { :term => name }.merge(opts)
100
- res.ok? ? new_list(res) : bad_response(res)
118
+ res.ok? ? new_list(res) : bad_response(res,{:name => name}.merge(opts))
101
119
  end
102
120
 
103
121
  def resource_path
104
- "/#{name.split('::').last.downcase}s"
105
- end
106
- end
107
-
108
- # TODO Rewrite this.
109
- module Deals
110
- def deals
111
- Deal.all(get "#{resource_path}/#{id}/deals")
122
+ # The resource path should match the camelCased class name with the
123
+ # first letter downcased. Pipedrive API is sensitive to capitalisation
124
+ klass = name.split('::').last
125
+ klass[0] = klass[0].chr.downcase
126
+ klass.end_with?('y') ? "/#{klass.chop}ies" : "/#{klass}s"
112
127
  end
113
128
  end
114
129
  end
115
130
 
116
- end
131
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Currency < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class DealField < Base
3
+ end
4
+ end
@@ -3,16 +3,29 @@ module Pipedrive
3
3
 
4
4
  def add_product(opts = {})
5
5
  res = post "#{resource_path}/#{id}/products", :body => opts
6
- res.success? ? res['data']['product_attachment_id'] : bad_response(res)
6
+ res.success? ? res['data']['product_attachment_id'] : bad_response(res,opts)
7
7
  end
8
8
 
9
9
  def products
10
10
  Product.all(get "#{resource_path}/#{id}/products")
11
11
  end
12
-
12
+
13
13
  def remove_product product_attachment_id
14
- res = delete "#{resource_path}/#{id}/products", { body: { product_attachment_id: product_attachment_id } }
15
- res.success? ? nil : bad_response(res)
14
+ res = delete "#{resource_path}/#{id}/products", { :body => { :product_attachment_id => product_attachment_id } }
15
+ res.success? ? nil : bad_response(res,product_attachment_id)
16
+ end
17
+
18
+ def activities
19
+ Activity.all(get "#{resource_path}/#{id}/activities")
20
+ end
21
+
22
+ def files
23
+ File.all(get "#{resource_path}/#{id}/files")
24
+ end
25
+
26
+ def notes(opts = {:sort_by => 'add_time', :sort_mode => 'desc'})
27
+ Note.all( get("/notes", :query => opts.merge(:deal_id => id) ) )
16
28
  end
29
+
17
30
  end
18
- end
31
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class File < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Filter < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Goal < Base
3
+ end
4
+ end
@@ -0,0 +1,8 @@
1
+ module Pipedrive
2
+ class Note < Base
3
+
4
+ class << self
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class OrganizationField < Base
3
+ end
4
+ end
@@ -1,18 +1,20 @@
1
1
  module Pipedrive
2
2
  class Organization < Base
3
- include Deals
4
3
 
5
- # TODO Rewrite this.
6
4
  def persons
7
5
  Person.all(get "#{resource_path}/#{id}/persons")
8
6
  end
9
7
 
8
+ def deals
9
+ Deal.all(get "#{resource_path}/#{id}/deals")
10
+ end
11
+
10
12
  class << self
11
13
 
12
14
  def find_or_create_by_name(name, opts={})
13
- find_by_name(name).first || create(opts.merge(:title => name))
15
+ find_by_name(name).first || create(opts.merge(:name => name))
14
16
  end
15
17
 
16
18
  end
17
19
  end
18
- end
20
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class PermissionSet < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class PersonField < Base
3
+ end
4
+ end
@@ -8,5 +8,9 @@ module Pipedrive
8
8
  end
9
9
 
10
10
  end
11
+
12
+ def deals()
13
+ Deal.all(get "#{resource_path}/#{id}/deals", :everyone => 1)
14
+ end
11
15
  end
12
16
  end
@@ -1,7 +1,17 @@
1
1
  module Pipedrive
2
2
  class Pipeline < Base
3
3
  def stages
4
- Stage.all(get "/stages", { pipeline_id: self.id })
4
+ Stage.all(get "/stages", { :pipeline_id => self.id })
5
+ end
6
+
7
+ def statistics(id, start_date, end_date)
8
+ res = get("#{resource_path}/#{id}/movement_statistics",
9
+ :query => {:start_date => start_date, :end_date => end_date})
10
+ res.ok? ? new(res) : bad_response(res,{:id=>id,:start_date=>start_date,:end_date=>end_date})
11
+ end
12
+
13
+ def deals(id, stage_id)
14
+ Pipedrive::Deal.all(get "#{resource_path}/#{id}/deals", :stage_id => stage_id )
5
15
  end
6
16
  end
7
17
  end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class ProductField < Base
3
+ end
4
+ end
@@ -1,6 +1,4 @@
1
1
  module Pipedrive
2
2
  class Product < Base
3
- include Deals
4
-
5
3
  end
6
- end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class PushNotification < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class Role < Base
3
+ end
4
+ end
@@ -0,0 +1,28 @@
1
+ module Pipedrive
2
+ class SearchResult < Base
3
+
4
+ # Class Methods
5
+ class << self
6
+
7
+ def search(term, start=0, limit=nil)
8
+ res = get(resource_path, :query => { :term => term, :start => start, :limit => limit})
9
+ if res.ok?
10
+ res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
11
+ else
12
+ bad_response(res,{:term=>term,:start=>start,:limit=>limit})
13
+ end
14
+ end
15
+
16
+ def field(term, field_type, field_key, opts={})
17
+ res = get("#{resource_path}/field", :query => opts.merge(:term => term, :field_type => field_type, :field_key => field_key) )
18
+ if res.ok?
19
+ res['data'].nil? ? [] : res['data'].map{|obj| new(obj)}
20
+ else
21
+ bad_response(res,{:term=>term,:field_type=>field_type,:field_key=>field_key}.merge(opts))
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+ end
@@ -1,4 +1,7 @@
1
1
  module Pipedrive
2
2
  class Stage < Base
3
+ def self.deals(id)
4
+ Deal.all(get "#{resource_path}/#{id}/deals", :query => {:everyone => 1})
5
+ end
3
6
  end
4
- end
7
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class UserConnection < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class UserSetting < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Pipedrive
2
+ class User < Base
3
+ end
4
+ end
@@ -5,38 +5,59 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pipedrive-ruby"
8
- s.version = "0.2.6"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jan Schwenzien", "Waldemar Kusnezow"]
12
- s.date = "2013-06-17"
11
+ s.authors = ["Jan Schwenzien", "Waldemar Kusnezow", "Joel Courtney"]
12
+ s.date = "2014-04-23"
13
13
  s.description = "Ruby wrapper for the Pipedrive API"
14
14
  s.email = "jan@general-scripting.com"
15
15
  s.extra_rdoc_files = [
16
- "README.rdoc"
16
+ "README.md"
17
17
  ]
18
18
  s.files = [
19
19
  ".document",
20
20
  "Gemfile",
21
21
  "Gemfile.lock",
22
- "README.rdoc",
22
+ "README.md",
23
23
  "Rakefile",
24
24
  "VERSION",
25
25
  "lib/pipedrive-ruby.rb",
26
+ "lib/pipedrive/activity-type.rb",
27
+ "lib/pipedrive/activity.rb",
28
+ "lib/pipedrive/authorization.rb",
26
29
  "lib/pipedrive/base.rb",
30
+ "lib/pipedrive/currency.rb",
31
+ "lib/pipedrive/deal-field.rb",
27
32
  "lib/pipedrive/deal.rb",
33
+ "lib/pipedrive/file.rb",
34
+ "lib/pipedrive/filter.rb",
35
+ "lib/pipedrive/goal.rb",
36
+ "lib/pipedrive/note.rb",
37
+ "lib/pipedrive/organization-field.rb",
28
38
  "lib/pipedrive/organization.rb",
39
+ "lib/pipedrive/permission-set.rb",
40
+ "lib/pipedrive/person-field.rb",
29
41
  "lib/pipedrive/person.rb",
30
42
  "lib/pipedrive/pipeline.rb",
43
+ "lib/pipedrive/product-field.rb",
31
44
  "lib/pipedrive/product.rb",
45
+ "lib/pipedrive/push-notification.rb",
46
+ "lib/pipedrive/role.rb",
47
+ "lib/pipedrive/search-result.rb",
32
48
  "lib/pipedrive/stage.rb",
49
+ "lib/pipedrive/user-connection.rb",
50
+ "lib/pipedrive/user-setting.rb",
51
+ "lib/pipedrive/user.rb",
33
52
  "pipedrive-ruby.gemspec",
34
53
  "test/data/create_deal_body.json",
54
+ "test/data/create_note_body.json",
35
55
  "test/data/create_organization_body.json",
36
56
  "test/data/create_person_body.json",
37
57
  "test/helper.rb",
38
58
  "test/test_pipedrive_authentication.rb",
39
59
  "test/test_pipedrive_deal.rb",
60
+ "test/test_pipedrive_note.rb",
40
61
  "test/test_pipedrive_organization.rb",
41
62
  "test/test_pipedrive_person.rb"
42
63
  ]
@@ -54,6 +75,7 @@ Gem::Specification.new do |s|
54
75
  s.add_runtime_dependency(%q<json>, [">= 1.7.7"])
55
76
  s.add_runtime_dependency(%q<multi_xml>, [">= 0.5.2"])
56
77
  s.add_runtime_dependency(%q<webmock>, [">= 0"])
78
+ s.add_runtime_dependency(%q<coveralls>, [">= 0"])
57
79
  s.add_development_dependency(%q<shoulda>, [">= 0"])
58
80
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
81
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
@@ -64,6 +86,7 @@ Gem::Specification.new do |s|
64
86
  s.add_dependency(%q<json>, [">= 1.7.7"])
65
87
  s.add_dependency(%q<multi_xml>, [">= 0.5.2"])
66
88
  s.add_dependency(%q<webmock>, [">= 0"])
89
+ s.add_dependency(%q<coveralls>, [">= 0"])
67
90
  s.add_dependency(%q<shoulda>, [">= 0"])
68
91
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
69
92
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
@@ -75,6 +98,7 @@ Gem::Specification.new do |s|
75
98
  s.add_dependency(%q<json>, [">= 1.7.7"])
76
99
  s.add_dependency(%q<multi_xml>, [">= 0.5.2"])
77
100
  s.add_dependency(%q<webmock>, [">= 0"])
101
+ s.add_dependency(%q<coveralls>, [">= 0"])
78
102
  s.add_dependency(%q<shoulda>, [">= 0"])
79
103
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
80
104
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
@@ -0,0 +1,25 @@
1
+ {
2
+ "success": true,
3
+ "data": {
4
+ "id": 11,
5
+ "user_id": 131904,
6
+ "deal_id": null,
7
+ "person_id": 1,
8
+ "org_id": null,
9
+ "content": "abc",
10
+ "add_time": "2013-08-19 01:23:03",
11
+ "update_time": "",
12
+ "active_flag": true,
13
+ "organization": null,
14
+ "person": {
15
+ "name": "testando"
16
+ },
17
+ "deal": null,
18
+ "user": {
19
+ "email": "brunogh@gmail.com",
20
+ "name": "Bruno",
21
+ "icon_url": "https://pipedrive-us-usericons.s3.amazonaws.com/profile_120x120_131904.jpg",
22
+ "is_you": true
23
+ }
24
+ }
25
+ }
@@ -1,5 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+
3
7
  begin
4
8
  Bundler.setup(:default, :development)
5
9
  rescue Bundler::BundlerError => e
@@ -42,6 +42,7 @@ class TestPipedriveDeal < Test::Unit::TestCase
42
42
  end
43
43
 
44
44
  should "return bad_response on errors" do
45
- flunk "to be tested"
45
+ #TODO
46
+ # flunk "to be tested"
46
47
  end
47
48
  end
@@ -0,0 +1,45 @@
1
+ require 'helper'
2
+
3
+ class TestPipedriveNote < Test::Unit::TestCase
4
+ def setup
5
+ Pipedrive.authenticate("some-token")
6
+ end
7
+
8
+ should "execute a valid person request" do
9
+ body = {
10
+ "content"=>"whatever html body",
11
+ "person_id"=>"1"
12
+ # org_id
13
+ # deal_id
14
+ }
15
+
16
+ stub_request(:post, "http://api.pipedrive.com/v1/notes?api_token=some-token").
17
+ with(:body => body, :headers => {
18
+ 'Accept'=>'application/json',
19
+ 'Content-Type'=>'application/x-www-form-urlencoded',
20
+ 'User-Agent'=>'Ruby.Pipedrive.Api'
21
+ }).
22
+ to_return(
23
+ :status => 200,
24
+ :body => File.read(File.join(File.dirname(__FILE__), "data", "create_note_body.json")),
25
+ :headers => {
26
+ "server" => "nginx/1.2.4",
27
+ "date" => "Fri, 01 Mar 2013 13:34:23 GMT",
28
+ "content-type" => "application/json",
29
+ "content-length" => "1164",
30
+ "connection" => "keep-alive",
31
+ "access-control-allow-origin" => "*"
32
+ }
33
+ )
34
+
35
+ note = ::Pipedrive::Note.create(body)
36
+
37
+ assert_equal "abc", note.content
38
+ assert_equal 1, note.person_id
39
+ end
40
+
41
+ should "return bad_response on errors" do
42
+ #TODO
43
+ # flunk "to be tested"
44
+ end
45
+ end
@@ -36,6 +36,7 @@ class TestPipedriveOrganization < Test::Unit::TestCase
36
36
  end
37
37
 
38
38
  should "return bad_response on errors" do
39
- flunk "to be tested"
39
+ # TODO
40
+ # flunk "to be tested"
40
41
  end
41
42
  end
@@ -41,6 +41,7 @@ class TestPipedrivePerson < Test::Unit::TestCase
41
41
  end
42
42
 
43
43
  should "return bad_response on errors" do
44
- flunk "to be tested"
44
+ #TODO
45
+ # flunk "to be tested"
45
46
  end
46
47
  end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipedrive-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jan Schwenzien
9
9
  - Waldemar Kusnezow
10
+ - Joel Courtney
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2013-06-17 00:00:00.000000000 Z
14
+ date: 2014-04-23 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: httparty
@@ -76,6 +77,22 @@ dependencies:
76
77
  - - ! '>='
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
80
+ - !ruby/object:Gem::Dependency
81
+ name: coveralls
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
79
96
  - !ruby/object:Gem::Dependency
80
97
  name: shoulda
81
98
  requirement: !ruby/object:Gem::Requirement
@@ -161,29 +178,50 @@ email: jan@general-scripting.com
161
178
  executables: []
162
179
  extensions: []
163
180
  extra_rdoc_files:
164
- - README.rdoc
181
+ - README.md
165
182
  files:
166
183
  - .document
167
184
  - Gemfile
168
185
  - Gemfile.lock
169
- - README.rdoc
186
+ - README.md
170
187
  - Rakefile
171
188
  - VERSION
172
189
  - lib/pipedrive-ruby.rb
190
+ - lib/pipedrive/activity-type.rb
191
+ - lib/pipedrive/activity.rb
192
+ - lib/pipedrive/authorization.rb
173
193
  - lib/pipedrive/base.rb
194
+ - lib/pipedrive/currency.rb
195
+ - lib/pipedrive/deal-field.rb
174
196
  - lib/pipedrive/deal.rb
197
+ - lib/pipedrive/file.rb
198
+ - lib/pipedrive/filter.rb
199
+ - lib/pipedrive/goal.rb
200
+ - lib/pipedrive/note.rb
201
+ - lib/pipedrive/organization-field.rb
175
202
  - lib/pipedrive/organization.rb
203
+ - lib/pipedrive/permission-set.rb
204
+ - lib/pipedrive/person-field.rb
176
205
  - lib/pipedrive/person.rb
177
206
  - lib/pipedrive/pipeline.rb
207
+ - lib/pipedrive/product-field.rb
178
208
  - lib/pipedrive/product.rb
209
+ - lib/pipedrive/push-notification.rb
210
+ - lib/pipedrive/role.rb
211
+ - lib/pipedrive/search-result.rb
179
212
  - lib/pipedrive/stage.rb
213
+ - lib/pipedrive/user-connection.rb
214
+ - lib/pipedrive/user-setting.rb
215
+ - lib/pipedrive/user.rb
180
216
  - pipedrive-ruby.gemspec
181
217
  - test/data/create_deal_body.json
218
+ - test/data/create_note_body.json
182
219
  - test/data/create_organization_body.json
183
220
  - test/data/create_person_body.json
184
221
  - test/helper.rb
185
222
  - test/test_pipedrive_authentication.rb
186
223
  - test/test_pipedrive_deal.rb
224
+ - test/test_pipedrive_note.rb
187
225
  - test/test_pipedrive_organization.rb
188
226
  - test/test_pipedrive_person.rb
189
227
  homepage: https://github.com/GeneralScripting/pipedrive-ruby.git
@@ -201,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
239
  version: '0'
202
240
  segments:
203
241
  - 0
204
- hash: -1935958620386015648
242
+ hash: 754100960155720432
205
243
  required_rubygems_version: !ruby/object:Gem::Requirement
206
244
  none: false
207
245
  requirements: