prosperworks-ruby 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83799d280ed1a8852e37f6c479908691b2824d19
4
- data.tar.gz: 39ae89fd82e3324e4708f9ff45083d4dfac841bf
3
+ metadata.gz: 178f861fcbab618ab5d7868804aaff682fec7afe
4
+ data.tar.gz: e50f45003f905d514bb09bc58e4ce8a44773fe74
5
5
  SHA512:
6
- metadata.gz: 3005d1c1304ef277b933d4f5ea1017cce880d4192d4d2f0a3f3fb7dcca6a543e40d1cdad044d5744c6df3c11fede9034cc013fb46e5cc64a8a77f9617bb6312c
7
- data.tar.gz: 111089593cbb962f1d2a4b33bcf07c15d8fb3f162423e61aae125a06267c8a12978192ae7fd8e1a02c02607dfbc8cbeb228b6270c526823df6a1c0f1f44f3d2c
6
+ metadata.gz: d711c8ca0e924dc2359ebe4401c44395ad39338bf223a5440d6059a0408bdcb9370a952a7c6e5c49a351c9355e7382c40ce1eb787b88ed26555223e9252b995e
7
+ data.tar.gz: 04f910b8d9d2efb1e1a77a0b1a37ecc83ee8524b6d311d9e1559cb88e1aff6ee5da90ce454a5f9aed20a45aab5b36c5fa5264c2a51e2f4fab407a9d76332b099
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ Changelog
2
+ =========
3
+
4
+ 0.1.1
5
+ -----
6
+
7
+ - fix bug caused by overwriting `to_json` method
8
+
9
+ 0.1.0
10
+ -----
11
+
12
+ - First release
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Prosperworks::Ruby
1
+ # ProsperWorks-Ruby
2
2
 
