infusionsoft 1.3.6 → 1.3.7

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
  SHA256:
3
- metadata.gz: be1e1c882fe2d8da54871579f1029caa28e717f3088136d6a87b41d021880ba2
4
- data.tar.gz: ec9a18d42d97f134cb5ebcfe258df7e609bb2c20e9d562f8630e3fdbd8469776
3
+ metadata.gz: f1275315611fc4ff75ceb74198951b6d3fe809ed77906f1c9c568db3e672a70b
4
+ data.tar.gz: 570767ff5aad3a6da5c772a08d94edbf9b244a2ac4c83a4a422c442b982f51e2
5
5
  SHA512:
6
- metadata.gz: 218348412f313f1b9fa024774d27ecf54f6347212a24bfc5639ffab6a87ab8f746de980440166a2550e175a6b709c5e679b1bc219b41170f3056de77440e1c86
7
- data.tar.gz: d19d06afba34be09b47223775f6c079ec6863fa4783d933c0c0daa6aec1e51f84c27e63cf8e767f30deb679bf6b965363db69ea204803057199570aa5546c5d8
6
+ metadata.gz: 2d48c27e57a4acfa4fa547b95925f9edc76f824fcb0a202fb07e6ffdcd14b8b7872d39af6263ad732b919d2b2a1d1cb9bf8cbce73dd2fa33a098022b4bfb7ef2
7
+ data.tar.gz: 15f79ff31fb9d392034c9e7fe2a871a32d8268d5d2d380ca41a59cc26cd1d7c45e7c9c1f0c90265ce79954134fd6d0ef65018715be482eaa88b4da22b7baab4d
data/.travis.yml CHANGED
@@ -1,7 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.8
4
- - 2.4.5
5
- - 2.5.3
6
- - 2.6.1
7
- - jruby-20mode # JRuby in 2.0 mode
3
+ - 3.0.1
data/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  A Ruby wrapper for the Infusionsoft API
7
7
 
8
8
  **update notes**
9
+ * v1.3.6 - Ruby v3 compatibility
9
10
  * v1.3.5 - Rest API is now supported (documentation incoming)
10
11
  * v1.2.2 - Catching Infusionsoft API SSL handshake issues
11
12
  * v1.2.1 - Added OAuth support
