infusion 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +26 -0
- data/lib/infusion.rb +99 -74
- data/lib/infusion/version.rb +1 -1
- metadata +13 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8fe44918c5106d9d98c50883b86a039432cce6f9
|
4
|
+
data.tar.gz: c8e53effcb1a665ca904f1d26fc7f6df594589ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1166d9e05661aa719def87b3fa8988299f1407886666d2504896f285409a0dac9c2fb4c066e38a9a6bb06c5a757abb8f150fee9a89bf7e07d9b92bc27e3f083c
|
7
|
+
data.tar.gz: b6e614b96d015cbc0f66f5bb974f05a0c27976123a764d7f008da99138e42d223879ab417094ff4d9215c59595fb9047bd061ae75c45b5e33f9bfcb5e042bee5
|
data/README.md
CHANGED
@@ -57,6 +57,32 @@ config/initializers/infusion.rb
|
|
57
57
|
|
58
58
|
Infusion.campaign(contact_id, campaign_id)
|
59
59
|
|
60
|
+
|
61
|
+
To retrive order Id from contact there is job table for order in infusionsoft:
|
62
|
+
|
63
|
+
fields = ["Id", "DateCreated", "JobNotes", "JobTitle", "JobStatus"]
|
64
|
+
|
65
|
+
Order Details of user retrieve order:
|
66
|
+
|
67
|
+
query = {:ContactId => params[:ContactID] }
|
68
|
+
|
69
|
+
Infusion.order(query, fields)
|
70
|
+
|
71
|
+
To find last order_id that is latest created order:
|
72
|
+
|
73
|
+
order_details.last["ID"]
|
74
|
+
|
75
|
+
To retrive order items from order_id :
|
76
|
+
|
77
|
+
fields = ["ProductId", "SubscriptionPlanId", "ItemName", "Qty"]
|
78
|
+
|
79
|
+
Order Details of user retrieve order:
|
80
|
+
|
81
|
+
query = {:OrderId => params[:orderId] }
|
82
|
+
|
83
|
+
Infusion.orderitems(query, fields)
|
84
|
+
|
85
|
+
|
60
86
|
Find by query this method is for to check subscription:
|
61
87
|
|
62
88
|
fields = ["ProductId", "SubscriptionPlanId", "ItemName", "Qty"]
|
data/lib/infusion.rb
CHANGED
@@ -7,129 +7,154 @@ require 'yaml'
|
|
7
7
|
module Infusion
|
8
8
|
|
9
9
|
def self.file_path(file)
|
10
|
-
|
11
10
|
begin
|
12
11
|
config = YAML::load(IO.read(file))
|
13
12
|
rescue => e
|
14
13
|
raise "YAML configuration file couldn't be found: #{e}"
|
15
14
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
$server = XMLRPC::Client.new2(server)
|
15
|
+
$key = config["key"]
|
16
|
+
server = config["server"]
|
17
|
+
$server = XMLRPC::Client.new2(server)
|
20
18
|
end
|
21
19
|
|
22
20
|
#method for get the data from the table
|
23
21
|
|
24
|
-
|
22
|
+
def self.data_load(table, id, selected_fields)
|
25
23
|
attempts = 0
|
26
|
-
|
24
|
+
begin
|
27
25
|
main_product = $server.call("DataService.load", $key,table, id, selected_fields)
|
28
26
|
rescue Exception
|
29
27
|
attempts += 1
|
30
28
|
retry unless attempts > 1000
|
31
29
|
exit -1
|
32
30
|
ensure
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
puts "ensure! #{attempts}"
|
32
|
+
end
|
33
|
+
end
|
36
34
|
|
37
35
|
# method to opt in email
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
def self.optin(email, message)
|
38
|
+
$server.call("APIEmailService.optIn", $key,email,message)
|
39
|
+
end
|
42
40
|
|
43
41
|
# method for find email from IS
|
44
42
|
def self.findByEmail(email, contact_info)
|
45
43
|
attempts = 0
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
begin
|
45
|
+
$server.call("ContactService.findByEmail", $key, email,contact_info)
|
46
|
+
rescue Exception
|
47
|
+
attempts += 1
|
50
48
|
retry unless attempts > 1000
|
51
|
-
|
49
|
+
exit -1
|
52
50
|
ensure
|
53
|
-
|
54
|
-
|
51
|
+
puts "ensure! #{attempts}"
|
52
|
+
end
|
55
53
|
end
|
56
54
|
|
57
55
|
# method for contact add
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
def self.add_contact(contact)
|
57
|
+
attempts = 0
|
58
|
+
begin
|
59
|
+
$server.call("ContactService.add", $key, contact)
|
60
|
+
rescue Exception
|
61
|
+
attempts += 1
|
64
62
|
retry unless attempts > 1000
|
65
|
-
|
63
|
+
exit -1
|
66
64
|
ensure
|
67
|
-
|
65
|
+
puts "ensure! #{attempts}"
|
68
66
|
end
|
69
|
-
|
67
|
+
end
|
70
68
|
|
71
69
|
# method for update the contact_info
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
70
|
+
def self.update(user_id, contact)
|
71
|
+
attempts = 0
|
72
|
+
begin
|
73
|
+
$server.call("ContactService.update", $key,user_id,contact)
|
74
|
+
rescue Exception
|
75
|
+
attempts += 1
|
76
|
+
retry unless attempts > 1000
|
77
|
+
exit -1
|
78
|
+
ensure
|
79
|
+
puts "ensure! #{attempts}"
|
80
|
+
end
|
81
|
+
end
|
84
82
|
|
85
83
|
# method for merge contacts
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
84
|
+
def self.merge(user_id, merge_id)
|
85
|
+
attempts = 0
|
86
|
+
begin
|
87
|
+
$server.call("ContactService.merge", $key,user_id, merge_id)
|
88
|
+
rescue Exception
|
89
|
+
attempts += 1
|
92
90
|
retry unless attempts > 1000
|
93
|
-
|
91
|
+
exit -1
|
94
92
|
ensure
|
95
|
-
|
96
|
-
|
97
|
-
|
93
|
+
puts "ensure! #{attempts}"
|
94
|
+
end
|
95
|
+
end
|
98
96
|
|
99
97
|
# method for add contact to campaign
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
end
|
98
|
+
def self.campaign(results, campaign_id)
|
99
|
+
attempts = 0
|
100
|
+
begin
|
101
|
+
$server.call("ContactService.addToGroup",$key,results,campaign_id)
|
102
|
+
rescue Exception
|
103
|
+
attempts += 1
|
104
|
+
retry unless attempts > 1000
|
105
|
+
exit -1
|
106
|
+
ensure
|
107
|
+
puts "ensure! #{attempts}"
|
108
|
+
end
|
109
|
+
end
|
113
110
|
|
114
111
|
# find by query this method is for to check subscription
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
def self.query(query, fields)
|
113
|
+
attempts = 0
|
114
|
+
begin
|
115
|
+
$server.call("DataService.query",$key,"RecurringOrder",10,0,query,fields)
|
116
|
+
rescue Exception
|
117
|
+
attempts += 1
|
118
|
+
retry unless attempts > 1000
|
119
|
+
exit -1
|
120
|
+
ensure
|
121
|
+
puts "ensure! #{attempts}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
#Find the order from contact id
|
126
|
+
def self.order(query, fields)
|
127
|
+
attempts = 0
|
128
|
+
begin
|
129
|
+
$server.call("DataService.query",key,"Job",10,0,query,fields )
|
130
|
+
rescue Exception
|
131
|
+
attempts += 1
|
132
|
+
retry unless attempts > 1000
|
133
|
+
exit -1
|
134
|
+
ensure
|
135
|
+
puts "ensure! #{attempts}"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Find the order iteams from order_id
|
140
|
+
def self.orderitems(query, fields)
|
141
|
+
attempts = 0
|
142
|
+
begin
|
143
|
+
$server.call("DataService.query",key,"OrderItem",10,0,query,fields )
|
144
|
+
rescue Exception
|
145
|
+
attempts += 1
|
121
146
|
retry unless attempts > 1000
|
122
|
-
|
147
|
+
exit -1
|
123
148
|
ensure
|
124
|
-
|
125
|
-
|
149
|
+
puts "ensure! #{attempts}"
|
150
|
+
end
|
126
151
|
end
|
127
152
|
|
128
153
|
# Delegate to ApiInfusionsoft::Client
|
129
154
|
def method_missing(method, *args, &block)
|
130
155
|
return super unless new.respond_to?(method)
|
131
156
|
new.send(method, *args, &block)
|
132
|
-
|
157
|
+
end
|
133
158
|
|
134
159
|
|
135
160
|
end
|
data/lib/infusion/version.rb
CHANGED
metadata
CHANGED
@@ -1,56 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.12
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jagdish.Barabari
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
|
-
description:
|
41
|
+
description: 'A custom Ruby wrapper for the Infusionsoft API '
|
47
42
|
email:
|
48
43
|
- jagdish.barabari@example.com
|
49
44
|
executables: []
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
54
49
|
- Gemfile
|
55
50
|
- LICENSE.txt
|
56
51
|
- README.md
|
@@ -61,26 +56,25 @@ files:
|
|
61
56
|
homepage: ''
|
62
57
|
licenses:
|
63
58
|
- MIT
|
59
|
+
metadata: {}
|
64
60
|
post_install_message:
|
65
61
|
rdoc_options: []
|
66
62
|
require_paths:
|
67
63
|
- lib
|
68
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - ">="
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
70
|
requirements:
|
77
|
-
- -
|
71
|
+
- - ">="
|
78
72
|
- !ruby/object:Gem::Version
|
79
73
|
version: '0'
|
80
74
|
requirements: []
|
81
75
|
rubyforge_project: infusion
|
82
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.2.2
|
83
77
|
signing_key:
|
84
|
-
specification_version:
|
78
|
+
specification_version: 4
|
85
79
|
summary: Methods includes add, update contact to IS and campaign setup
|
86
80
|
test_files: []
|