your_membership 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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.env +5 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +1 -0
  5. data/CHANGELOG.md +10 -0
  6. data/README.md +12 -10
  7. data/lib/httparty/patch.rb +33 -33
  8. data/lib/your_membership/base.rb +197 -197
  9. data/lib/your_membership/commerce.rb +25 -25
  10. data/lib/your_membership/config.rb +41 -41
  11. data/lib/your_membership/convert.rb +24 -24
  12. data/lib/your_membership/error.rb +21 -21
  13. data/lib/your_membership/events.rb +60 -60
  14. data/lib/your_membership/feeds.rb +37 -37
  15. data/lib/your_membership/member.rb +399 -397
  16. data/lib/your_membership/members.rb +124 -124
  17. data/lib/your_membership/people.rb +38 -38
  18. data/lib/your_membership/profile.rb +92 -85
  19. data/lib/your_membership/sa.rb +6 -6
  20. data/lib/your_membership/sa_auth.rb +34 -34
  21. data/lib/your_membership/sa_certifications.rb +22 -22
  22. data/lib/your_membership/sa_commerce.rb +22 -22
  23. data/lib/your_membership/sa_events.rb +66 -66
  24. data/lib/your_membership/sa_export.rb +195 -195
  25. data/lib/your_membership/sa_groups.rb +30 -30
  26. data/lib/your_membership/sa_member.rb +49 -49
  27. data/lib/your_membership/sa_members.rb +180 -179
  28. data/lib/your_membership/sa_nonmembers.rb +41 -41
  29. data/lib/your_membership/sa_people.rb +92 -92
  30. data/lib/your_membership/session.rb +148 -152
  31. data/lib/your_membership/version.rb +1 -1
  32. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml +51 -0
  33. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml +51 -0
  34. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml +51 -0
  35. data/spec/lib/{profile_spec.rb → your_membership/profile_spec.rb} +232 -197
  36. data/spec/lib/your_membership/sa_members_spec.rb +38 -0
  37. data/spec/spec_helper.rb +101 -78
  38. data/your_membership.gemspec +4 -0
  39. 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
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
5
- #
6
- # Given that it is always loaded, you are encouraged to keep this file as
7
- # light-weight as possible. Requiring heavyweight dependencies from this file
8
- # will add to the boot time of your test suite on EVERY test run, even for an
9
- # individual file that may not need all of that loaded. Instead, make a
10
- # separate helper file that requires this one and then use it only in the specs
11
- # that actually need it.
12
- #
13
- # The `.rspec` file also contains a few flags that are not defaults but that
14
- # users commonly want.
15
- #
16
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
- RSpec.configure do |config|
18
- # The settings below are suggested to provide a good initial experience
19
- # with RSpec, but feel free to customize to your heart's content.
20
- #begin
21
- # These two settings work together to allow you to limit a spec run
22
- # to individual examples or groups you care about by tagging them with
23
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
24
- # get run.
25
- config.filter_run :focus
26
- config.run_all_when_everything_filtered = true
27
-
28
- # Many RSpec users commonly either run the entire suite or an individual
29
- # file, and it's useful to allow more verbose output when running an
30
- # individual spec file.
31
- if config.files_to_run.one?
32
- # Use the documentation formatter for detailed output,
33
- # unless a formatter has already been configured
34
- # (e.g. via a command-line flag).
35
- config.default_formatter = 'doc'
36
- end
37
-
38
- # Print the 10 slowest examples and example groups at the
39
- # end of the spec run, to help surface which specs are running
40
- # particularly slow.
41
- config.profile_examples = 10
42
-
43
- # Run specs in random order to surface order dependencies. If you find an
44
- # order dependency and want to debug it, you can fix the order by providing
45
- # the seed, which is printed after each run.
46
- # --seed 1234
47
- config.order = :random
48
-
49
- # Seed global randomization in this process using the `--seed` CLI option.
50
- # Setting this allows you to use `--seed` to deterministically reproduce
51
- # test failures related to randomization by passing the same `--seed` value
52
- # as the one that triggered the failure.
53
- Kernel.srand config.seed
54
-
55
- # rspec-expectations config goes here. You can use an alternate
56
- # assertion/expectation library such as wrong or the stdlib/minitest
57
- # assertions if you prefer.
58
- config.expect_with :rspec do |expectations|
59
- # Enable only the newer, non-monkey-patching expect syntax.
60
- # For more details, see:
61
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
- expectations.syntax = [:expect, :should]
63
- end
64
-
65
- # rspec-mocks config goes here. You can use an alternate test double
66
- # library (such as bogus or mocha) by changing the `mock_with` option here.
67
- config.mock_with :rspec do |mocks|
68
- # Enable only the newer, non-monkey-patching expect syntax.
69
- # For more details, see:
70
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71
- mocks.syntax = :expect
72
-
73
- # Prevents you from mocking or stubbing a method that does not exist on
74
- # a real object. This is generally recommended.
75
- mocks.verify_partial_doubles = true
76
- end
77
- #end
78
- end
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
+
@@ -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.0
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: 2014-08-21 00:00:00.000000000 Z
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
- - .gitignore
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/lib/profile_spec.rb
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.3.0
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/lib/profile_spec.rb
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: