pipedrive-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'httparty'
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "shoulda", ">= 0"
12
+ gem "rdoc", "~> 3.12"
13
+ gem "bundler", ">= 1.0.0"
14
+ gem "jeweler", ">= 1.8.4"
15
+ gem "simplecov", ">= 0"
16
+ end
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.8)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ git (1.2.5)
8
+ httparty (0.9.0)
9
+ multi_json (~> 1.0)
10
+ multi_xml
11
+ i18n (0.6.1)
12
+ jeweler (1.8.4)
13
+ bundler (~> 1.0)
14
+ git (>= 1.2.5)
15
+ rake
16
+ rdoc
17
+ json (1.7.5)
18
+ multi_json (1.3.6)
19
+ multi_xml (0.5.1)
20
+ rake (0.9.2.2)
21
+ rdoc (3.12)
22
+ json (~> 1.4)
23
+ shoulda (3.3.2)
24
+ shoulda-context (~> 1.0.1)
25
+ shoulda-matchers (~> 1.4.1)
26
+ shoulda-context (1.0.1)
27
+ shoulda-matchers (1.4.1)
28
+ activesupport (>= 3.0.0)
29
+ simplecov (0.7.1)
30
+ multi_json (~> 1.0)
31
+ simplecov-html (~> 0.7.1)
32
+ simplecov-html (0.7.1)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ bundler (>= 1.0.0)
39
+ httparty
40
+ jeweler (>= 1.8.4)
41
+ rdoc (~> 3.12)
42
+ shoulda
43
+ simplecov
@@ -0,0 +1,25 @@
1
+ = pipedrive-ruby
2
+
3
+ == Installation
4
+
5
+ gem install pipedrive-ruby
6
+
7
+ == Usage
8
+
9
+ require 'pipedrive-ruby'
10
+ Pipedrive.authenticate( YOUR_API_TOKEN )
11
+ Pipedrive::Deal.find( DEAL_ID )
12
+
13
+ == Contributing to pipedrive-ruby
14
+
15
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
16
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
17
+ * Fork the project.
18
+ * Start a feature/bugfix branch.
19
+ * Commit and push until you are happy with your contribution.
20
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
+ * 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.
22
+
23
+ == License
24
+
25
+ This gem is released under the {MIT License}[http://www.opensource.org/licenses/MIT].
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "pipedrive-ruby"
18
+ gem.homepage = "https://github.com/GeneralScripting/pipedrive-ruby.git"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ruby wrapper for the Pipedrive API}
21
+ gem.description = %Q{Ruby wrapper for the Pipedrive API}
22
+ gem.email = "jan@general-scripting.com"
23
+ gem.authors = ["Waldemar Kusnezow", "Jan Schwenzien", "Patrick Kozma"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ task :default => :test
36
+
37
+ require 'rdoc/task'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "pipedrive-rails #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,10 @@
1
+ require 'pipedrive/base'
2
+ require 'pipedrive/deal'
3
+
4
+ module Pipedrive
5
+
6
+ def self.authenticate(token)
7
+ Base.authenticate(token)
8
+ end
9
+
10
+ end
@@ -0,0 +1,55 @@
1
+ require 'httparty'
2
+ require 'ostruct'
3
+
4
+ module Pipedrive
5
+
6
+ # Globally set request headers
7
+ HEADERS = {
8
+ "User-Agent" => "Ruby.Pipedrive.Api",
9
+ "Accept" => "application/json",
10
+ "Content-Type" => "application/json"
11
+ }
12
+
13
+ # Base class for setting HTTParty configurations globally
14
+ class Base < OpenStruct
15
+
16
+ include HTTParty
17
+ base_uri 'api.pipedrive.com/v1'
18
+ headers HEADERS
19
+ format :json
20
+
21
+ # Sets the authentication credentials in a class variable.
22
+ #
23
+ # @param [String] email cl.ly email
24
+ # @param [String] password cl.ly password
25
+ # @return [Hash] authentication credentials
26
+ def self.authenticate(token)
27
+ self.default_params :api_token => token
28
+ end
29
+
30
+ # Examines a bad response and raises an approriate exception
31
+ #
32
+ # @param [HTTParty::Response] response
33
+ def self.bad_response(response)
34
+ if response.class == HTTParty::Response
35
+ raise response.inspect
36
+ raise ResponseError, response
37
+ end
38
+ raise StandardError, "Unkown error"
39
+ end
40
+
41
+ attr_reader :data
42
+
43
+ # Create a new CloudApp::Base object.
44
+ #
45
+ # Only used internally
46
+ #
47
+ # @param [Hash] attributes
48
+ # @return [CloudApp::Base]
49
+ def initialize(attrs = {})
50
+ super(attrs['data'])
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,25 @@
1
+ module Pipedrive
2
+
3
+ class Deal < Base
4
+
5
+ def self.create( opts = {} )
6
+ res = post "/deals", :body => opts
7
+ if res.ok?
8
+ Deal.new(res)
9
+ else
10
+ bad_response(res)
11
+ end
12
+ end
13
+
14
+ def self.find(id)
15
+ res = get "/deals/#{id}"
16
+ if res.ok?
17
+ Deal.new(res)
18
+ else
19
+ bad_response(res)
20
+ end
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "pipedrive-ruby"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Waldemar Kusnezow", "Jan Schwenzien", "Patrick Kozma"]
12
+ s.date = "2012-11-01"
13
+ s.description = "Ruby wrapper for the Pipedrive API"
14
+ s.email = "jan@general-scripting.com"
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/pipedrive-ruby.rb",
26
+ "lib/pipedrive/base.rb",
27
+ "lib/pipedrive/deal.rb",
28
+ "pipedrive-ruby.gemspec",
29
+ "test/helper.rb",
30
+ "test/test_pipedrive-rails.rb"
31
+ ]
32
+ s.homepage = "https://github.com/GeneralScripting/pipedrive-ruby.git"
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = "1.8.23"
36
+ s.summary = "Ruby wrapper for the Pipedrive API"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
43
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
44
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
46
+ s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
47
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<httparty>, [">= 0"])
50
+ s.add_dependency(%q<shoulda>, [">= 0"])
51
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, [">= 1.8.4"])
54
+ s.add_dependency(%q<simplecov>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<httparty>, [">= 0"])
58
+ s.add_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
60
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
61
+ s.add_dependency(%q<jeweler>, [">= 1.8.4"])
62
+ s.add_dependency(%q<simplecov>, [">= 0"])
63
+ end
64
+ end
65
+
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'pipedrive-rails'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestPipedriveRails < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pipedrive-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Waldemar Kusnezow
9
+ - Jan Schwenzien
10
+ - Patrick Kozma
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-11-01 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: httparty
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: shoulda
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdoc
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '3.12'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: '3.12'
64
+ - !ruby/object:Gem::Dependency
65
+ name: bundler
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: 1.0.0
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: 1.0.0
80
+ - !ruby/object:Gem::Dependency
81
+ name: jeweler
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: 1.8.4
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: 1.8.4
96
+ - !ruby/object:Gem::Dependency
97
+ name: simplecov
98
+ requirement: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: Ruby wrapper for the Pipedrive API
113
+ email: jan@general-scripting.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files:
117
+ - README.rdoc
118
+ files:
119
+ - .document
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - README.rdoc
123
+ - Rakefile
124
+ - VERSION
125
+ - lib/pipedrive-ruby.rb
126
+ - lib/pipedrive/base.rb
127
+ - lib/pipedrive/deal.rb
128
+ - pipedrive-ruby.gemspec
129
+ - test/helper.rb
130
+ - test/test_pipedrive-rails.rb
131
+ homepage: https://github.com/GeneralScripting/pipedrive-ruby.git
132
+ licenses:
133
+ - MIT
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ segments:
145
+ - 0
146
+ hash: -1673639647097067349
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 1.8.23
156
+ signing_key:
157
+ specification_version: 3
158
+ summary: Ruby wrapper for the Pipedrive API
159
+ test_files: []