whatconverts 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -8
- data/lib/whatconverts/client.rb +8 -18
- data/lib/whatconverts/client/account.rb +29 -0
- data/lib/whatconverts/client/lead.rb +24 -0
- data/lib/whatconverts/client/profile.rb +29 -0
- data/lib/whatconverts/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af5e8bc8c946c898a8355e8ed65d194259a05502
|
4
|
+
data.tar.gz: 8fc371d5dc4af2d48ccfb439e82dd5831c0e034b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0f892385bce494d81f11c940b89869713a2eaaa55d300226c6447490fd27f793e43ecd0a4ddfb98faa9e22654c0aa29ff0923acc7adfb76201d442f7c7fb376
|
7
|
+
data.tar.gz: 52023b0b5d2d089ae1afe6e53f7b8ddb78ac2d38e612456d62b4f0c0fc1aca54327124b36dcdefbd00ff7bc159056a615ac0211c2701cad5fbc6db321a4618cb
|
data/README.md
CHANGED
@@ -23,26 +23,40 @@ Or install it yourself as:
|
|
23
23
|
```ruby
|
24
24
|
client = Whatconverts::Client.new do |config|
|
25
25
|
config.api_token = 'YOUR_API_TOKEN'
|
26
|
-
config.api_secret = '
|
26
|
+
config.api_secret = 'YOUR_API_SECRET'
|
27
27
|
end
|
28
28
|
|
29
|
-
# retrieve
|
29
|
+
# retrieve all
|
30
30
|
client.leads
|
31
|
+
client.accounts
|
32
|
+
client.profiles(account_id)
|
31
33
|
|
32
|
-
#
|
34
|
+
# retrieving with param filtering
|
33
35
|
client.leads(lead_type: 'phone_call', lead_status: 'unique')
|
36
|
+
client.accounts(accounts_per_page: 100)
|
37
|
+
client.profiles(account_id, profiles_per_page: 100)
|
34
38
|
|
35
|
-
#
|
36
|
-
client.lead(
|
39
|
+
# fetching by ID
|
40
|
+
client.lead(lead_id)
|
41
|
+
client.account(account_id)
|
42
|
+
client.profile(account_id, profile_id)
|
37
43
|
|
38
|
-
#
|
44
|
+
# creation
|
39
45
|
client.create_lead(
|
40
46
|
lead_type: 'Web Form',
|
41
47
|
form_name: 'My Form'
|
42
48
|
)
|
49
|
+
client.create_account(account_name: 'Test Account')
|
50
|
+
client.create_profile(account_id, profile_name: 'Test Profile')
|
43
51
|
|
44
|
-
#
|
45
|
-
client.edit_lead(
|
52
|
+
# editing
|
53
|
+
client.edit_lead(lead_id, lead_source: 'google')
|
54
|
+
client.edit_account(account_id, account_name: 'Test Account 2')
|
55
|
+
client.edit_profile(account_id, profile_id, profile_name: 'Test Profile 2')
|
56
|
+
|
57
|
+
# deletion
|
58
|
+
client.delete_account(account_id)
|
59
|
+
client.delete_profile(account_id, profile_id)
|
46
60
|
```
|
47
61
|
|
48
62
|
## Contributing
|
data/lib/whatconverts/client.rb
CHANGED
@@ -1,30 +1,20 @@
|
|
1
|
+
require 'whatconverts/client/account'
|
2
|
+
require 'whatconverts/client/lead'
|
3
|
+
require 'whatconverts/client/profile'
|
4
|
+
|
1
5
|
module Whatconverts
|
2
6
|
class Client
|
3
7
|
|
4
8
|
attr_accessor :api_token, :api_secret
|
9
|
+
|
10
|
+
include Whatconverts::Client::Account
|
11
|
+
include Whatconverts::Client::Lead
|
12
|
+
include Whatconverts::Client::Profile
|
5
13
|
|
6
14
|
def initialize
|
7
15
|
yield self if block_given?
|
8
16
|
end
|
9
17
|
|
10
|
-
def leads(params = {})
|
11
|
-
http_service.make_request('leads', params)
|
12
|
-
end
|
13
|
-
|
14
|
-
def lead(lead_id, params = {})
|
15
|
-
http_service.make_request("leads/#{lead_id}", params)
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_lead(params = {})
|
19
|
-
params.merge!(method: :post)
|
20
|
-
http_service.make_request('leads', params)
|
21
|
-
end
|
22
|
-
|
23
|
-
def edit_lead(lead_id, params = {})
|
24
|
-
params.merge!(method: :post)
|
25
|
-
http_service.make_request("leads/#{lead_id}", params)
|
26
|
-
end
|
27
|
-
|
28
18
|
private
|
29
19
|
|
30
20
|
def http_service
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Whatconverts
|
2
|
+
class Client
|
3
|
+
module Account
|
4
|
+
def accounts(params= {})
|
5
|
+
http_service.make_request('accounts', params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def account(account_id, params = {})
|
9
|
+
http_service.make_request("accounts/#{account_id}", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_account(params = {})
|
13
|
+
params.merge!(method: :post)
|
14
|
+
http_service.make_request('accounts', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit_account(account_id, params = {})
|
18
|
+
params.merge!(method: :post)
|
19
|
+
http_service.make_request("accounts/#{account_id}", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_account(account_id, params = {})
|
23
|
+
params.merge!(method: :delete)
|
24
|
+
http_service.make_request("accounts/#{account_id}", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Whatconverts
|
2
|
+
class Client
|
3
|
+
module Lead
|
4
|
+
def leads(params = {})
|
5
|
+
http_service.make_request('leads', params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def lead(lead_id, params = {})
|
9
|
+
http_service.make_request("leads/#{lead_id}", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_lead(params = {})
|
13
|
+
params.merge!(method: :post)
|
14
|
+
http_service.make_request('leads', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit_lead(lead_id, params = {})
|
18
|
+
params.merge!(method: :post)
|
19
|
+
http_service.make_request("leads/#{lead_id}", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Whatconverts
|
2
|
+
class Client
|
3
|
+
module Profile
|
4
|
+
def profiles(account_id, params = {})
|
5
|
+
http_service.make_request("accounts/#{account_id}/profiles", params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def profile(account_id, profile_id, params = {})
|
9
|
+
http_service.make_request("accounts/#{account_id}/profiles/#{profile_id}", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_profile(account_id, params = {})
|
13
|
+
params.merge!(method: :post)
|
14
|
+
http_service.make_request("accounts/#{account_id}/profiles", params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def edit_profile(account_id, profile_id, params = {})
|
18
|
+
params.merge!(method: :post)
|
19
|
+
http_service.make_request("accounts/#{account_id}/profiles/#{profile_id}", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_profile(account_id, profile_id, params = {})
|
23
|
+
params.merge!(method: :delete)
|
24
|
+
http_service.make_request("accounts/#{account_id}/profiles/#{profile_id}", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/whatconverts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatconverts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Giancaspro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,6 +112,9 @@ files:
|
|
112
112
|
- bin/setup
|
113
113
|
- lib/whatconverts.rb
|
114
114
|
- lib/whatconverts/client.rb
|
115
|
+
- lib/whatconverts/client/account.rb
|
116
|
+
- lib/whatconverts/client/lead.rb
|
117
|
+
- lib/whatconverts/client/profile.rb
|
115
118
|
- lib/whatconverts/error_checker.rb
|
116
119
|
- lib/whatconverts/errors.rb
|
117
120
|
- lib/whatconverts/http_service.rb
|