lipstick 1.1.0 → 1.1.1
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/Gemfile +3 -5
- data/Gemfile.lock +5 -7
- data/VERSION +1 -1
- data/lib/lipstick/api/session.rb +2 -0
- data/lipstick.gemspec +2 -11
- metadata +6 -25
- data/test/helper.rb +0 -81
- data/test/test_lipstick.rb +0 -193
- data/test/test_order_view_response.rb +0 -127
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a01557fa604a5f9ad86aa8bc268ede3ec301d131
|
|
4
|
+
data.tar.gz: 1a3d103d15de493d1705cd1c8ea91e61406df399
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07025105959ae4270a540eecbdd1c1429b010e56a0e9c43b37adac4bc058a555289495fd9cd8d837700b621889677ee03098ee6993ecd1bcaaed598e463a4487
|
|
7
|
+
data.tar.gz: 391a62bdccf82a09d6776f8b506c3729a32edc967f6e11d12ecb84ca84cf279391482a1add2b80ae1ad938a1f366da126c665857f6ceffcf26bced63f4e73c4a
|
data/Gemfile
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
gem 'rake'
|
|
4
|
+
gem 'yard' # Documentation generator
|
|
5
5
|
|
|
6
6
|
# Add dependencies to develop your gem here.
|
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
|
8
8
|
group :development do
|
|
9
9
|
gem "minitest", ">= 0"
|
|
10
|
-
gem "yard", "~> 0.7"
|
|
11
|
-
gem "rdoc", "~> 3.12"
|
|
12
10
|
gem "bundler", "~> 1.0"
|
|
13
11
|
gem "simplecov", ">= 0"
|
|
14
12
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -2,17 +2,15 @@ GEM
|
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
4
|
docile (1.1.5)
|
|
5
|
-
json (1.8.1)
|
|
6
5
|
minitest (5.4.2)
|
|
7
6
|
multi_json (1.11.2)
|
|
8
|
-
|
|
9
|
-
json (~> 1.4)
|
|
7
|
+
rake (12.3.0)
|
|
10
8
|
simplecov (0.9.1)
|
|
11
9
|
docile (~> 1.1.0)
|
|
12
10
|
multi_json (~> 1.0)
|
|
13
11
|
simplecov-html (~> 0.8.0)
|
|
14
12
|
simplecov-html (0.8.0)
|
|
15
|
-
yard (0.
|
|
13
|
+
yard (0.9.12)
|
|
16
14
|
|
|
17
15
|
PLATFORMS
|
|
18
16
|
ruby
|
|
@@ -20,9 +18,9 @@ PLATFORMS
|
|
|
20
18
|
DEPENDENCIES
|
|
21
19
|
bundler (~> 1.0)
|
|
22
20
|
minitest
|
|
23
|
-
|
|
21
|
+
rake
|
|
24
22
|
simplecov
|
|
25
|
-
yard
|
|
23
|
+
yard
|
|
26
24
|
|
|
27
25
|
BUNDLED WITH
|
|
28
|
-
1.
|
|
26
|
+
1.15.4
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.1
|
data/lib/lipstick/api/session.rb
CHANGED
data/lipstick.gemspec
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "lipstick"
|
|
3
|
-
s.version = "1.1.
|
|
3
|
+
s.version = "1.1.1"
|
|
4
4
|
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
6
6
|
s.require_paths = ["lib"]
|
|
7
7
|
s.authors = ["Piers Chambers"]
|
|
8
|
-
s.date = "2017-04-07"
|
|
9
8
|
s.description = "Unofficial ruby wrapper for the Lime Light CRM membership and transaction APIs"
|
|
10
9
|
s.email = "piers@varyonic.com"
|
|
11
|
-
s.extra_rdoc_files = [
|
|
12
|
-
"LICENSE.txt",
|
|
13
|
-
"README.md"
|
|
14
|
-
]
|
|
15
10
|
s.files = [
|
|
16
11
|
".document",
|
|
17
12
|
"Gemfile",
|
|
@@ -31,9 +26,6 @@ Gem::Specification.new do |s|
|
|
|
31
26
|
"lib/lipstick/api/response.rb",
|
|
32
27
|
"lib/lipstick/api/session.rb",
|
|
33
28
|
"lipstick.gemspec",
|
|
34
|
-
"test/helper.rb",
|
|
35
|
-
"test/test_lipstick.rb",
|
|
36
|
-
"test/test_order_view_response.rb"
|
|
37
29
|
]
|
|
38
30
|
s.homepage = "http://github.com/varyonic/lipstick"
|
|
39
31
|
s.licenses = ["MIT"]
|
|
@@ -41,8 +33,7 @@ Gem::Specification.new do |s|
|
|
|
41
33
|
s.summary = "Unofficial ruby wrapper for the Lime Light CRM APIs."
|
|
42
34
|
|
|
43
35
|
s.add_development_dependency(%q<minitest>, ["~> 0"])
|
|
44
|
-
s.add_development_dependency(%q<yard>, ["~> 0.
|
|
45
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
|
36
|
+
s.add_development_dependency(%q<yard>, ["~> 0.9.11"])
|
|
46
37
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
|
47
38
|
s.add_development_dependency(%q<simplecov>, ["~> 0"])
|
|
48
39
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lipstick
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Piers Chambers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -30,28 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.9.11
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rdoc
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3.12'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '3.12'
|
|
40
|
+
version: 0.9.11
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: bundler
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -85,9 +71,7 @@ description: Unofficial ruby wrapper for the Lime Light CRM membership and trans
|
|
|
85
71
|
email: piers@varyonic.com
|
|
86
72
|
executables: []
|
|
87
73
|
extensions: []
|
|
88
|
-
extra_rdoc_files:
|
|
89
|
-
- LICENSE.txt
|
|
90
|
-
- README.md
|
|
74
|
+
extra_rdoc_files: []
|
|
91
75
|
files:
|
|
92
76
|
- ".document"
|
|
93
77
|
- Gemfile
|
|
@@ -107,9 +91,6 @@ files:
|
|
|
107
91
|
- lib/lipstick/api/response.rb
|
|
108
92
|
- lib/lipstick/api/session.rb
|
|
109
93
|
- lipstick.gemspec
|
|
110
|
-
- test/helper.rb
|
|
111
|
-
- test/test_lipstick.rb
|
|
112
|
-
- test/test_order_view_response.rb
|
|
113
94
|
homepage: http://github.com/varyonic/lipstick
|
|
114
95
|
licenses:
|
|
115
96
|
- MIT
|
|
@@ -130,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
111
|
version: '0'
|
|
131
112
|
requirements: []
|
|
132
113
|
rubyforge_project:
|
|
133
|
-
rubygems_version: 2.
|
|
114
|
+
rubygems_version: 2.4.8
|
|
134
115
|
signing_key:
|
|
135
116
|
specification_version: 4
|
|
136
117
|
summary: Unofficial ruby wrapper for the Lime Light CRM APIs.
|
data/test/helper.rb
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
|
-
|
|
3
|
-
module SimpleCov::Configuration
|
|
4
|
-
def clean_filters
|
|
5
|
-
@filters = []
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
SimpleCov.configure do
|
|
10
|
-
clean_filters
|
|
11
|
-
load_adapter 'test_frameworks'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
|
15
|
-
add_filter "/.rvm/"
|
|
16
|
-
end
|
|
17
|
-
require 'rubygems'
|
|
18
|
-
require 'bundler'
|
|
19
|
-
begin
|
|
20
|
-
Bundler.setup(:default, :development)
|
|
21
|
-
rescue Bundler::BundlerError => e
|
|
22
|
-
$stderr.puts e.message
|
|
23
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
24
|
-
exit e.status_code
|
|
25
|
-
end
|
|
26
|
-
require 'minitest/autorun'
|
|
27
|
-
require 'minitest/unit'
|
|
28
|
-
|
|
29
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
30
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
31
|
-
require 'lipstick'
|
|
32
|
-
|
|
33
|
-
require 'yaml'
|
|
34
|
-
|
|
35
|
-
module Lipstick
|
|
36
|
-
module Fixtures
|
|
37
|
-
HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
|
|
38
|
-
LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.lipstick/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
|
|
39
|
-
|
|
40
|
-
def address(prefix, options = {})
|
|
41
|
-
{
|
|
42
|
-
"#{prefix}Address1" => '1234 My Street',
|
|
43
|
-
"#{prefix}Address2" => 'Apt 1',
|
|
44
|
-
"#{prefix}City" => 'Ottawa',
|
|
45
|
-
"#{prefix}State" => 'ON',
|
|
46
|
-
"#{prefix}Zip" => 'K1C2N6',
|
|
47
|
-
"#{prefix}Country" => 'CA',
|
|
48
|
-
}.update(options)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def all_fixtures
|
|
52
|
-
@@fixtures ||= load_fixtures
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def fixtures(key)
|
|
56
|
-
data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")
|
|
57
|
-
data.dup
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def load_fixtures
|
|
61
|
-
[LOCAL_CREDENTIALS].inject({}) do |credentials, file_name|
|
|
62
|
-
if File.exist?(file_name)
|
|
63
|
-
yaml_data = YAML.load(File.read(file_name))
|
|
64
|
-
credentials.merge!(symbolize_keys(yaml_data))
|
|
65
|
-
end
|
|
66
|
-
credentials
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def symbolize_keys(hash)
|
|
71
|
-
return hash unless hash.is_a?(Hash)
|
|
72
|
-
hash.each_with_object({}){|(k,v), h| h[k.to_sym] = symbolize_keys(v)}
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def context(*args, &block)
|
|
78
|
-
describe(*args, &block)
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
Minitest.autorun
|
data/test/test_lipstick.rb
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
require 'helper'
|
|
2
|
-
|
|
3
|
-
include Lipstick::Fixtures
|
|
4
|
-
|
|
5
|
-
describe 'Lipstick::Api::Session' do
|
|
6
|
-
i_suck_and_my_tests_are_order_dependent!
|
|
7
|
-
|
|
8
|
-
before(:each) do
|
|
9
|
-
params = fixtures(:credentials)
|
|
10
|
-
params[:logger] = Logger.new(STDOUT) if ENV['DEBUG_LIPSTICK'] == 'true'
|
|
11
|
-
@session = Lipstick::Api::Session.new(params)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '#campaign_find_active' do
|
|
15
|
-
it 'finds all active campaigns' do
|
|
16
|
-
api_response = @session.campaign_find_active
|
|
17
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
18
|
-
assert api_response.campaign_id.is_a?(Array)
|
|
19
|
-
assert api_response.campaign_id[0].is_a?(Integer)
|
|
20
|
-
assert api_response.campaign_name.is_a?(Array)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe '#campaign_view' do
|
|
25
|
-
it 'fetches attributes of a campaign' do
|
|
26
|
-
api_response = @session.campaign_find_active
|
|
27
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
28
|
-
campaign_id = api_response.campaign_id.sample
|
|
29
|
-
api_response = @session.campaign_view(campaign_id)
|
|
30
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
31
|
-
assert api_response.product_id.is_a?(Array)
|
|
32
|
-
assert api_response.shipping_id.is_a?(Array)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context 'sample campaign' do
|
|
37
|
-
let(:order_params) do
|
|
38
|
-
{
|
|
39
|
-
campaign_id: @campaign_id,
|
|
40
|
-
product_id: @product_id,
|
|
41
|
-
first_name: 'Jim',
|
|
42
|
-
last_name: 'Smith',
|
|
43
|
-
phone: '(555)555-5555',
|
|
44
|
-
email: 'test@test.com', # jim.smith@example.com'
|
|
45
|
-
credit_card_type: @credit_card_type,
|
|
46
|
-
credit_card_number: fixtures(:test_card_number),
|
|
47
|
-
expiration_date: '1219',
|
|
48
|
-
'CVV' => '123',
|
|
49
|
-
tran_type: 'NewOrder',
|
|
50
|
-
shipping_id: @shipping_method_id,
|
|
51
|
-
ip_address: '127.0.0.1',
|
|
52
|
-
upsell_count: 0
|
|
53
|
-
}.update(address('shipping')).update(address('billing'))
|
|
54
|
-
end
|
|
55
|
-
before (:all) do
|
|
56
|
-
api_response = @session.campaign_find_active
|
|
57
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
58
|
-
@campaign_id = api_response.campaign_id.sample
|
|
59
|
-
@campaign = @session.campaign_view(@campaign_id)
|
|
60
|
-
@product_id = @campaign.product_id.sample
|
|
61
|
-
@credit_card_type = @campaign.payment_name.sample
|
|
62
|
-
@shipping_method_id = @campaign.shipping_id.sample
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
describe '#new_order' do
|
|
66
|
-
it 'creates order' do
|
|
67
|
-
api_response = @session.new_order(order_params)
|
|
68
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
69
|
-
assert api_response.test, "Expected #{api_response.test.inspect} to be true"
|
|
70
|
-
assert api_response.customer_id.is_a?(Integer), "Expected #{api_response.customer_id.inspect} to be an integer"
|
|
71
|
-
assert api_response.order_id.is_a?(Integer)
|
|
72
|
-
assert api_response.transaction_id == 'Not Available'
|
|
73
|
-
assert api_response.auth_id == 'Not Available'
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
context 'existing order' do
|
|
78
|
-
before (:all) do
|
|
79
|
-
api_response = @session.new_order(order_params)
|
|
80
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
81
|
-
@order_id = api_response.order_id
|
|
82
|
-
@customer_id = api_response.customer_id
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
describe '#customer_find_active_product' do
|
|
86
|
-
it 'fetches product ids' do
|
|
87
|
-
api_response = @session.customer_find_active_product(@customer_id)
|
|
88
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
89
|
-
assert api_response.product_ids.is_a?(Array)
|
|
90
|
-
assert api_response.product_ids[0].is_a?(Integer)
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
describe '#order_find' do
|
|
95
|
-
it 'returns orders matching criteria' do
|
|
96
|
-
api_response = @session.order_find(Time.now - 120, Time.now)
|
|
97
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
98
|
-
assert api_response.order_ids.is_a?(Array)
|
|
99
|
-
assert api_response.order_ids[0].is_a?(Integer)
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
describe '#order_refund' do
|
|
104
|
-
it 'refunds the customer' do
|
|
105
|
-
api_response = @session.order_refund(@order_id, 0.01)
|
|
106
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
describe '#order_view' do
|
|
111
|
-
it 'returns details of an order' do
|
|
112
|
-
api_response = @session.order_view(@order_id)
|
|
113
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
describe '#order_update1' do
|
|
118
|
-
it 'posts chages to an order' do
|
|
119
|
-
api_response = @session.order_update(@order_id, :tracking_number, 'LC123456789012345678US')
|
|
120
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
context 'updated order' do
|
|
125
|
-
before (:each) do
|
|
126
|
-
api_response = @session.order_update(@order_id, :tracking_number, 'LC123456789012345678US')
|
|
127
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
describe '#order_find_updated' do
|
|
131
|
-
it 'finds updated orders' do
|
|
132
|
-
api_response = @session.order_find_updated(Time.now - 128, Time.now)
|
|
133
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
134
|
-
assert api_response.order_ids.is_a?(Array)
|
|
135
|
-
assert api_response.order_ids[0].is_a?(Integer)
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
end # existing order
|
|
140
|
-
|
|
141
|
-
context 'new order' do
|
|
142
|
-
before (:each) do
|
|
143
|
-
api_response = @session.new_order(order_params)
|
|
144
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
145
|
-
@new_order_id = api_response.order_id
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
describe '#order_update_recurring' do
|
|
149
|
-
it 'cancels a new order' do
|
|
150
|
-
api_response = @session.order_update_recurring(@new_order_id, 'stop')
|
|
151
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
describe '#order_void' do
|
|
156
|
-
it 'cancels a new order' do
|
|
157
|
-
api_response = @session.order_void(@new_order_id)
|
|
158
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end # sample campaign
|
|
163
|
-
|
|
164
|
-
describe '#shipping_method_find' do
|
|
165
|
-
it 'finds shipping methods' do
|
|
166
|
-
api_response = @session.shipping_method_find
|
|
167
|
-
assert api_response.code == 100, "unexpected response: #{api_response.inspect}"
|
|
168
|
-
assert api_response.shipping_ids.is_a?(Array)
|
|
169
|
-
assert api_response.shipping_ids[0].is_a?(Integer)
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
describe 'validate_credentials' do
|
|
174
|
-
it 'returns true if credentials valid' do
|
|
175
|
-
api_response = @session.validate_credentials
|
|
176
|
-
assert api_response.code == 100, 'Credentials not valid.'
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
it 'returns false if credentials invalid' do
|
|
180
|
-
invalid_credentials = fixtures(:credentials).merge!(password: 'invalid')
|
|
181
|
-
@invalid_session = Lipstick::Api::Session.new(invalid_credentials)
|
|
182
|
-
api_response = @invalid_session.validate_credentials
|
|
183
|
-
assert api_response.code == 200, 'Invalid credentials not detected.'
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
describe '#underscore' do
|
|
188
|
-
it 'munges whatsit' do
|
|
189
|
-
foobar = @session.underscore('FooBar')
|
|
190
|
-
assert foobar == 'foo_bar', ">> #{foobar} <<"
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
require 'helper'
|
|
2
|
-
|
|
3
|
-
describe 'Lipstick::Api::OrderViewResponse' do
|
|
4
|
-
describe 'initialize' do
|
|
5
|
-
it 'parses the fields' do
|
|
6
|
-
fields = {
|
|
7
|
-
:response_code=>"100",
|
|
8
|
-
:ancestor_id=>"581006",
|
|
9
|
-
:customer_id=>"30346",
|
|
10
|
-
:parent_id=>"2081410",
|
|
11
|
-
:child_id=>nil,
|
|
12
|
-
:order_status=>"11",
|
|
13
|
-
:is_recurring=>"0",
|
|
14
|
-
:first_name=>"Jim",
|
|
15
|
-
:last_name=>"Smith",
|
|
16
|
-
:shipping_first_name=>"Jim",
|
|
17
|
-
:shipping_last_name=>"Smith",
|
|
18
|
-
:shipping_street_address=>"1234 My Street",
|
|
19
|
-
:shipping_street_address2=>"Apt 1",
|
|
20
|
-
:shipping_city=>"Ottawa",
|
|
21
|
-
:shipping_state=>"ON",
|
|
22
|
-
:shipping_state_id=>"ON",
|
|
23
|
-
:shipping_postcode=>"K1C2N6",
|
|
24
|
-
:shipping_country=>"CA",
|
|
25
|
-
:billing_first_name=>"Jim",
|
|
26
|
-
:billing_last_name=>"Smith",
|
|
27
|
-
:billing_street_address=>"1234 My Street",
|
|
28
|
-
:billing_street_address2=>"Apt 1",
|
|
29
|
-
:billing_city=>"Ottawa",
|
|
30
|
-
:billing_state=>"ON",
|
|
31
|
-
:billing_state_id=>"ON",
|
|
32
|
-
:billing_postcode=>"K1C2N6",
|
|
33
|
-
:billing_country=>"CA",
|
|
34
|
-
:customers_telephone=>"(555)555-5555",
|
|
35
|
-
:time_stamp=>"2014-11-26 16:34:33",
|
|
36
|
-
:recurring_date=>"0000-00-00",
|
|
37
|
-
:retry_date=>"N/A",
|
|
38
|
-
:cc_type=>"offline",
|
|
39
|
-
:cc_number=>"2822", # "N/A",
|
|
40
|
-
:check_account_last_4=>"N/A",
|
|
41
|
-
:check_routing_last_4=>"N/A",
|
|
42
|
-
:check_ssn_last_4=>"N/A",
|
|
43
|
-
:cc_expires=>"1219",
|
|
44
|
-
:prepaid_match=>"N/A",
|
|
45
|
-
:main_product_id=>"17",
|
|
46
|
-
:main_product_quantity=>"1",
|
|
47
|
-
:upsell_product_quantity=>nil,
|
|
48
|
-
:upsell_product_id=>nil,
|
|
49
|
-
:shipping_id=>"1",
|
|
50
|
-
:shipping_method_name=>"USPS",
|
|
51
|
-
:order_total=>"4.25",
|
|
52
|
-
:transaction_id=>"5804215901", # "Not Available",
|
|
53
|
-
:auth_id=>"02553Z", # "Not Available",
|
|
54
|
-
:tracking_number=>nil,
|
|
55
|
-
:on_hold=>"0",
|
|
56
|
-
:on_hold_by=>nil,
|
|
57
|
-
:hold_date=>nil,
|
|
58
|
-
:shipping_date=>"Not Shipped",
|
|
59
|
-
:email_address=>"test@test.com",
|
|
60
|
-
:gateway_id=>"1",
|
|
61
|
-
:preserve_gateway=>"0",
|
|
62
|
-
:amount_refunded_to_date=>"0.00",
|
|
63
|
-
:order_confirmed=>"NO_STATUS",
|
|
64
|
-
:order_confirmed_date=>nil,
|
|
65
|
-
:is_chargeback=>"0",
|
|
66
|
-
:is_fraud=>"0",
|
|
67
|
-
:is_rma=>"0",
|
|
68
|
-
:rma_number=>nil,
|
|
69
|
-
:rma_reason=>nil,
|
|
70
|
-
:ip_address=>"127.0.0.1",
|
|
71
|
-
:affiliate=>nil,
|
|
72
|
-
:sub_affiliate=>nil,
|
|
73
|
-
:decline_reason=>"N/A",
|
|
74
|
-
:campaign_id=>"23",
|
|
75
|
-
:order_sales_tax=>"0.00",
|
|
76
|
-
:order_sales_tax_amount=>"0.00",
|
|
77
|
-
:processor_id=>nil,
|
|
78
|
-
:created_by_user_name=>nil,
|
|
79
|
-
:created_by_employee_name=>nil,
|
|
80
|
-
:billing_cycle=>"0",
|
|
81
|
-
:click_id=>nil,
|
|
82
|
-
:product_qty_17=>"1",
|
|
83
|
-
:"products[0][product_id]"=>"1",
|
|
84
|
-
:"products[0][sku]"=>"094922807700",
|
|
85
|
-
:"products[0][price]"=>"0.00",
|
|
86
|
-
:"products[0][name]"=>"Lipstick",
|
|
87
|
-
:"products[0][on_hold]"=>"0",
|
|
88
|
-
:"products[0][is_recurring]"=>"1",
|
|
89
|
-
:"products[0][recurring_date]"=>"2014-12-26",
|
|
90
|
-
:"products[0][product_qty]"=>"1",
|
|
91
|
-
:"products[0][subscription_id]"=>"653cfc05e89438543a943731bbe6dbce",
|
|
92
|
-
:"products[0][subscription_type]"=>"Bill by cycle",
|
|
93
|
-
:"products[0][subscription_desc]"=>"Bills every 30 days"
|
|
94
|
-
}
|
|
95
|
-
response = Lipstick::Api::OrderViewResponse.new(fields)
|
|
96
|
-
customer = response.customer
|
|
97
|
-
assert_equal customer.id, 30346
|
|
98
|
-
assert_equal customer.first_name, "Jim"
|
|
99
|
-
assert_equal customer.last_name, "Smith"
|
|
100
|
-
assert_equal customer.telephone, "(555)555-5555"
|
|
101
|
-
assert_equal customer.email_address, "test@test.com"
|
|
102
|
-
|
|
103
|
-
order = response.order
|
|
104
|
-
assert_equal order.ancestor_id, 581006
|
|
105
|
-
# assert_equal order.customer.id, 30346
|
|
106
|
-
assert_equal order.parent_id, 2081410
|
|
107
|
-
assert_equal order.status, 11
|
|
108
|
-
|
|
109
|
-
assert_equal order.shipping.first_name, "Jim"
|
|
110
|
-
assert_equal order.shipping.last_name, "Smith"
|
|
111
|
-
assert_equal order.shipping.street_address, "1234 My Street"
|
|
112
|
-
assert_equal order.shipping.street_address2, "Apt 1"
|
|
113
|
-
assert_equal order.shipping.postcode, "K1C2N6"
|
|
114
|
-
assert_equal order.shipping.country, "CA"
|
|
115
|
-
assert_equal order.billing.marshal_dump, order.shipping.marshal_dump
|
|
116
|
-
assert_equal order.created_at, DateTime.new(2014,11,26,16,34,33)
|
|
117
|
-
assert_equal order.cc_number, "2822"
|
|
118
|
-
|
|
119
|
-
assert_equal order.cc_expires, "1219"
|
|
120
|
-
assert_equal order.shipping_method_name, "USPS"
|
|
121
|
-
assert_equal order.order_total, BigDecimal.new('4.25')
|
|
122
|
-
assert_equal order.transaction_id, '5804215901'
|
|
123
|
-
assert_equal order.auth_id, '02553Z'
|
|
124
|
-
assert_equal order.campaign_id, 23
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|