versacommerce-theme_api_client 0.1.3 → 1.0.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 +5 -5
- data/.ruby-version +1 -0
- data/CLAUDE.md +104 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/versacommerce/theme_api_client/fetcher.rb +1 -1
- data/lib/versacommerce/theme_api_client/resources/file.rb +2 -2
- data/lib/versacommerce/theme_api_client/version.rb +1 -1
- data/versacommerce-theme_api_client.gemspec +9 -10
- metadata +42 -36
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4fcf2656faa757b046931d4a22ead1d4cfa15758320b1c32504f897565a5eaba
|
|
4
|
+
data.tar.gz: 4f9bcef22485ca0be490100dee1153b33f916b7f6b840aae47196458a39c141b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6805af2804b62be8808a3119b1bc280b1264a6f711a333b26b86e7bce7198201773fd22b0c929346c8daa4f021b578d44131048a3805916ed305c47ea210980d
|
|
7
|
+
data.tar.gz: 2b3a4a26c23598b963deb0a7fe9941e9ee45df6e8fdd99bec939f7e221c49bdaac5043505ccc3b6406f4828459afa92c70c0b0b5b0e6b0b254664f1d79f4a2df
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.1.3
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is a Ruby gem that provides an API client for the VersaCommerce Theme API. It allows developers to programmatically manage theme files and directories for VersaCommerce shops.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Ruby >= 3.3.0
|
|
12
|
+
- Dependencies: http (~> 5.0), activesupport (>= 4.2, < 8.0), activemodel (>= 4.2, < 8.0)
|
|
13
|
+
|
|
14
|
+
## Common Commands
|
|
15
|
+
|
|
16
|
+
### Setup and Development
|
|
17
|
+
```bash
|
|
18
|
+
bin/setup # Install dependencies
|
|
19
|
+
bin/console # Launch interactive console for experimentation
|
|
20
|
+
bundle install # Install gem dependencies
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Building and Publishing
|
|
24
|
+
```bash
|
|
25
|
+
rake build # Build the gem
|
|
26
|
+
rake install # Build and install gem locally
|
|
27
|
+
rake release # Create git tag, build and push gem to rubygems.org
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Architecture
|
|
31
|
+
|
|
32
|
+
### Core Components
|
|
33
|
+
|
|
34
|
+
**Client (lib/versacommerce/theme_api_client.rb)**
|
|
35
|
+
- Entry point for the gem
|
|
36
|
+
- Initialized with authorization token
|
|
37
|
+
- Provides `directories()` and `files()` methods that return relation objects
|
|
38
|
+
- Configurable `base_url` (defaults to https://theme-api.versacommerce.de)
|
|
39
|
+
- Dynamically creates resource classes tied to the client instance
|
|
40
|
+
|
|
41
|
+
**Fetcher (lib/versacommerce/theme_api_client/fetcher.rb)**
|
|
42
|
+
- HTTP communication layer using the `http` gem
|
|
43
|
+
- Handles all HTTP verbs (GET, POST, PATCH, DELETE, HEAD)
|
|
44
|
+
- Adds Theme-Authorization header to all requests
|
|
45
|
+
- Defines custom errors: `RecordNotFoundError` and `UnauthorizedError`
|
|
46
|
+
- Extends HTTP::Response with a `json` method for parsing JSON responses
|
|
47
|
+
|
|
48
|
+
**Relation (lib/versacommerce/theme_api_client/relation.rb)**
|
|
49
|
+
- Base class for DirectoryRelation and FileRelation
|
|
50
|
+
- Implements Enumerable for iteration
|
|
51
|
+
- Provides ActiveRecord-like interface: `find()`, `build()`, `create()`, `delete()`
|
|
52
|
+
- Supports path scoping with `in_path()` method
|
|
53
|
+
- Handles recursive vs non-recursive queries
|
|
54
|
+
|
|
55
|
+
**Resource (lib/versacommerce/theme_api_client/resource.rb)**
|
|
56
|
+
- Base class for Directory and File resources
|
|
57
|
+
- Uses ActiveModel for validations and dirty tracking
|
|
58
|
+
- Implements `save()`, `update()`, `new_record?` methods
|
|
59
|
+
- Each resource class is dynamically created per client instance (see `directory_class` and `file_class` in client)
|
|
60
|
+
|
|
61
|
+
### Resource Types
|
|
62
|
+
|
|
63
|
+
**Directory (lib/versacommerce/theme_api_client/resources/directory.rb)**
|
|
64
|
+
- Represents theme directories
|
|
65
|
+
- Has `path` attribute
|
|
66
|
+
- Provides `files()` method to access files within the directory
|
|
67
|
+
|
|
68
|
+
**File (lib/versacommerce/theme_api_client/resources/file.rb)**
|
|
69
|
+
- Represents theme files
|
|
70
|
+
- Has `path` and `content` attributes
|
|
71
|
+
- Content loading is conditional: text files load automatically, binary files require explicit `load_content: true`
|
|
72
|
+
- Provides `reload_content()` and `has_content?` methods
|
|
73
|
+
|
|
74
|
+
### Key Design Patterns
|
|
75
|
+
|
|
76
|
+
**Dynamic Class Creation**: The client creates subclasses of Directory and File at runtime (via `directory_class` and `file_class`), binding them to the specific client instance. This allows each resource to access the client's fetcher and configuration.
|
|
77
|
+
|
|
78
|
+
**Relation Pattern**: Inspired by ActiveRecord, relations provide chainable query interfaces and lazy evaluation. The `in_path()` method modifies the relation's path scope without executing queries.
|
|
79
|
+
|
|
80
|
+
**Path Helpers**: The client provides `directory_path()`, `file_path()`, `download_path()`, and `tree_path()` helper methods that build Pathname objects for API endpoints.
|
|
81
|
+
|
|
82
|
+
## Module Structure
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
lib/versacommerce/
|
|
86
|
+
theme_api_client.rb # Main client class
|
|
87
|
+
theme_api_client/
|
|
88
|
+
client.rb # (Appears to be duplicate/alternative entry point)
|
|
89
|
+
fetcher.rb # HTTP client wrapper
|
|
90
|
+
relation.rb # Base relation class
|
|
91
|
+
resource.rb # Base resource class with ActiveModel
|
|
92
|
+
version.rb # Gem version constant
|
|
93
|
+
relations/
|
|
94
|
+
directory_relation.rb
|
|
95
|
+
file_relation.rb
|
|
96
|
+
resources/
|
|
97
|
+
directory.rb
|
|
98
|
+
file.rb
|
|
99
|
+
file_behaviour.rb # Shared file behavior module
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Testing
|
|
103
|
+
|
|
104
|
+
This gem does not appear to have a test suite in the repository. When adding tests, consider creating a spec/ or test/ directory.
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -73,7 +73,7 @@ module Versacommerce
|
|
|
73
73
|
|
|
74
74
|
def delete
|
|
75
75
|
unless new_record?
|
|
76
|
-
|
|
76
|
+
fetcher.delete(file_path(path))
|
|
77
77
|
content_will_change!
|
|
78
78
|
self.new_record = true
|
|
79
79
|
end
|
|
@@ -94,7 +94,7 @@ module Versacommerce
|
|
|
94
94
|
unless new_record?
|
|
95
95
|
response = fetcher.get(download_path(path))
|
|
96
96
|
self.content = response.to_s
|
|
97
|
-
clear_attribute_changes(:content)
|
|
97
|
+
clear_attribute_changes([:content])
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
self
|
|
@@ -3,8 +3,7 @@ require_relative 'lib/versacommerce/theme_api_client/version'
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'versacommerce-theme_api_client'
|
|
5
5
|
spec.version = Versacommerce::ThemeAPIClient::VERSION
|
|
6
|
-
spec.authors = ['
|
|
7
|
-
spec.email = ['buehlmann@versacommerce.de']
|
|
6
|
+
spec.authors = ['VersaCommerce GmbH']
|
|
8
7
|
|
|
9
8
|
spec.summary = 'API Client for the VersaCommercer Theme API.'
|
|
10
9
|
spec.description = 'This Gem acts as an API Client for the VersaCommerce Theme API.'
|
|
@@ -16,14 +15,14 @@ Gem::Specification.new do |spec|
|
|
|
16
15
|
spec.executables = spec.files.grep(/\Aexe/) { |f| File.basename(f) }
|
|
17
16
|
spec.require_paths = ['lib']
|
|
18
17
|
|
|
19
|
-
spec.required_ruby_version = '>=
|
|
18
|
+
spec.required_ruby_version = '>= 3.1.0'
|
|
20
19
|
|
|
21
|
-
spec.add_runtime_dependency 'http', '
|
|
22
|
-
spec.add_runtime_dependency 'activesupport', '
|
|
23
|
-
spec.add_runtime_dependency 'activemodel', '
|
|
20
|
+
spec.add_runtime_dependency 'http', '~> 5.0'
|
|
21
|
+
spec.add_runtime_dependency 'activesupport', '>= 4.2', '< 7.0'
|
|
22
|
+
spec.add_runtime_dependency 'activemodel', '>= 4.2', '< 7.0'
|
|
24
23
|
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
|
27
|
-
spec.add_development_dependency 'pry', '0.
|
|
28
|
-
spec.add_development_dependency 'pry-stack_explorer', '0.
|
|
24
|
+
spec.add_development_dependency 'bundler', '>= 1.8'
|
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
26
|
+
spec.add_development_dependency 'pry', '~> 0.14'
|
|
27
|
+
spec.add_development_dependency 'pry-stack_explorer', '~> 0.6'
|
|
29
28
|
end
|
metadata
CHANGED
|
@@ -1,75 +1,81 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: versacommerce-theme_api_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- VersaCommerce GmbH
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: http
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.8.12
|
|
20
|
-
- - "<"
|
|
17
|
+
- - "~>"
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
19
|
+
version: '5.0'
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
|
-
- - "
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.8.12
|
|
30
|
-
- - "<"
|
|
24
|
+
- - "~>"
|
|
31
25
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
26
|
+
version: '5.0'
|
|
33
27
|
- !ruby/object:Gem::Dependency
|
|
34
28
|
name: activesupport
|
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
|
36
30
|
requirements:
|
|
37
|
-
- - "
|
|
31
|
+
- - ">="
|
|
38
32
|
- !ruby/object:Gem::Version
|
|
39
33
|
version: '4.2'
|
|
34
|
+
- - "<"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '7.0'
|
|
40
37
|
type: :runtime
|
|
41
38
|
prerelease: false
|
|
42
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
40
|
requirements:
|
|
44
|
-
- - "
|
|
41
|
+
- - ">="
|
|
45
42
|
- !ruby/object:Gem::Version
|
|
46
43
|
version: '4.2'
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '7.0'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: activemodel
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
-
- - "
|
|
51
|
+
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '4.2'
|
|
54
|
+
- - "<"
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '7.0'
|
|
54
57
|
type: :runtime
|
|
55
58
|
prerelease: false
|
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
60
|
requirements:
|
|
58
|
-
- - "
|
|
61
|
+
- - ">="
|
|
59
62
|
- !ruby/object:Gem::Version
|
|
60
63
|
version: '4.2'
|
|
64
|
+
- - "<"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '7.0'
|
|
61
67
|
- !ruby/object:Gem::Dependency
|
|
62
68
|
name: bundler
|
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
|
64
70
|
requirements:
|
|
65
|
-
- - "
|
|
71
|
+
- - ">="
|
|
66
72
|
- !ruby/object:Gem::Version
|
|
67
73
|
version: '1.8'
|
|
68
74
|
type: :development
|
|
69
75
|
prerelease: false
|
|
70
76
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
77
|
requirements:
|
|
72
|
-
- - "
|
|
78
|
+
- - ">="
|
|
73
79
|
- !ruby/object:Gem::Version
|
|
74
80
|
version: '1.8'
|
|
75
81
|
- !ruby/object:Gem::Dependency
|
|
@@ -78,50 +84,51 @@ dependencies:
|
|
|
78
84
|
requirements:
|
|
79
85
|
- - "~>"
|
|
80
86
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
87
|
+
version: '13.0'
|
|
82
88
|
type: :development
|
|
83
89
|
prerelease: false
|
|
84
90
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
91
|
requirements:
|
|
86
92
|
- - "~>"
|
|
87
93
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
94
|
+
version: '13.0'
|
|
89
95
|
- !ruby/object:Gem::Dependency
|
|
90
96
|
name: pry
|
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
|
92
98
|
requirements:
|
|
93
|
-
- -
|
|
99
|
+
- - "~>"
|
|
94
100
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.
|
|
101
|
+
version: '0.14'
|
|
96
102
|
type: :development
|
|
97
103
|
prerelease: false
|
|
98
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
105
|
requirements:
|
|
100
|
-
- -
|
|
106
|
+
- - "~>"
|
|
101
107
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 0.
|
|
108
|
+
version: '0.14'
|
|
103
109
|
- !ruby/object:Gem::Dependency
|
|
104
110
|
name: pry-stack_explorer
|
|
105
111
|
requirement: !ruby/object:Gem::Requirement
|
|
106
112
|
requirements:
|
|
107
|
-
- -
|
|
113
|
+
- - "~>"
|
|
108
114
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 0.
|
|
115
|
+
version: '0.6'
|
|
110
116
|
type: :development
|
|
111
117
|
prerelease: false
|
|
112
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
113
119
|
requirements:
|
|
114
|
-
- -
|
|
120
|
+
- - "~>"
|
|
115
121
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: 0.
|
|
122
|
+
version: '0.6'
|
|
117
123
|
description: This Gem acts as an API Client for the VersaCommerce Theme API.
|
|
118
124
|
email:
|
|
119
|
-
- buehlmann@versacommerce.de
|
|
120
125
|
executables: []
|
|
121
126
|
extensions: []
|
|
122
127
|
extra_rdoc_files: []
|
|
123
128
|
files:
|
|
124
129
|
- ".gitignore"
|
|
130
|
+
- ".ruby-version"
|
|
131
|
+
- CLAUDE.md
|
|
125
132
|
- Gemfile
|
|
126
133
|
- LICENSE.txt
|
|
127
134
|
- README.md
|
|
@@ -144,7 +151,7 @@ homepage: https://github.com/versacommerce/versacommerce-theme_api_client
|
|
|
144
151
|
licenses:
|
|
145
152
|
- MIT
|
|
146
153
|
metadata: {}
|
|
147
|
-
post_install_message:
|
|
154
|
+
post_install_message:
|
|
148
155
|
rdoc_options: []
|
|
149
156
|
require_paths:
|
|
150
157
|
- lib
|
|
@@ -152,16 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
152
159
|
requirements:
|
|
153
160
|
- - ">="
|
|
154
161
|
- !ruby/object:Gem::Version
|
|
155
|
-
version:
|
|
162
|
+
version: 3.1.0
|
|
156
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
164
|
requirements:
|
|
158
165
|
- - ">="
|
|
159
166
|
- !ruby/object:Gem::Version
|
|
160
167
|
version: '0'
|
|
161
168
|
requirements: []
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
signing_key:
|
|
169
|
+
rubygems_version: 3.3.26
|
|
170
|
+
signing_key:
|
|
165
171
|
specification_version: 4
|
|
166
172
|
summary: API Client for the VersaCommercer Theme API.
|
|
167
173
|
test_files: []
|