onepagecrm 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -15
- data/lib/onepagecrm.rb +3 -2
- data/lib/onepagecrm/version.rb +3 -3
- data/onepagecrm.gemspec +4 -14
- metadata +8 -125
- data/Guardfile +0 -9
- data/spec/contacts_spec.rb +0 -62
- data/spec/spec_helper.rb +0 -7
- data/tasks/rspec.rake +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4adc5612ded228721cf379dbf3c151d1cb69e13c
|
4
|
+
data.tar.gz: a4e7ccae4fa0db6e08035437a8d33713d87f04ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12c77b6739e38e78ae6ec82e6a18c4a6921580049be07d05f590746bf36f5f16f7eeea3853dafcdb2e5a7d190c4bb4f508dcf4fd271b6a610c5f6e43195b1687
|
7
|
+
data.tar.gz: ddee2ab11c51a33e4ac4afacf49671a9857bd71aaeb9357d63f935c3864246d74fb1adc0fd1a0c9d15451a7e43b3b23914af0683842b64037c15471a450c66a8
|
data/README.md
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
|
1
|
+
# OnePageCRM
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
TODO: Write a gem description
|
3
|
+
This gem is a basic wrapper around the OnePageCRM API.
|
4
|
+
It does not abstract all API calls to ruby methods on the gem object but simply gives the `GET`, `POST`, `PUT` and `DELETE` methods.
|
5
|
+
The gem handles all the authentication with the OnePageCRM API.
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
11
9
|
Add this line to your application's Gemfile:
|
12
10
|
|
13
|
-
|
14
|
-
gem 'onepagecrm'
|
15
|
-
```
|
11
|
+
gem 'onepagecrm'
|
16
12
|
|
17
13
|
And then execute:
|
18
14
|
|
@@ -23,13 +19,29 @@ Or install it yourself as:
|
|
23
19
|
$ gem install onepagecrm
|
24
20
|
|
25
21
|
## Usage
|
22
|
+
You can try out the OnePageCRM gem in an interactive ruby session
|
23
|
+
|
24
|
+
$ irb
|
25
|
+
irb:> require 'onepagecrm'
|
26
|
+
irb:> api_client = OnePageCRM.new('peter@xap.ie', 'p3t3r3t3p')
|
27
|
+
irb:> api_client.get('contacts.json')
|
28
|
+
irb:> api_client.post('contacts.json', {'last_name': 'Bravo', 'first_name': 'Johnny'} )
|
29
|
+
|
30
|
+
Take a look at the [OnePageCRM Developer][1] site for more details on API functionality.
|
26
31
|
|
27
|
-
|
32
|
+
## Support
|
33
|
+
The best way to get support is through the [OnePageCRM Developer Forum][2]
|
28
34
|
|
29
35
|
## Contributing
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
We welcome any contributions.
|
38
|
+
|
39
|
+
1. Create an issue relating to the feature that you require.
|
40
|
+
2. Fork the repo ( https://github.com/[my-github-username]/onepagecrm/fork )
|
41
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
6. Create a new Pull Request
|
45
|
+
|
46
|
+
[1]: http://developer.onepagecrm.com
|
47
|
+
[2]: http://forum.developer.onepagecrm.com
|
data/lib/onepagecrm.rb
CHANGED
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
require 'faraday'
|
5
5
|
|
6
6
|
# OnePageCRM API Client Object
|
7
|
-
class
|
7
|
+
class OnePageCRM
|
8
8
|
def initialize(login = nil, password = nil)
|
9
9
|
@url = 'https://app.onepagecrm.com/api/v3/'
|
10
10
|
@conn = Faraday.new(url: @url)
|
@@ -50,7 +50,8 @@ class Onepagecrm
|
|
50
50
|
token = create_auth_token(http_method, url, parameters, timestamp)
|
51
51
|
{ 'X-OnePageCRM-UID' => @uid,
|
52
52
|
'X-OnePageCRM-TS' => timestamp,
|
53
|
-
'X-OnePageCRM-Auth' => token
|
53
|
+
'X-OnePageCRM-Auth' => token,
|
54
|
+
'X-OnePageCRM-Source' => 'ruby_gem'
|
54
55
|
}.merge op_headers
|
55
56
|
end
|
56
57
|
|
data/lib/onepagecrm/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Version for
|
2
|
-
class
|
3
|
-
VERSION = '0.0
|
1
|
+
# Version for OnePageCRM gem
|
2
|
+
class OnePageCRM
|
3
|
+
VERSION = '0.1.0'
|
4
4
|
end
|
data/onepagecrm.gemspec
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'onepagecrm/version'
|
5
|
-
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'onepagecrm'
|
8
|
-
spec.version =
|
7
|
+
spec.version = OnePageCRM::VERSION
|
9
8
|
spec.authors = ['Peter Armstrong']
|
10
|
-
spec.email = ['
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
9
|
+
spec.email = ['devteam@onepagecrm.com']
|
10
|
+
spec.summary = 'Basic Gem for OnePageCRM'
|
11
|
+
spec.description = 'Basic Gem for the OnePageCRM API'
|
13
12
|
spec.homepage = 'http://developer.onepagecrm.com'
|
14
13
|
spec.license = 'MIT'
|
15
|
-
|
16
14
|
spec.files = `git ls-files -z`.split("\x0")
|
17
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
@@ -22,12 +20,4 @@ Gem::Specification.new do |spec|
|
|
22
20
|
|
23
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'json_spec'
|
27
|
-
spec.add_development_dependency 'codeclimate-test-reporter'
|
28
|
-
spec.add_development_dependency 'pry'
|
29
|
-
spec.add_development_dependency 'guard'
|
30
|
-
spec.add_development_dependency 'guard-rspec'
|
31
|
-
spec.add_development_dependency 'awesome_print'
|
32
|
-
spec.add_development_dependency 'vcr'
|
33
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onepagecrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Armstrong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,128 +52,15 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
|
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
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: json_spec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: codeclimate-test-reporter
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
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
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: guard-rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: awesome_print
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: vcr
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
description: Basic Gem for OnePageCRM.
|
55
|
+
description: Basic Gem for the OnePageCRM API
|
168
56
|
email:
|
169
|
-
-
|
57
|
+
- devteam@onepagecrm.com
|
170
58
|
executables: []
|
171
59
|
extensions: []
|
172
60
|
extra_rdoc_files: []
|
173
61
|
files:
|
174
62
|
- ".gitignore"
|
175
63
|
- Gemfile
|
176
|
-
- Guardfile
|
177
64
|
- LICENSE.txt
|
178
65
|
- README.md
|
179
66
|
- Rakefile
|
@@ -181,9 +68,6 @@ files:
|
|
181
68
|
- lib/onepagecrm.rb
|
182
69
|
- lib/onepagecrm/version.rb
|
183
70
|
- onepagecrm.gemspec
|
184
|
-
- spec/contacts_spec.rb
|
185
|
-
- spec/spec_helper.rb
|
186
|
-
- tasks/rspec.rake
|
187
71
|
homepage: http://developer.onepagecrm.com
|
188
72
|
licenses:
|
189
73
|
- MIT
|
@@ -204,10 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
88
|
version: '0'
|
205
89
|
requirements: []
|
206
90
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.4.5
|
208
92
|
signing_key:
|
209
93
|
specification_version: 4
|
210
|
-
summary: Basic Gem for OnePageCRM
|
211
|
-
test_files:
|
212
|
-
|
213
|
-
- spec/spec_helper.rb
|
94
|
+
summary: Basic Gem for OnePageCRM
|
95
|
+
test_files: []
|
96
|
+
has_rdoc:
|
data/Guardfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard :rspec, cmd: 'bundle exec rspec' do
|
5
|
-
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
8
|
-
end
|
9
|
-
|
data/spec/contacts_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'json_spec'
|
3
|
-
require 'pry'
|
4
|
-
require 'awesome_print'
|
5
|
-
|
6
|
-
describe Onepagecrm do
|
7
|
-
subject { Onepagecrm.new(TEST_CONFIG['login'], TEST_CONFIG['password']) }
|
8
|
-
|
9
|
-
describe '#contact' do
|
10
|
-
it 'creates, gets, updates and deletes a contact' do
|
11
|
-
|
12
|
-
contacts = subject.get('contacts.json')
|
13
|
-
expect(contacts['status']).to eq 0
|
14
|
-
new_contact_details = ({
|
15
|
-
'first_name' => 'yes',
|
16
|
-
'last_name' => 'address',
|
17
|
-
'company_name' => 'ACME&inc',
|
18
|
-
'starred' => false,
|
19
|
-
'tags' => %w(api_test1 api_test2),
|
20
|
-
'emails' => [{
|
21
|
-
'type' => 'work',
|
22
|
-
'value' => 'johnny@exammmple.com' }],
|
23
|
-
'phones' => [{
|
24
|
-
'type' => 'work',
|
25
|
-
'value' => '00033353' }],
|
26
|
-
'urls' => [{
|
27
|
-
'type' => 'website',
|
28
|
-
'value' => 'lsdkiteboarding.com' }],
|
29
|
-
'background' => 'BACKGROUND',
|
30
|
-
'job_title' => 'JOBTITLE',
|
31
|
-
'address_list' => [
|
32
|
-
'city' => 'San Francisco',
|
33
|
-
'state' => 'CA'
|
34
|
-
]
|
35
|
-
})
|
36
|
-
new_contact = subject.post('contacts.json', new_contact_details)['data']
|
37
|
-
new_contact_id = new_contact['contact']['id']
|
38
|
-
got_deets = subject.get("contacts/#{new_contact_id}.json?search=yes")['data']['contact']
|
39
|
-
expect(got_deets['first_name']).to eq(new_contact_details['first_name'])
|
40
|
-
|
41
|
-
details_without_address = new_contact_details.reject { |k| k == 'address_list' }
|
42
|
-
|
43
|
-
details_without_address.each do |k, _v|
|
44
|
-
expect(got_deets[k]).to eq(new_contact_details[k])
|
45
|
-
end
|
46
|
-
|
47
|
-
# check address
|
48
|
-
address = got_deets['address_list'][0]
|
49
|
-
expect(address['city']).to eq 'San Francisco'
|
50
|
-
expect(address['state']).to eq 'CA'
|
51
|
-
|
52
|
-
subject.put("contacts/#{new_contact_id}.json", { 'partial' => true,
|
53
|
-
'first_name' => 'Pat' })
|
54
|
-
got_deets = subject.get("contacts/#{new_contact_id}.json")['data']['contact']
|
55
|
-
expect(got_deets['first_name']).to eq 'Pat'
|
56
|
-
|
57
|
-
# delete contact
|
58
|
-
subject.delete("contacts/#{new_contact_id}.json")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/spec/spec_helper.rb
DELETED