rd_dev_test 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/lib/rd_dev_test/config.rb +9 -0
- data/lib/rd_dev_test/person.rb +24 -0
- data/lib/rd_dev_test/version.rb +9 -0
- data/lib/rd_dev_test.rb +4 -0
- data/rd_dev_test.gemspec +26 -0
- data/spec/highrise_spec.rb +42 -0
- data/spec/person_spec.rb +55 -0
- data/spec/spec_helper.rb +25 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0161cc633ff3487567ed72622e6c93839e0a694b
|
4
|
+
data.tar.gz: 22136b66245808c7035d34809b854888eb9fda94
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3565a16d3d9df76a776ab87a3b2ddd6abf0e3274d9dd656e57b17635b7bcb79521f12e30214a0941c27b35879d8855788e8aa244ade1c1ced3930d34d742404
|
7
|
+
data.tar.gz: 8dde6a43eb87261167a3ef8cd7813f3cce4b32d42b77cb37289349957ed7e92c4fdedc9cde927fe6091f8bd05b29234cb385a67ec709a9a290325ded410e6042
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 jeanmatheussouto
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# RdDevTest
|
2
|
+
|
3
|
+
Gem is used for integration with Highrise CRM. works as a helper and its dependence on the [Highrise](https://github.com/tapajos/highrise) gem.
|
4
|
+
|
5
|
+
This gem can be used to insert, delete, and search all persons of a particular account Highrise, through their methods `#save_higrise` , `#delete_person_highrise`, `#all_person`.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rd_dev_test'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rd_dev_test
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
```ruby
|
23
|
+
@list = RdDevTest::Person.all_person
|
24
|
+
|
25
|
+
deleted_people = RdDevTest::Person.delete_person_highrise(123)
|
26
|
+
|
27
|
+
id_highrise_save = RdDevTest::Person.save_higrise(people)
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RdDevTest
|
2
|
+
module Person
|
3
|
+
|
4
|
+
def self.save_higrise(pes)
|
5
|
+
person = Highrise::Person.new(pes)
|
6
|
+
begin
|
7
|
+
person.save!
|
8
|
+
rescue Exception => e
|
9
|
+
puts person.errors
|
10
|
+
end
|
11
|
+
person.attributes[:id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.delete_person_highrise(id)
|
15
|
+
person = Highrise::Person.find(id)
|
16
|
+
person.destroy
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.all_person
|
20
|
+
Highrise::Person.all
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/rd_dev_test.rb
ADDED
data/rd_dev_test.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rd_dev_test/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rd_dev_test"
|
8
|
+
spec.version = RdDevTest::Version::STRING_VERSION
|
9
|
+
spec.authors = ["jeanmatheussouto"]
|
10
|
+
spec.email = ["jeanmatheussouto@gmail.com"]
|
11
|
+
spec.description = %q{Gem RD Dev Test}
|
12
|
+
spec.summary = %q{Test Resultados Digitais}
|
13
|
+
spec.homepage = "https://github.com/jeanmatheussouto/rd_gem"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "highrise"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "highrise"
|
3
|
+
|
4
|
+
# if highrise_env_available?
|
5
|
+
# describe HighriseMapper::Person, "#save_to_highrise" do
|
6
|
+
# it "persists the Highrise::Person successfully" do
|
7
|
+
# HighriseMapper.config('templates')
|
8
|
+
# contact = Contact.new
|
9
|
+
# begin
|
10
|
+
# result = contact.save_to_highrise
|
11
|
+
# result.should be_a_kind_of(Fixnum)
|
12
|
+
# ensure
|
13
|
+
# Highrise::Person.find(result).destroy
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
|
18
|
+
# describe HighriseMapper::Person, "#delete_from_highrise" do
|
19
|
+
# it "deletes the Highrise::Person successfully" do
|
20
|
+
# HighriseMapper.config('templates')
|
21
|
+
# contact = Contact.new
|
22
|
+
# highrise_person_id = contact.save_to_highrise
|
23
|
+
# result = contact.delete_from_highrise(highrise_person_id)
|
24
|
+
# result.should be_a_kind_of(Net::HTTPOK)
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# else
|
28
|
+
# describe HighriseMapper::Person, "#save_to_highrise"
|
29
|
+
# describe HighriseMapper::Person, "#delete_from_highrise"
|
30
|
+
# end
|
31
|
+
describe RdDevTest::Config, "::setup_highrise" do
|
32
|
+
|
33
|
+
before :all do
|
34
|
+
site = 'https://school872.highrisehq.com'
|
35
|
+
user = 'a6160d76a39e0c65af470cbd53c1dc3e'
|
36
|
+
RdDevTest::Config.setup_highrise(site,user)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "verify configuration highrise" do
|
40
|
+
Highrise::Tag.find(:all).should be
|
41
|
+
end
|
42
|
+
end
|
data/spec/person_spec.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "highrise"
|
3
|
+
require "time"
|
4
|
+
|
5
|
+
describe RdDevTest do
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
site = 'https://school872.highrisehq.com'
|
9
|
+
user = 'a6160d76a39e0c65af470cbd53c1dc3e'
|
10
|
+
RdDevTest::Config.setup_highrise(site,user)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe RdDevTest::Person, "#all_person" do
|
14
|
+
it "return all persons" do
|
15
|
+
list = RdDevTest::Person.all_person
|
16
|
+
|
17
|
+
list.should be
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe RdDevTest::Person, "#delete_person_highrise" do
|
22
|
+
it "delete the person successfully" do
|
23
|
+
person = Highrise::Person.new
|
24
|
+
person.name = "Test Delete #{Time.now}"
|
25
|
+
person.save
|
26
|
+
|
27
|
+
RdDevTest::Person.delete_person_highrise(person.id).should be_a_kind_of(Net::HTTPOK)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe RdDevTest::Person, "#save_higrise" do
|
32
|
+
it "create person successfully" do
|
33
|
+
pessoa = {
|
34
|
+
:first_name => "Test #{Time.now}",
|
35
|
+
:last_name => "Rspec",
|
36
|
+
:company_name => "Company Jean",
|
37
|
+
:title => "Developer",
|
38
|
+
:contact_data => {
|
39
|
+
:email_addresses => [
|
40
|
+
:email_address => {:address => "test@test.com"}
|
41
|
+
],
|
42
|
+
:phone_numbers => [
|
43
|
+
:phone_number => {:number => "555-555-5555", :location => "Work"}
|
44
|
+
],
|
45
|
+
:web_addresses => [
|
46
|
+
:web_address => {:url => "about.me", :location => "Work"}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
}
|
50
|
+
rt = RdDevTest::Person.save_higrise(pessoa)
|
51
|
+
rt.should be_a_kind_of(Fixnum)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
Bundler.setup
|
4
|
+
|
5
|
+
require File.join(File.dirname(__FILE__), '/../lib/rd_dev_test')
|
6
|
+
|
7
|
+
# #Highrise::Base.user = ENV['HIGHRISE_USER'] || 'x'
|
8
|
+
# Highrise::Base.oauth_token = ENV['HIGHRISE_TOKEN'] || 'a6160d76a39e0c65af470cbd53c1dc3e'
|
9
|
+
# Highrise::Base.site = ENV['HIGHRISE_SITE'] || 'https://school872.highrisehq.com'
|
10
|
+
|
11
|
+
# # require 'highrise/pagination_behavior'
|
12
|
+
# # require 'highrise/searchable_behavior'
|
13
|
+
# # require 'highrise/taggable_behavior'
|
14
|
+
|
15
|
+
# require "rd_dev_test/rd_dev_test"
|
16
|
+
|
17
|
+
# require "rd_dev_test"
|
18
|
+
|
19
|
+
# RSpec.configure do |config|
|
20
|
+
# config.treat_symbols_as_metadata_keys_with_true_values = true
|
21
|
+
# config.run_all_when_everything_filtered = true
|
22
|
+
# config.filter_run :focus
|
23
|
+
|
24
|
+
# config.order = 'random'
|
25
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rd_dev_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jeanmatheussouto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: highrise
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Gem RD Dev Test
|
70
|
+
email:
|
71
|
+
- jeanmatheussouto@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/rd_dev_test.rb
|
82
|
+
- lib/rd_dev_test/config.rb
|
83
|
+
- lib/rd_dev_test/person.rb
|
84
|
+
- lib/rd_dev_test/version.rb
|
85
|
+
- rd_dev_test.gemspec
|
86
|
+
- spec/highrise_spec.rb
|
87
|
+
- spec/person_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: https://github.com/jeanmatheussouto/rd_gem
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.1.11
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Test Resultados Digitais
|
113
|
+
test_files:
|
114
|
+
- spec/highrise_spec.rb
|
115
|
+
- spec/person_spec.rb
|
116
|
+
- spec/spec_helper.rb
|