infusion 0.0.5 → 0.0.6
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.
- data/lib/infusion.rb +22 -12
- data/lib/infusion.rb~ +2 -5
- data/lib/infusion/version.rb +1 -1
- metadata +2 -2
data/lib/infusion.rb
CHANGED
@@ -5,16 +5,26 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
|
7
7
|
module Infusion
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
|
9
|
+
def self.file_path(file)
|
10
|
+
|
11
|
+
begin
|
12
|
+
config = YAML::load(IO.read(file))
|
13
|
+
rescue => e
|
14
|
+
raise "YAML configuration file couldn't be found: #{e}"
|
15
|
+
end
|
16
|
+
|
17
|
+
$key = config["config"]["key"]
|
18
|
+
server = config["config"]["server"]
|
19
|
+
$server = XMLRPC::Client.new2(server)
|
20
|
+
end
|
21
|
+
|
12
22
|
#method for get the data from the table
|
13
23
|
|
14
24
|
def self.data_load(table, id, selected_fields)
|
15
25
|
attempts = 0
|
16
26
|
begin
|
17
|
-
main_product =
|
27
|
+
main_product = $server.call("DataService.load", $key,table, id, selected_fields)
|
18
28
|
rescue Exception
|
19
29
|
attempts += 1
|
20
30
|
retry unless attempts > 1000
|
@@ -27,14 +37,14 @@ module Infusion
|
|
27
37
|
# method to opt in email
|
28
38
|
|
29
39
|
def self.optin(email, message)
|
30
|
-
|
40
|
+
$server.call("APIEmailService.optIn", $key,email,message)
|
31
41
|
end
|
32
42
|
|
33
43
|
# method for find email from IS
|
34
44
|
def self.findByEmail(email, contact_info)
|
35
45
|
attempts = 0
|
36
46
|
begin
|
37
|
-
|
47
|
+
$server.call("ContactService.findByEmail", $key, email,contact_info)
|
38
48
|
rescue Exception
|
39
49
|
attempts += 1
|
40
50
|
retry unless attempts > 1000
|
@@ -48,7 +58,7 @@ module Infusion
|
|
48
58
|
def self.add_contact(contact)
|
49
59
|
attempts = 0
|
50
60
|
begin
|
51
|
-
server.call("ContactService.add",
|
61
|
+
$server.call("ContactService.add", $key, contact)
|
52
62
|
rescue Exception
|
53
63
|
attempts += 1
|
54
64
|
retry unless attempts > 1000
|
@@ -62,7 +72,7 @@ module Infusion
|
|
62
72
|
def self.update(user_id, contact)
|
63
73
|
attempts = 0
|
64
74
|
begin
|
65
|
-
|
75
|
+
$server.call("ContactService.update", $key,user_id,contact)
|
66
76
|
rescue Exception
|
67
77
|
attempts += 1
|
68
78
|
retry unless attempts > 1000
|
@@ -76,7 +86,7 @@ module Infusion
|
|
76
86
|
def self.merge(user_id, merge_id)
|
77
87
|
attempts = 0
|
78
88
|
begin
|
79
|
-
|
89
|
+
$server.call("ContactService.merge", $key,user_id, merge_id)
|
80
90
|
rescue Exception
|
81
91
|
attempts += 1
|
82
92
|
retry unless attempts > 1000
|
@@ -90,7 +100,7 @@ module Infusion
|
|
90
100
|
def self.campaign(results, campaign_id)
|
91
101
|
attempts = 0
|
92
102
|
begin
|
93
|
-
|
103
|
+
$server.call("ContactService.addToGroup",$key,results,campaign_id)
|
94
104
|
rescue Exception
|
95
105
|
attempts += 1
|
96
106
|
retry unless attempts > 1000
|
@@ -105,7 +115,7 @@ module Infusion
|
|
105
115
|
def self.query(query, fields)
|
106
116
|
attempts = 0
|
107
117
|
begin
|
108
|
-
|
118
|
+
$server.call("DataService.query",$ key,"RecurringOrder",10,0,query,fields)
|
109
119
|
rescue Exception
|
110
120
|
attempts += 1
|
111
121
|
retry unless attempts > 1000
|
data/lib/infusion.rb~
CHANGED
@@ -5,7 +5,7 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
|
7
7
|
module Infusion
|
8
|
-
config = YAML.load_file("config.yml")
|
8
|
+
config = YAML.load_file("#{RAILS_ROOT}/config/config.yml")
|
9
9
|
@key = config["config"]["key"]
|
10
10
|
server = config["config"]["server"]
|
11
11
|
@server = XMLRPC::Client.new2(server)
|
@@ -114,12 +114,9 @@ module Infusion
|
|
114
114
|
puts "ensure! #{attempts}"
|
115
115
|
end
|
116
116
|
end
|
117
|
-
|
118
|
-
# Delegate to ApiInfusionsoft::Client
|
119
|
-
def method_missing(method, *args, &block)
|
117
|
+
def method_missing(method, *args, &block)
|
120
118
|
return super unless new.respond_to?(method)
|
121
119
|
new.send(method, *args, &block)
|
122
120
|
end
|
123
|
-
|
124
121
|
|
125
122
|
end
|
data/lib/infusion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|