contactually-cmd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 35daa86d5d2bb160dd8c3135dd2d174b1e0b7bfa
4
+ data.tar.gz: 45b60f8126a05f0d969d8edee5e2fa26e733c852
5
+ SHA512:
6
+ metadata.gz: adaa4eb056f01b6959482c09771e0bb8f8909c3eb928f6466979aafda2dc484a4f8f5fb9e1fbb3002d71c552007ac87b21c751f5e540c5d38ca61d623e90a532
7
+ data.tar.gz: 4f2fe568372b7fd93dd5b5ba7c25006c478d294ef4508eec9fa6ceb8736b6867f04cf68dd8630d4c48602d3319919c1bf6ec865ef2b528b2360ffdff29ab0617
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in contactually-cmd.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Henry Poydar
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,23 @@
1
+ # Contactually / Command Line
2
+
3
+ Provides command line access to http://www.Contactually.com CRM data. The Contactually UI does not have an upcoming task list (or any general task list). However I love the Gmail and contact sync so I need to make do. Here's a quick and dirty way to get a list of tasks.
4
+
5
+ ## Installation
6
+
7
+ 1.) Put your API key in `~/.contactually`
8
+
9
+ 2.) Install the gem:
10
+
11
+ $ gem install contactually-cmd
12
+
13
+ ## Usage
14
+
15
+ $ contactually -h
16
+
17
+ ## Contributing
18
+
19
+ 1. Fork it ( https://github.com/[my-github-username]/contactually/fork )
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
21
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
22
+ 4. Push to the branch (`git push origin my-new-feature`)
23
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/*_test.rb']
7
+ t.verbose = true
8
+ end
9
+
10
+ task :default => :test
data/bin/contactually ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
+ $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
+
6
+ require 'optparse'
7
+ require 'contactually'
8
+
9
+ options = {}
10
+ OptionParser.new do |opts|
11
+ opts.banner = "Usage: contactually [options]"
12
+
13
+ opts.on( '-t', '--tasks', 'List all tasks' ) do
14
+ options[:tasks] = true
15
+ end
16
+
17
+ opts.on( '-h', '--help', 'Display this screen' ) do
18
+ puts opts
19
+ exit
20
+ end
21
+
22
+ end.parse!
23
+
24
+ begin
25
+ api_key = File.open(File.expand_path("~/.contactually"), "rb").read.chomp
26
+ rescue Errno::ENOENT
27
+ puts "You need to store your Contactually API key as one line in ~/.contactually"
28
+ exit
29
+ end
30
+
31
+ c = Contactually::Tasks.new(api_key)
32
+ c.list
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'contactually/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "contactually-cmd"
8
+ spec.version = Contactually::VERSION
9
+ spec.authors = ["Henry Poydar"]
10
+ spec.email = ["hpoydar@gmail.com"]
11
+ spec.summary = %q{Command line access to Contactually data}
12
+ spec.homepage = "https://github.com/hpoydar/contactually-cmd"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'httparty', '~> 0.13.3'
21
+ spec.add_runtime_dependency "terminal-table", "~> 1.4.5"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,40 @@
1
+ require "contactually/version"
2
+ require "httparty"
3
+ require 'terminal-table'
4
+
5
+ module Contactually
6
+
7
+ class Tasks
8
+
9
+ def initialize(api_key)
10
+ @connection = Connection.new(api_key)
11
+ end
12
+
13
+ def list
14
+ tasks = @connection.tasks_list
15
+ rows = []
16
+ tasks["tasks"].each do |t|
17
+ if t['completed_at'].nil?
18
+ time = Time.parse(t['due_date'])
19
+ rows << [time.strftime('%e %b'), t['associated_contact']['full_name'], t['title']]
20
+ end
21
+ end
22
+ table = Terminal::Table.new :rows => rows
23
+ puts table
24
+ end
25
+ end
26
+
27
+ class Connection
28
+ include HTTParty
29
+ base_uri 'www.contactually.com'
30
+
31
+ def initialize(api_key)
32
+ @options = { query: {api_key: api_key } }
33
+ end
34
+
35
+ def tasks_list
36
+ self.class.get("/api/v1/tasks", @options)
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,3 @@
1
+ module Contactually
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,13 @@
1
+ require "test_helper"
2
+ require 'contactually'
3
+
4
+ class ContactuallyTest < Minitest::Test
5
+
6
+ # TODO: Expand tests if gem ever grows
7
+
8
+ describe "Tasks" do
9
+ def test_list
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1 @@
1
+ require 'minitest/autorun'
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: contactually-cmd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Henry Poydar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: terminal-table
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description:
70
+ email:
71
+ - hpoydar@gmail.com
72
+ executables:
73
+ - contactually
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/contactually
83
+ - contactually-cmd.gemspec
84
+ - lib/contactually.rb
85
+ - lib/contactually/version.rb
86
+ - test/contactually_test.rb
87
+ - test/test_helper.rb
88
+ homepage: https://github.com/hpoydar/contactually-cmd
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Command line access to Contactually data
112
+ test_files:
113
+ - test/contactually_test.rb
114
+ - test/test_helper.rb