patch_retention 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e16f62b32c1b6105c7635ba9f00ccd20ccb7e59f131ab035ff9033a96224547
4
- data.tar.gz: e251e05872d84438356695555fc6ae4ec56949e574e83306389f7de03ab2a310
3
+ metadata.gz: 2ff39a288451016541c8a8f63aca54115fb7f2a4e6a83daea5b503ebe7956fb5
4
+ data.tar.gz: 6046dfe6d5692149f069ce54f14fd84bffb9139f3403710eb12c3050619f5130
5
5
  SHA512:
6
- metadata.gz: c2ca9e71b4a393356b22e8d680cd8a25f95a1cc901de1cdd6a9fdeaebe7a33ae9183af2b76f883058614b5cbd2b3fff97c8a0ef243651e5ebbe20468fae98374
7
- data.tar.gz: ef2307ff81839c5343c98e7f03eb7e6c39e77df272524358327fbe7b13b216f7fa7d6b6dd8b834e211a058c7d793c3e1c7cccaa683333cf33a086d95fe5ee701
6
+ metadata.gz: a3ea0a8fe3c04033678ebd81da8b003a995baa8515ebb2f518c459acf9a2d4d5f97ccb3499143ea4ee2f2595c3cdcad28b19d97620929e3a9834fad27b57d1f6
7
+ data.tar.gz: d4c4fb944b2412112d19155f1f4bbe1d190fc23e9ff9ea3584a8bf5505668c996a708f5a8dc8174080e4cbaa5c8dced9d53eda0ff4f1f114dd33c27f9f60e3f8
data/CLAUDE.md CHANGED
@@ -171,6 +171,11 @@ The gem uses dotenv for credential management:
171
171
  2. **VCR Integration**: All API tests are recorded/replayed using VCR for consistent testing
172
172
  3. **Flexible Assertions**: Don't rely on exact field presence, use conditional checks
173
173
  4. **Custom Config Testing**: Always test that methods accept custom configuration
174
+ 5. **Time/Date Testing with VCR**:
175
+ - Avoid strict time comparisons with `Time.now` as VCR cassettes may be recorded at different times
176
+ - Instead of `expect(Time.parse(result["date"])).to(be_within(24 * 60 * 60).of(Time.now))`
177
+ - Use format validation: `expect(result["date"]).to match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/)`
178
+ - Or simply verify presence: `expect(result["date"]).not_to be_nil`
174
179
 
175
180
  ### Code Style
176
181
  - Using Shopify's Rubocop style guide (`rubocop-shopify` gem)
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_retention (0.2.0)
5
- faraday (~> 2.0)
4
+ patch_retention (0.2.2)
5
+ faraday (~> 1.10)
6
6
  zeitwerk (~> 2.6)
7
7
 
8
8
  GEM
@@ -23,19 +23,34 @@ GEM
23
23
  rexml
24
24
  diff-lcs (1.5.0)
25
25
  dotenv (2.8.1)
26
- faraday (2.13.1)
27
- faraday-net_http (>= 2.0, < 3.5)
28
- json
29
- logger
30
- faraday-net_http (3.4.0)
31
- net-http (>= 0.5.0)
26
+ faraday (1.10.4)
27
+ faraday-em_http (~> 1.0)
28
+ faraday-em_synchrony (~> 1.0)
29
+ faraday-excon (~> 1.1)
30
+ faraday-httpclient (~> 1.0)
31
+ faraday-multipart (~> 1.0)
32
+ faraday-net_http (~> 1.0)
33
+ faraday-net_http_persistent (~> 1.0)
34
+ faraday-patron (~> 1.0)
35
+ faraday-rack (~> 1.0)
36
+ faraday-retry (~> 1.0)
37
+ ruby2_keywords (>= 0.0.4)
38
+ faraday-em_http (1.0.0)
39
+ faraday-em_synchrony (1.0.1)
40
+ faraday-excon (1.1.0)
41
+ faraday-httpclient (1.0.1)
42
+ faraday-multipart (1.1.1)
43
+ multipart-post (~> 2.0)
44
+ faraday-net_http (1.0.2)
45
+ faraday-net_http_persistent (1.2.0)
46
+ faraday-patron (1.0.0)
47
+ faraday-rack (1.0.0)
48
+ faraday-retry (1.0.3)
32
49
  hashdiff (1.2.0)
33
50
  json (2.7.0)
34
51
  language_server-protocol (3.17.0.3)
35
- logger (1.7.0)
36
52
  method_source (1.0.0)
37
- net-http (0.6.0)
38
- uri
53
+ multipart-post (2.4.1)
39
54
  parallel (1.23.0)
40
55
  parser (3.2.2.4)
41
56
  ast (~> 2.4.1)
@@ -78,9 +93,9 @@ GEM
78
93
  rubocop-shopify (2.15.1)
79
94
  rubocop (~> 1.51)
80
95
  ruby-progressbar (1.13.0)
81
- thor (1.3.2)
96
+ ruby2_keywords (0.0.5)
97
+ thor (1.4.0)
82
98
  unicode-display_width (2.5.0)
