zoho_wrapper 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+ group :test do
3
+ gem 'rspec', '>= 2.12.0'
4
+ gem 'simplecov', '>= 0.7.1', :require => false, :group => :test
5
+ gem 'coveralls', require: false
6
+ end
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Zoho Wrapper
2
+
3
+ A gem that wraps up the rubyzoho gem. This gem makes possible to use rubyzoho with more than just one company. It changes the Zoho Token whenever a save operation or a remove operation is called.
4
+
5
+ Note: For now, as it is a POC, it is just working with the Lead (Zoho) entity.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'zoho_wrapper'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install zoho_wrapper
20
+
21
+ ## Usage
22
+
23
+ There are just few integration configurations before using the gem. The class intended to integrate with the gem needs to include our `Lead` module. So, the class must implement the following methods:
24
+
25
+ - zoho_lead: that returns the zoho fields to be saved ( see https://github.com/amalc/rubyzoho )
26
+ - zoho_token: The token for connecting with the Zoho account. For more information on how to get a Zoho Authentication Token see https://www.zoho.com/crm/help/api/using-authentication-token.html.
27
+
28
+ ### Example code
29
+
30
+ ```ruby
31
+ class Lead < ActiveRecord::Base
32
+ include ZohoWrapper::ActiveRecord
33
+
34
+ belongs_to :company
35
+
36
+ validates :name, :length => { :minimum => 3, :maximum => 60}, :presence => true, :allow_blank => false
37
+ validates :last_name, :length => { :minimum => 3, :maximum => 60}, :presence => true, :allow_blank => false
38
+ validates :email, :presence => true
39
+ validates :company_id, :presence => true
40
+
41
+ def fullname
42
+ "#{name} #{last_name}"
43
+ end
44
+
45
+ def zoho_lead
46
+ {
47
+ :first_name => name.dup,
48
+ :last_name => last_name.dup,
49
+ :title => job_title.dup,
50
+ :email => email.dup
51
+ }
52
+ end
53
+
54
+ def zoho_token
55
+ company.zoho_token
56
+ end
57
+ ```
58
+
59
+ ### Sample (Station App)
60
+
61
+ An application using the gem is available at:
62
+
63
+ - Source code: https://github.com/marcelorxaviers/station_app
64
+ - Running app: https://station-app.herokuapp.com
65
+
66
+ ## Contributing to Zoho Wrapper
67
+ * Pull requests with unit tests or specs and a version branch are welcomed.
68
+ * Fork the project.
69
+ * Start a feature/bugfix branch.
70
+ * Commit and push as much as you want.
71
+ * Make sure to add tests for it.
@@ -6,6 +6,7 @@ module ZohoWrapper
6
6
 
7
7
  begin
8
8
  setup_zoho
9
+ raise "Missing zoho_token" if self.respond_to? :zoho_lead=
9
10
  lead = RubyZoho::Crm::Lead.new(self.zoho_lead.dup)
10
11
  lead.save
11
12
  self.on_zoho = true
@@ -39,6 +40,7 @@ module ZohoWrapper
39
40
 
40
41
  private
41
42
  def setup_zoho
43
+ raise "Missing zoho_token" if self.respond_to? :zoho_token=
42
44
  RubyZoho.configure do |config|
43
45
  # 'ed7fc5b8a28a358793dcd162e67c43e1'
44
46
  config.api_key = self.zoho_token
data/spec/lead_spec.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ class Lead
4
+ include ZohoWrapper::ActiveRecord
5
+
6
+ attr_accessor :name, :last_name, :title, :email
7
+
8
+ def initialize name, last_name, title, email
9
+ @name = name
10
+ @last_name = last_name
11
+ @title = title
12
+ @email = email
13
+ end
14
+ end
15
+
16
+ describe Lead do
17
+ describe "#new" do
18
+ it "takes four parameters and returns a Lead object" do
19
+ @lead.should be_an_instance_of Lead
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ require_relative '../lib/zoho_wrapper.rb'
2
+ require_relative '../lib/zoho_wrapper/lead.rb'
3
+
4
+ require 'yaml'
data/zoho_wrapper.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "zoho_wrapper"
8
- spec.version = "0.0.5"
8
+ spec.version = "0.0.6"
9
9
  spec.authors = ["marcelorxs"]
10
10
  spec.email = ["marcelorxs@gmail.com"]
11
11
  spec.summary = "A gem for accessing Zoho CRM API"
@@ -15,11 +15,11 @@ Gem::Specification.new do |spec|
15
15
  spec.platform = Gem::Platform::RUBY
16
16
  spec.required_ruby_version = ">= 1.9.3"
17
17
  spec.files = `git ls-files -z`.split("\x0")
18
- # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- # spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+
20
19
  spec.require_paths = ["lib"]
21
20
  spec.add_development_dependency "bundler", "~> 1.5"
22
21
  spec.add_development_dependency "rake", "~> 0"
23
22
  spec.add_development_dependency "rspec", "~> 0"
23
+ spec.add_development_dependency "rubyzoho", "~> 0.2.0"
24
24
  spec.add_dependency "rubyzoho", "~> 0.2.0"
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoho_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-03 00:00:00.000000000 Z
12
+ date: 2014-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubyzoho
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.2.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.0
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: rubyzoho
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -86,11 +102,13 @@ files:
86
102
  - .ruby-version
87
103
  - Gemfile
88
104
  - Gemfile.lock
89
- - README.rdoc
105
+ - README.md
90
106
  - Rakefile
91
107
  - config.ru
92
108
  - lib/zoho_wrapper.rb
93
109
  - lib/zoho_wrapper/lead.rb
110
+ - spec/lead_spec.rb
111
+ - spec/spec_helper.rb
94
112
  - zoho_wrapper.gemspec
95
113
  homepage: http://github.com/marcelorxaviers/zoho_wrapper
96
114
  licenses:
data/README.rdoc DELETED
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.