3
3
  A lightweight wrapper for interacting with the [ProsperWorks Developer API](https://www.prosperworks.com/developer_api).
4
4
 
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- This gem offers find, search, post and delete operations for the 6 main entity types: People, Companies, Leads, Tasks, Opportunities & Projects. Additionally, it supports the basic create, find, and delete operations for webhooks.
24
+ This gem offers basic operations to interact with the ProsperWorks Developer API. There is minimal error handling and no validation logic.
25
25
 
26
26
  To use the proper credentials, the following must be run before using the gem:
27
27
 
@@ -32,45 +32,68 @@ ProsperWorks.configure do |config|
32
32
  end
33
33
  ```
34
34
 
35
- To interact with the ProsperWorks API, simply call the relevant entity type and operation:
35
+ ### Create
36
+
37
+ ```
38
+ person = ProsperWorks::Person.create(attributes)
39
+
40
+ opportunity = ProsperWorks::Opportunity.create({
41
+ pipeline_id: <some_id>,
42
+ company_id: <another_id>,
43
+ monetary_value: 1_000
44
+ })
45
+
46
+ ```
47
+
48
+ ### Find
49
+
50
+ ```
51
+ person = ProsperWorks::Person.find(id)
52
+
53
+ lead = ProsperWorks::Lead.find(423)
54
+ ```
55
+
56
+ ### Update
57
+
58
+ For update, either update the object in advance:
59
+
60
+ ```
61
+ person.name = "A New Name"
62
+ response = ProsperWorks::Person.update(person)
63
+ ```
64
+
65
+ or pass in a hash of attributes to update:
66
+
67
+ ```
68
+ attributes = {
69
+ name: "A New Name"
70
+ }
71
+ response = ProsperWorks::Person.update(person, attributes)
72
+
36
73
  ```
37
- person = ProsperWorks::Person.find(id)
38
74
 
39
- person = ProsperWorks::Person.create(attributes)
75
+ ### Delete
76
+
77
+ ```
78
+ response = ProsperWorks::Person.delete(person.id)
40
79
 
41
- #
42
- # For update, either update the object in advance, or pass
43
- # in a hash of attributes to update
44
- #
45
- person.name = "some new name"
46
- response = ProsperWorks::Person.update(person)
47
- # --- OR ---
48
- response = ProsperWorks::Person.update(person, attributes)
80
+ ```
49
81
 
50
- response = ProsperWorks::Person.delete(person.id)
82
+ ### List (webhooks only)
51
83
 
84
+ ```
85
+ webhooks = ProsperWorks::Webhook.list
52
86
  ```
53
87
 
54
88
  The following entity types are currently supported:
55
89
  * Person
56
90
  * Lead
57
- * Companuy
91
+ * Company
58
92
  * Opportunity
59
93
  * Task
60
94
  * Project
61
95
  * Webhook
62
96
 
63
- The following operations are currently supported:
64
- * Create
65
- * Find
66
- * Update
67
- * Delete
68
- * List (only for webhooks)
69
-
70
- ```
71
- webhooks = ProsperWorks::Webhook.list
72
- ```
73
-
74
97
  The response will either be an instance of `ProsperWorks::Errors`, or the entity itself. See the `handle_response` function in [connect.rb](lib/prosperworks/api_operations/connect.rb).
75
98
 
76
99
  ## Development
@@ -86,20 +109,25 @@ This gem is fairly new, and can benefit from contributions!
86
109
  You can take a look at the [issues](https://github.com/soccernee/prosperworks-ruby/issues) and start by contributing there.
87
110
 
88
111
  Wishlist
89
- [] continuous integration setup
90
- [] add [Rubocop](https://github.com/bbatsov/rubocop)
91
- [] code cleanup & refactoring
92
- [] improved testing
93
- [] search endpoint
94
- [] Users API
95
- [] Activities API
96
- [] Related Items API
97
- [] Secondary Resources APIs
98
- [] Support for Nested Resources
112
+ - [ ] continuous integration setup
113
+ - [ ] add [Rubocop](https://github.com/bbatsov/rubocop)
114
+ - [ ] code cleanup & refactoring
115
+ - [ ] improved testing
116
+ - [ ] search endpoint
117
+ - [ ] Users API
118
+ - [ ] Activities API
119
+ - [ ] Related Items API
120
+ - [ ] Secondary Resources APIs
121
+ - [ ] Support for Nested Resources
99
122
 
100
123
 
101
124
  Bug reports and pull requests are welcome on GitHub at https://github.com/soccernee/prosperworks-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
102
125
 
126
+ To run the tests:
127
+ ```
128
+ rake test
129
+ ```
130
+
103
131
  ## License
104
132
 
105
133
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "prosperworks/ruby"
4
+ require "prosperworks"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -23,10 +23,10 @@ module ProsperWorks
23
23
  request = Net::HTTP::Get.new(uri.request_uri, headers)
24
24
  when "post"
25
25
  request = Net::HTTP::Post.new(uri.request_uri, headers)
26
- request.body = entity.to_json
26
+ request.body = entity.serialize_pw_entity
27
27
  when "put"
28
28
  request = Net::HTTP::Put.new(uri.request_uri, headers)
29
- request.body = entity.to_json
29
+ request.body = entity.serialize_pw_entity
30
30
  when "delete"
31
31
  request = Net::HTTP::Delete.new(uri.request_uri, headers)
32
32
  end
@@ -1,6 +1,6 @@
1
1
  module ProsperWorks
2
2
  class Base
3
- include ProsperWorks::JSONable
3
+ include ProsperWorks::SerializeEntity
4
4
 
5
5
  attr_accessor :id,
6
6
  :date_created
@@ -1,5 +1,4 @@
1
1
  require 'json'
2
- require 'json/add/core' # enables serializing of Time and other things
3
2
 
4
3
  module ProsperWorks
5
4
 
@@ -7,11 +6,10 @@ module ProsperWorks
7
6
  # Modified version of the Jsonable gem, all credit goes to the
8
7
  # authors of that gem
9
8
  #
10
- module JSONable
9
+ module SerializeEntity
11
10
 
12
- def to_json(*a)
11
+ def serialize_pw_entity(*a)
13
12
  result = {}
14
- result['json_class'] = self.class.name
15
13
  self.instance_variables.each do |var|
16
14
  trimmed_var = var.to_s.gsub!("@", "")
17
15
  result[trimmed_var] = self.instance_variable_get var
@@ -21,4 +19,4 @@ module ProsperWorks
21
19
 
22
20
  end
23
21
 
24
- end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module ProsperWorks
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Neeraj Chandra"]
10
10
  spec.email = ["nchandra324@gmail.com"]
11
11
 
12
- spec.summary = %q{A lightweight interface for the ProsperWorks Developer API}
12
+ spec.summary = %q{A Ruby gem for the ProsperWorks Developer API}
13
13
  spec.description = %q{A lightweight interface for the ProsperWorks Developer API}
14
14
  spec.homepage = "https://rubygems.org/gems/prosperworks-ruby"
15
15
  spec.license = "MIT"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prosperworks-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj Chandra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-15 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
77
  - ".travis.yml"
78
+ - CHANGELOG.md
78
79
  - CODE_OF_CONDUCT.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
@@ -135,5 +136,5 @@ rubyforge_project:
135
136
  rubygems_version: 2.6.12
136
137
  signing_key:
137
138
  specification_version: 4
138
- summary: A lightweight interface for the ProsperWorks Developer API
139
+ summary: A Ruby gem for the ProsperWorks Developer API
139
140
  test_files: []