your_membership 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env +5 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +10 -0
- data/README.md +12 -10
- data/lib/httparty/patch.rb +33 -33
- data/lib/your_membership/base.rb +197 -197
- data/lib/your_membership/commerce.rb +25 -25
- data/lib/your_membership/config.rb +41 -41
- data/lib/your_membership/convert.rb +24 -24
- data/lib/your_membership/error.rb +21 -21
- data/lib/your_membership/events.rb +60 -60
- data/lib/your_membership/feeds.rb +37 -37
- data/lib/your_membership/member.rb +399 -397
- data/lib/your_membership/members.rb +124 -124
- data/lib/your_membership/people.rb +38 -38
- data/lib/your_membership/profile.rb +92 -85
- data/lib/your_membership/sa.rb +6 -6
- data/lib/your_membership/sa_auth.rb +34 -34
- data/lib/your_membership/sa_certifications.rb +22 -22
- data/lib/your_membership/sa_commerce.rb +22 -22
- data/lib/your_membership/sa_events.rb +66 -66
- data/lib/your_membership/sa_export.rb +195 -195
- data/lib/your_membership/sa_groups.rb +30 -30
- data/lib/your_membership/sa_member.rb +49 -49
- data/lib/your_membership/sa_members.rb +180 -179
- data/lib/your_membership/sa_nonmembers.rb +41 -41
- data/lib/your_membership/sa_people.rb +92 -92
- data/lib/your_membership/session.rb +148 -152
- data/lib/your_membership/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml +51 -0
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml +51 -0
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml +51 -0
- data/spec/lib/{profile_spec.rb → your_membership/profile_spec.rb} +232 -197
- data/spec/lib/your_membership/sa_members_spec.rb +38 -0
- data/spec/spec_helper.rb +101 -78
- data/your_membership.gemspec +4 -0
- metadata +85 -19
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module YourMembership
|
4
|
+
module Sa
|
5
|
+
RSpec.describe Members do
|
6
|
+
describe '.all_getIDs' do
|
7
|
+
it 'returns an ID when there is only one member found' do
|
8
|
+
VCR.use_cassette 'sa_members_all_getids_timestamp_single' do
|
9
|
+
time = days_ago(10).strftime('%Y-%m-%d %H:%M:%S')
|
10
|
+
result = described_class.all_getIDs(:Timestamp => time)
|
11
|
+
expect(result).to be_a(String)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns an array when there are multiple members found' do
|
16
|
+
VCR.use_cassette 'sa_members_all_getids_timestamp_multiple' do
|
17
|
+
time = days_ago(14).strftime('%Y-%m-%d %H:%M:%S')
|
18
|
+
result = described_class.all_getIDs(:Timestamp => time)
|
19
|
+
expect(result).to be_an(Array)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns an empty array when there are no members found' do
|
24
|
+
VCR.use_cassette 'sa_members_all_getids_timestamp_none' do
|
25
|
+
time = days_ago(0).strftime('%Y-%m-%d %H:%M:%S')
|
26
|
+
result = described_class.all_getIDs(:Timestamp => time)
|
27
|
+
expect(result).to be_an(Array)
|
28
|
+
expect(result).to eq([])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def days_ago(n)
|
34
|
+
Time.now - n * 24 * 60 * 60
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,78 +1,101 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# The `.rspec` file
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
config.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
config.
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
#
|
74
|
-
#
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
1
|
+
require 'dotenv'
|
2
|
+
require 'pry'
|
3
|
+
require 'vcr'
|
4
|
+
require 'your_membership'
|
5
|
+
|
6
|
+
Dotenv.load(
|
7
|
+
File.expand_path('../../.env.local', __FILE__),
|
8
|
+
File.expand_path('../../.env', __FILE__),
|
9
|
+
)
|
10
|
+
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
14
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
15
|
+
#
|
16
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
17
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
18
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
19
|
+
# individual file that may not need all of that loaded. Instead, make a
|
20
|
+
# separate helper file that requires this one and then use it only in the specs
|
21
|
+
# that actually need it.
|
22
|
+
#
|
23
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
24
|
+
# users commonly want.
|
25
|
+
#
|
26
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# The settings below are suggested to provide a good initial experience
|
29
|
+
# with RSpec, but feel free to customize to your heart's content.
|
30
|
+
#begin
|
31
|
+
# These two settings work together to allow you to limit a spec run
|
32
|
+
# to individual examples or groups you care about by tagging them with
|
33
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
34
|
+
# get run.
|
35
|
+
config.filter_run :focus
|
36
|
+
config.run_all_when_everything_filtered = true
|
37
|
+
|
38
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
39
|
+
# file, and it's useful to allow more verbose output when running an
|
40
|
+
# individual spec file.
|
41
|
+
if config.files_to_run.one?
|
42
|
+
# Use the documentation formatter for detailed output,
|
43
|
+
# unless a formatter has already been configured
|
44
|
+
# (e.g. via a command-line flag).
|
45
|
+
config.default_formatter = 'doc'
|
46
|
+
end
|
47
|
+
|
48
|
+
# Run specs in random order to surface order dependencies. If you find an
|
49
|
+
# order dependency and want to debug it, you can fix the order by providing
|
50
|
+
# the seed, which is printed after each run.
|
51
|
+
# --seed 1234
|
52
|
+
config.order = :random
|
53
|
+
|
54
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
55
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
56
|
+
# test failures related to randomization by passing the same `--seed` value
|
57
|
+
# as the one that triggered the failure.
|
58
|
+
Kernel.srand config.seed
|
59
|
+
|
60
|
+
# rspec-expectations config goes here. You can use an alternate
|
61
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
62
|
+
# assertions if you prefer.
|
63
|
+
config.expect_with :rspec do |expectations|
|
64
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
65
|
+
# For more details, see:
|
66
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
67
|
+
expectations.syntax = [:expect, :should]
|
68
|
+
end
|
69
|
+
|
70
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
71
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
72
|
+
config.mock_with :rspec do |mocks|
|
73
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
74
|
+
# For more details, see:
|
75
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
76
|
+
mocks.syntax = :expect
|
77
|
+
|
78
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
79
|
+
# a real object. This is generally recommended.
|
80
|
+
mocks.verify_partial_doubles = true
|
81
|
+
end
|
82
|
+
#end
|
83
|
+
end
|
84
|
+
|
85
|
+
VCR.configure do |config|
|
86
|
+
config.cassette_library_dir = File.expand_path('../fixtures/vcr_cassettes', __FILE__)
|
87
|
+
config.hook_into :webmock
|
88
|
+
config.filter_sensitive_data('<PUBLIC_KEY>') { ENV.fetch('YM_API_PUBLIC_KEY') }
|
89
|
+
config.filter_sensitive_data('<PRIVATE_KEY>') { ENV.fetch('YM_API_PRIVATE_KEY') }
|
90
|
+
config.filter_sensitive_data('<SA_PASSCODE>') { ENV.fetch('YM_API_SA_PASSCODE') }
|
91
|
+
config.filter_sensitive_data('<ASP_SESSION_ID>') do |http|
|
92
|
+
http.response.headers['Set-Cookie'][0]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
YourMembership.configure(
|
97
|
+
publicKey: ENV.fetch('YM_API_PUBLIC_KEY'),
|
98
|
+
privateKey: ENV.fetch('YM_API_PRIVATE_KEY'),
|
99
|
+
saPasscode: ENV.fetch('YM_API_SA_PASSCODE')
|
100
|
+
)
|
101
|
+
|
data/your_membership.gemspec
CHANGED
@@ -25,6 +25,10 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "nokogiri", "~>1.6"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.6"
|
28
|
+
spec.add_development_dependency "dotenv"
|
29
|
+
spec.add_development_dependency "pry"
|
28
30
|
spec.add_development_dependency "rake"
|
29
31
|
spec.add_development_dependency "rspec"
|
32
|
+
spec.add_development_dependency "vcr"
|
33
|
+
spec.add_development_dependency "webmock"
|
30
34
|
end
|
metadata
CHANGED
@@ -1,83 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: your_membership
|
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
|
- Nate Flood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.13.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.13.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- -
|
87
|
+
- - ">="
|
60
88
|
- !ruby/object:Gem::Version
|
61
89
|
version: '0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- -
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rspec
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- -
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
74
130
|
- !ruby/object:Gem::Version
|
75
131
|
version: '0'
|
76
132
|
type: :development
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
|
-
- -
|
136
|
+
- - ">="
|
81
137
|
- !ruby/object:Gem::Version
|
82
138
|
version: '0'
|
83
139
|
description: |-
|
@@ -91,7 +147,10 @@ executables: []
|
|
91
147
|
extensions: []
|
92
148
|
extra_rdoc_files: []
|
93
149
|
files:
|
94
|
-
- .
|
150
|
+
- ".env"
|
151
|
+
- ".gitignore"
|
152
|
+
- ".rspec"
|
153
|
+
- CHANGELOG.md
|
95
154
|
- Gemfile
|
96
155
|
- LICENSE.txt
|
97
156
|
- README.md
|
@@ -122,7 +181,11 @@ files:
|
|
122
181
|
- lib/your_membership/sa_people.rb
|
123
182
|
- lib/your_membership/session.rb
|
124
183
|
- lib/your_membership/version.rb
|
125
|
-
- spec/
|
184
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml
|
185
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml
|
186
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml
|
187
|
+
- spec/lib/your_membership/profile_spec.rb
|
188
|
+
- spec/lib/your_membership/sa_members_spec.rb
|
126
189
|
- spec/spec_helper.rb
|
127
190
|
- your_membership.gemspec
|
128
191
|
homepage: ''
|
@@ -135,21 +198,24 @@ require_paths:
|
|
135
198
|
- lib
|
136
199
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
200
|
requirements:
|
138
|
-
- -
|
201
|
+
- - ">="
|
139
202
|
- !ruby/object:Gem::Version
|
140
203
|
version: '0'
|
141
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
205
|
requirements:
|
143
|
-
- -
|
206
|
+
- - ">="
|
144
207
|
- !ruby/object:Gem::Version
|
145
208
|
version: '0'
|
146
209
|
requirements: []
|
147
210
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.6.4
|
149
212
|
signing_key:
|
150
213
|
specification_version: 4
|
151
214
|
summary: Ruby SDK for interfacing with the YourMembership.com XML API
|
152
215
|
test_files:
|
153
|
-
- spec/
|
216
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml
|
217
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml
|
218
|
+
- spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml
|
219
|
+
- spec/lib/your_membership/profile_spec.rb
|
220
|
+
- spec/lib/your_membership/sa_members_spec.rb
|
154
221
|
- spec/spec_helper.rb
|
155
|
-
has_rdoc:
|