infusion 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -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"]
@@ -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
- $key = config["key"]
18
- server = config["server"]
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
- def self.data_load(table, id, selected_fields)
22
+ def self.data_load(table, id, selected_fields)
25
23
  attempts = 0
26
- begin
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
- puts "ensure! #{attempts}"
34
- end
35
- end
31
+ puts "ensure! #{attempts}"
32
+ end
33
+ end
36
34
 
37
35
  # method to opt in email
38
36
 
39
- def self.optin(email, message)
40
- $server.call("APIEmailService.optIn", $key,email,message)
41
- end
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
- begin
47
- $server.call("ContactService.findByEmail", $key, email,contact_info)
48
- rescue Exception
49
- attempts += 1
44
+ begin
45
+ $server.call("ContactService.findByEmail", $key, email,contact_info)
46
+ rescue Exception
47
+ attempts += 1
50
48
  retry unless attempts > 1000
51
- exit -1
49
+ exit -1
52
50
  ensure
53
- puts "ensure! #{attempts}"
54
- end
51
+ puts "ensure! #{attempts}"
52
+ end
55
53
  end
56
54
 
57
55
  # method for contact add
58
- def self.add_contact(contact)
59
- attempts = 0
60
- begin
61
- $server.call("ContactService.add", $key, contact)
62
- rescue Exception
63
- attempts += 1
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
- exit -1
63
+ exit -1
66
64
  ensure
67
- puts "ensure! #{attempts}"
65
+ puts "ensure! #{attempts}"
68
66
  end
69
- end
67
+ end
70
68
 
71
69
  # method for update the contact_info
72
- def self.update(user_id, contact)
73
- attempts = 0
74
- begin
75
- $server.call("ContactService.update", $key,user_id,contact)
76
- rescue Exception
77
- attempts += 1
78
- retry unless attempts > 1000
79
- exit -1
80
- ensure
81
- puts "ensure! #{attempts}"
82
- end
83
- end
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
- def self.merge(user_id, merge_id)
87
- attempts = 0
88
- begin
89
- $server.call("ContactService.merge", $key,user_id, merge_id)
90
- rescue Exception
91
- attempts += 1
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
- exit -1
91
+ exit -1
94
92
  ensure
95
- puts "ensure! #{attempts}"
96
- end
97
- end
93
+ puts "ensure! #{attempts}"
94
+ end
95
+ end
98
96
 
99
97
  # method for add contact to campaign
100
- def self.campaign(results, campaign_id)
101
- attempts = 0
102
- begin
103
- $server.call("ContactService.addToGroup",$key,results,campaign_id)
104
- rescue Exception
105
- attempts += 1
106
- retry unless attempts > 1000
107
- exit -1
108
- ensure
109
- puts "ensure! #{attempts}"
110
- end
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
- def self.query(query, fields)
116
- attempts = 0
117
- begin
118
- $server.call("DataService.query",$key,"RecurringOrder",10,0,query,fields)
119
- rescue Exception
120
- attempts += 1
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
- exit -1
147
+ exit -1
123
148
  ensure
124
- puts "ensure! #{attempts}"
125
- end
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
- end
157
+ end
133
158
 
134
159
 
135
160
  end
@@ -1,3 +1,3 @@
1
1
  module Infusion
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
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.11
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: 2013-10-07 00:00:00.000000000 Z
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: ! 'A custom Ruby wrapper for the Infusionsoft API '
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: 1.8.25
76
+ rubygems_version: 2.2.2
83
77
  signing_key:
84
- specification_version: 3
78
+ specification_version: 4
85
79
  summary: Methods includes add, update contact to IS and campaign setup
86
80
  test_files: []