83
- uri (1.0.3)
84
99
  vcr (6.3.1)
85
100
  base64
86
101
  webmock (3.25.1)
@@ -104,6 +119,7 @@ DEPENDENCIES
104
119
  rspec (~> 3.0)
105
120
  rubocop (~> 1.21)
106
121
  rubocop-shopify (~> 2.15)
122
+ thor (>= 1.4.0)
107
123
  vcr (~> 6.0)
108
124
  webmock (~> 3.0)
109
125
 
data/README.md CHANGED
@@ -265,7 +265,10 @@ membership = PatchRetention::Memberships.create(
265
265
  start_at: Time.now.xmlschema, # Optional, ISO8601 timestamp
266
266
  end_at: (Time.now + 30*24*60*60).xmlschema, # Optional, ISO8601 timestamp (e.g., 30 days from now)
267
267
  external_id: "MEM123", # Optional
268
- external_data: { "notes": "Trial membership" }, # Optional, hash
268
+ data: {
269
+ "is_trial" => true,
270
+ "trial_ends_at" => (Time.now + 15*24*60*60).xmlschema
271
+ }, # Optional, hash for custom data
269
272
  tags: ["trial", "api_created"] # Optional, array of strings
270
273
  )
271
274
  # => {"id"=>"mem_xxxxxxxxxxxxxx", "contact_id"=>"ct_xxxxxxxxxxxxxx", ...}
@@ -3,8 +3,8 @@
3
3
  module PatchRetention
4
4
  class Memberships
5
5
  class << self
6
- def create(contact_id:, product_id:, start_at: nil, end_at: nil, external_id: nil, external_data: nil,
7
- tags: nil, config: nil)
6
+ def create(contact_id:, product_id:, start_at: nil, end_at: nil, external_id: nil, tags: nil, data: nil,
7
+ config: nil)
8
8
  payload = {
9
9
  contact_id: contact_id,
10
10
  product_id: product_id,
@@ -12,8 +12,8 @@ module PatchRetention
12
12
  payload[:start_at] = start_at if start_at
13
13
  payload[:end_at] = end_at if end_at
14
14
  payload[:external_id] = external_id if external_id
15
- payload[:external_data] = external_data if external_data
16
15
  payload[:tags] = tags if tags
16
+ payload[:data] = data if data
17
17
 
18
18
  response = PatchRetention.connection(config).post("/v2/memberships") do |req|
19
19
  req.body = payload.to_json
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PatchRetention
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch_retention
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Playbypoint
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-05-27 00:00:00.000000000 Z
12
+ date: 2025-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.0'
20
+ version: '1.10'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '2.0'
27
+ version: '1.10'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: zeitwerk
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0.9'
70
+ - !ruby/object:Gem::Dependency
71
+ name: thor
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.4.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 1.4.0
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: byebug
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -250,7 +264,6 @@ files:
250
264
  - lib/patch_retention/products.rb
251
265
  - lib/patch_retention/util.rb
252
266
  - lib/patch_retention/version.rb
253
- - patch_retention.gemspec
254
267
  - script/setup_test_env
255
268
  - sig/patch_retention.rbs
256
269
  homepage: https://playbypoint.com
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/patch_retention/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "patch_retention"
7
- spec.version = PatchRetention::VERSION
8
- spec.authors = ["Playbypoint", "Gerardo Ortega"]
9
- spec.email = ["webmaster@playbypoint.com", "g3ortega@gmail.com"]
10
-
11
- spec.summary = "Patch Retention API wrapper."
12
- spec.description = "Patch Retention API wrapper."
13
- spec.homepage = "https://playbypoint.com"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.1.0"
16
-
17
- # spec.metadata["allowed_push_host"] = "Set to your gem server 'https://example.com'"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://playbypoint.com"
21
- spec.metadata["changelog_uri"] = "https://playbypoint.com"
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(__dir__) do
26
- %x(git ls-files -z).split("\x0").reject do |f|
27
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
- end
29
- end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- # Runtime dependencies
35
- spec.add_dependency("faraday", "~> 2.0")
36
- spec.add_dependency("zeitwerk", "~> 2.6")
37
-
38
- # Development dependencies
39
- spec.add_development_dependency("bundler", "~> 2.0")
40
- spec.add_development_dependency("bundler-audit", "~> 0.9")
41
- spec.add_development_dependency("byebug")
42
- spec.add_development_dependency("dotenv", "~> 2.8")
43
- spec.add_development_dependency("pry")
44
- spec.add_development_dependency("rake", "~> 13.0")
45
- spec.add_development_dependency("rspec", "~> 3.0")
46
- spec.add_development_dependency("rubocop", "~> 1.21")
47
- spec.add_development_dependency("rubocop-shopify", "~> 2.15")
48
- spec.add_development_dependency("vcr", "~> 6.0")
49
- spec.add_development_dependency("webmock", "~> 3.0")
50
-
51
- # Security update for rexml
52
- spec.add_development_dependency("rexml", ">= 3.3.9")
53
-
54
- # For more information and examples about making a new gem, check out our
55
- # guide at: https://bundler.io/guides/creating_gem.html
56
- end