@@ -17,7 +18,8 @@ A Ruby wrapper for the Infusionsoft API
17
18
  * v1.1.5 - Added a custom logger option. This will allow you to track all api calls/results in a separate log file. Defaults to $stdout if none is specified. To add logger specify `api_logger` in your [config block](#setup--configuration).
18
19
 
19
20
  ## <a name="installation">Installation</a>
20
- gem install infusionsoft
21
+ ruby 3.* gem install infusionsoft
22
+ ruby 2.* gem install infusionsoft -v 1.3.5
21
23
 
22
24
  ## <a name="documentation">Documentation</a>
23
25
  [http://rubydoc.info/gems/infusionsoft](http://rubydoc.info/gems/infusionsoft)
@@ -0,0 +1,39 @@
1
+ module Infusionsoft
2
+ class Client
3
+ # The Order service allows you to create a new Order.
4
+ module Order
5
+ # Creates a new order.
6
+ #
7
+ # @param [Integer] contact_id
8
+ # ID of the order's Contact (0 is not a valid ID).
9
+ # @param [Integer] card_id
10
+ # ID of the card to charge. To skip charging a card, set to "0".
11
+ # @param [Integer] plan_id
12
+ # ID of the payment plan to use when creating the order. If not
13
+ # specified, the default plan is used.
14
+ # @param [Array<Integer>] product_ids
15
+ # A list of integers representing the products to add to the order.
16
+ # This cannot be emtpy if a subscription is not specified.
17
+ # @param [Array<Integer>] subscription_ids
18
+ # A list of integers representing the subscription(s) to add to the
19
+ # order. This cannot be empty if a product ID is not specified.
20
+ # @param [Boolean] process_specials
21
+ # Whether or not the order should consider discounts that would normally
22
+ # be applied if this order was placed through the shopping cart.
23
+ # @param [Array<String>] promo_codes
24
+ # Promo codes to add to the cart; only used if processing of specials
25
+ # is turned on.
26
+ # @param [Integer] lead_affiliate_id
27
+ # ID of the lead affiliate (0 should be used if none).
28
+ # @param [Integer] sale_affiliate_id
29
+ # ID of the sale affiliate (0 should be used if none).
30
+ # @return [Hash] The result of order placement with IDs of the order and
31
+ # invoice that were created and the status of a credit card charge
32
+ # (if applicable).
33
+ # {'Successful' => [Boolean], 'Message' => [String], 'RefNum' => [String], 'OrderId' => [String], 'InvoiceId' => [String], 'Code' => [String]}
34
+ def place_order(contact_id, card_id, plan_id, product_ids, subscription_ids, process_specials, promo_codes, lead_affiliate_id, sale_affiliate_id)
35
+ response = xmlrpc('OrderService.placeOrder', contact_id, card_id, plan_id, product_ids, subscription_ids, process_specials, promo_codes, lead_affiliate_id, sale_affiliate_id)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -8,6 +8,7 @@ module Infusionsoft
8
8
  # Client-namespaced.
9
9
  require 'infusionsoft/client/contact'
10
10
  require 'infusionsoft/client/email'
11
+ require 'infusionsoft/client/order'
11
12
  require 'infusionsoft/client/invoice'
12
13
  require 'infusionsoft/client/data'
13
14
  require 'infusionsoft/client/affiliate'
@@ -19,6 +20,7 @@ module Infusionsoft
19
20
 
20
21
  include Infusionsoft::Client::Contact
21
22
  include Infusionsoft::Client::Email
23
+ include Infusionsoft::Client::Order
22
24
  include Infusionsoft::Client::Invoice
23
25
  include Infusionsoft::Client::Data
24
26
  include Infusionsoft::Client::Affiliate
@@ -8,33 +8,33 @@ module Infusionsoft
8
8
  end
9
9
 
10
10
  # Perform an GET request
11
- def get(path, token, query: {})
12
- request(:get, path, token, query: query )
11
+ def get(path, token, query: {}, version: 'v1')
12
+ request(:get, path, token, query: query, version)
13
13
  end
14
14
 
15
- def post(path, token, query: {}, payload: {})
16
- request(:post, path, token, query, payload)
15
+ def post(path, token, query: {}, payload: {}, version: 'v1')
16
+ request(:post, path, token, query, payload, version)
17
17
  end
18
18
 
19
19
  # Perform an HTTP PUT request
20
- def put(path, token, query: {}, payload: {})
21
- request(:put, path, token, query, payload)
20
+ def put(path, token, query: {}, payload: {}, version: 'v1')
21
+ request(:put, path, token, query, payload, version)
22
22
  end
23
23
 
24
24
  # Perform an HTTP PATCH request
25
- def patch(path, token, query: {}, payload: {})
26
- request(:patch, path, token, query, payload)
25
+ def patch(path, token, query: {}, payload: {}, version: 'v1')
26
+ request(:patch, path, token, query, payload, version)
27
27
  end
28
28
 
29
29
  # Perform an HTTP DELETE request
30
- def delete(path, token, query: {})
31
- request(:delete, path, token, query)
30
+ def delete(path, token, query: {}, version: 'v1')
31
+ request(:delete, path, token, query, version)
32
32
  end
33
33
 
34
34
  private
35
35
 
36
36
  # Perform request
37
- def request(method, path, token, query={}, payload={})
37
+ def request(method, path, token, query={}, payload={}, version)
38
38
  path = "/#{path}" unless path.start_with?('/')
39
39
  header = {
40
40
  authorization: "Bearer #{token.access_token}",
@@ -44,15 +44,18 @@ module Infusionsoft
44
44
  }
45
45
  opts = {
46
46
  method: method,
47
- url: "https://api.infusionsoft.com/crm/rest/v1" + path,
47
+ url: "https://api.infusionsoft.com/crm/rest/#{version}" + path,
48
48
  headers: header
49
49
  }
50
50
  opts.merge!( { payload: payload.to_json }) unless payload.empty?
51
51
  resp = RestClient::Request.execute(opts)
52
- rescue RestClient::ExceptionWithResponse => err
53
- # log error?
54
- else
55
52
  return JSON.parse(resp.body) if resp.body # Some calls respond w nothing
53
+ rescue RestClient::ExceptionWithResponse => err
54
+ api_logger.error "[ERROR]: #{err}"
55
+ rescue => err
56
+ # RestClient::Unauthorized & SocketError
57
+ api_logger.error "[ERROR]: #{err}"
58
+ raise
56
59
  end
57
60
  end
58
61
  end
@@ -1,4 +1,4 @@
1
1
  module Infusionsoft
2
2
  # The version of the gem
3
- VERSION = '1.3.6'.freeze unless defined?(::Infusionsoft::VERSION)
3
+ VERSION = '1.3.7'.freeze unless defined?(::Infusionsoft::VERSION)
4
4
  end
@@ -0,0 +1,11 @@
1
+ require_relative('../test_helper')
2
+
3
+ class OrderTest < Test::Unit::TestCase
4
+ def test_create_new_order
5
+ # VCR.use_cassette('order_create') do
6
+ # result = Infusionsoft.place_order(4095, 0, nil, [1], nil, false, [], 0, 0)
7
+
8
+ # assert_instance_of Hash, result
9
+ # end
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infusionsoft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Leavitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -78,6 +78,7 @@ files:
78
78
  - lib/infusionsoft/client/file.rb
79
79
  - lib/infusionsoft/client/funnel.rb
80
80
  - lib/infusionsoft/client/invoice.rb
81
+ - lib/infusionsoft/client/order.rb
81
82
  - lib/infusionsoft/client/search.rb
82
83
  - lib/infusionsoft/client/ticket.rb
83
84
  - lib/infusionsoft/client/version.rb
@@ -92,6 +93,7 @@ files:
92
93
  - test/client/data_test.rb
93
94
  - test/client/email_test.rb
94
95
  - test/client/invoice_test.rb
96
+ - test/client/order_test.rb
95
97
  - test/exceptions_test.rb
96
98
  - test/test_helper.rb
97
99
  - test/vcr_cassettes/add_to_group.yml
@@ -131,7 +133,7 @@ files:
131
133
  homepage: https://github.com/nateleavitt/infusionsoft
132
134
  licenses: []
133
135
  metadata: {}
134
- post_install_message:
136
+ post_install_message:
135
137
  rdoc_options: []
136
138
  require_paths:
137
139
  - lib
@@ -146,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
148
  - !ruby/object:Gem::Version
147
149
  version: 1.3.6
148
150
  requirements: []
149
- rubygems_version: 3.2.3
150
- signing_key:
151
+ rubygems_version: 3.5.17
152
+ signing_key:
151
153
  specification_version: 4
152
154
  summary: Ruby wrapper for the Infusionsoft API
153
155
  test_files: []