as_colour 0.1.0
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 +7 -0
- data/.gitignore +4 -0
- data/.rspec +4 -0
- data/.rubocop.yml +704 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Dockerfile +24 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +134 -0
- data/LICENSE +21 -0
- data/README.md +124 -0
- data/Rakefile +8 -0
- data/as_colour.gemspec +34 -0
- data/as_colour_api.pdf +0 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +20 -0
- data/examples/catalog_colours.rb +23 -0
- data/examples/catalog_products.rb +54 -0
- data/examples/inventory.rb +23 -0
- data/examples/price_list.rb +25 -0
- data/lib/as_colour/as_colour_error.rb +61 -0
- data/lib/as_colour/client/colours.rb +13 -0
- data/lib/as_colour/client/inventory_items.rb +20 -0
- data/lib/as_colour/client/price_list.rb +13 -0
- data/lib/as_colour/client/product_variants.rb +33 -0
- data/lib/as_colour/client/products.rb +27 -0
- data/lib/as_colour/client.rb +105 -0
- data/lib/as_colour/model/as_colour_model.rb +7 -0
- data/lib/as_colour/model/colour.rb +7 -0
- data/lib/as_colour/model/inventory_item.rb +7 -0
- data/lib/as_colour/model/price_list_item.rb +7 -0
- data/lib/as_colour/model/product.rb +7 -0
- data/lib/as_colour/model/product_image.rb +7 -0
- data/lib/as_colour/model/product_inventory.rb +7 -0
- data/lib/as_colour/model/product_variant.rb +7 -0
- data/lib/as_colour/version.rb +5 -0
- data/lib/as_colour.rb +13 -0
- metadata +154 -0
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at weshays@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
FROM ruby:3.3.5
|
2
|
+
|
3
|
+
RUN apt update -yqq
|
4
|
+
# RUN apt-get install libvips-dev -yqq
|
5
|
+
# RUN apt-get install build-essential libpq-dev postgresql-contrib vim -yqq
|
6
|
+
# RUN apt-get install imagemagick libmagickcore-dev libmagickwand-dev -yqq
|
7
|
+
RUN apt-get -q clean
|
8
|
+
RUN rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man
|
9
|
+
|
10
|
+
RUN mkdir -p /app
|
11
|
+
WORKDIR /app
|
12
|
+
|
13
|
+
RUN gem update --system
|
14
|
+
RUN gem install bundler --version 2.4.6
|
15
|
+
RUN bundle config set specific_platform x86_64-linux
|
16
|
+
COPY . .
|
17
|
+
RUN bundle install
|
18
|
+
|
19
|
+
|
20
|
+
# RUN bundle binstubs --all
|
21
|
+
|
22
|
+
# RUN chmod +x docker-entrypoint.sh
|
23
|
+
# ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
24
|
+
# CMD ["sleep", "100000"]
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in ascolour.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'pry-byebug', '~> 3.10'
|
10
|
+
gem 'dotenv', '~> 3.1'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'rspec', '~> 3.13'
|
13
|
+
gem 'rubocop', '~> 1.69'
|
14
|
+
gem 'simplecov', '~> 0.22'
|
15
|
+
gem 'vcr', '~> 6.3'
|
16
|
+
gem 'webmock', '~> 3.24'
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ascolour (0.1.0)
|
5
|
+
awrence (~> 3.0)
|
6
|
+
json (~> 2.12)
|
7
|
+
ostruct (~> 0.6.1)
|
8
|
+
plissken (~> 3.0)
|
9
|
+
typhoeus (~> 1.4)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.8.7)
|
15
|
+
public_suffix (>= 2.0.2, < 7.0)
|
16
|
+
ast (2.4.2)
|
17
|
+
awrence (3.0.0)
|
18
|
+
base64 (0.2.0)
|
19
|
+
bigdecimal (3.1.9)
|
20
|
+
byebug (11.1.3)
|
21
|
+
coderay (1.1.3)
|
22
|
+
crack (1.0.0)
|
23
|
+
bigdecimal
|
24
|
+
rexml
|
25
|
+
diff-lcs (1.6.0)
|
26
|
+
docile (1.4.1)
|
27
|
+
dotenv (3.1.7)
|
28
|
+
ethon (0.16.0)
|
29
|
+
ffi (>= 1.15.0)
|
30
|
+
ffi (1.17.1)
|
31
|
+
ffi (1.17.1-aarch64-linux-gnu)
|
32
|
+
ffi (1.17.1-aarch64-linux-musl)
|
33
|
+
ffi (1.17.1-arm-linux-gnu)
|
34
|
+
ffi (1.17.1-arm-linux-musl)
|
35
|
+
ffi (1.17.1-arm64-darwin)
|
36
|
+
ffi (1.17.1-x86-linux-gnu)
|
37
|
+
ffi (1.17.1-x86-linux-musl)
|
38
|
+
ffi (1.17.1-x86_64-darwin)
|
39
|
+
ffi (1.17.1-x86_64-linux-gnu)
|
40
|
+
ffi (1.17.1-x86_64-linux-musl)
|
41
|
+
hashdiff (1.1.2)
|
42
|
+
json (2.12.0)
|
43
|
+
language_server-protocol (3.17.0.4)
|
44
|
+
lint_roller (1.1.0)
|
45
|
+
method_source (1.1.0)
|
46
|
+
ostruct (0.6.1)
|
47
|
+
parallel (1.26.3)
|
48
|
+
parser (3.3.7.1)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
racc
|
51
|
+
plissken (3.0.0)
|
52
|
+
pry (0.14.2)
|
53
|
+
coderay (~> 1.1)
|
54
|
+
method_source (~> 1.0)
|
55
|
+
pry-byebug (3.10.1)
|
56
|
+
byebug (~> 11.0)
|
57
|
+
pry (>= 0.13, < 0.15)
|
58
|
+
public_suffix (6.0.1)
|
59
|
+
racc (1.8.1)
|
60
|
+
rainbow (3.1.1)
|
61
|
+
rake (13.2.1)
|
62
|
+
regexp_parser (2.10.0)
|
63
|
+
rexml (3.4.1)
|
64
|
+
rspec (3.13.0)
|
65
|
+
rspec-core (~> 3.13.0)
|
66
|
+
rspec-expectations (~> 3.13.0)
|
67
|
+
rspec-mocks (~> 3.13.0)
|
68
|
+
rspec-core (3.13.3)
|
69
|
+
rspec-support (~> 3.13.0)
|
70
|
+
rspec-expectations (3.13.3)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.13.0)
|
73
|
+
rspec-mocks (3.13.2)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.13.0)
|
76
|
+
rspec-support (3.13.2)
|
77
|
+
rubocop (1.73.2)
|
78
|
+
json (~> 2.3)
|
79
|
+
language_server-protocol (~> 3.17.0.2)
|
80
|
+
lint_roller (~> 1.1.0)
|
81
|
+
parallel (~> 1.10)
|
82
|
+
parser (>= 3.3.0.2)
|
83
|
+
rainbow (>= 2.2.2, < 4.0)
|
84
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
85
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
86
|
+
ruby-progressbar (~> 1.7)
|
87
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
88
|
+
rubocop-ast (1.38.1)
|
89
|
+
parser (>= 3.3.1.0)
|
90
|
+
ruby-progressbar (1.13.0)
|
91
|
+
simplecov (0.22.0)
|
92
|
+
docile (~> 1.1)
|
93
|
+
simplecov-html (~> 0.11)
|
94
|
+
simplecov_json_formatter (~> 0.1)
|
95
|
+
simplecov-html (0.13.1)
|
96
|
+
simplecov_json_formatter (0.1.4)
|
97
|
+
typhoeus (1.4.1)
|
98
|
+
ethon (>= 0.9.0)
|
99
|
+
unicode-display_width (3.1.4)
|
100
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
101
|
+
unicode-emoji (4.0.4)
|
102
|
+
vcr (6.3.1)
|
103
|
+
base64
|
104
|
+
webmock (3.25.1)
|
105
|
+
addressable (>= 2.8.0)
|
106
|
+
crack (>= 0.3.2)
|
107
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
108
|
+
|
109
|
+
PLATFORMS
|
110
|
+
aarch64-linux-gnu
|
111
|
+
aarch64-linux-musl
|
112
|
+
arm-linux-gnu
|
113
|
+
arm-linux-musl
|
114
|
+
arm64-darwin
|
115
|
+
ruby
|
116
|
+
x86-linux-gnu
|
117
|
+
x86-linux-musl
|
118
|
+
x86_64-darwin
|
119
|
+
x86_64-linux-gnu
|
120
|
+
x86_64-linux-musl
|
121
|
+
|
122
|
+
DEPENDENCIES
|
123
|
+
ascolour!
|
124
|
+
dotenv (~> 3.1)
|
125
|
+
pry-byebug (~> 3.10)
|
126
|
+
rake (~> 13.0)
|
127
|
+
rspec (~> 3.13)
|
128
|
+
rubocop (~> 1.69)
|
129
|
+
simplecov (~> 0.22)
|
130
|
+
vcr (~> 6.3)
|
131
|
+
webmock (~> 3.24)
|
132
|
+
|
133
|
+
BUNDLED WITH
|
134
|
+
2.6.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 BenefitMany
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# ASColour
|
2
|
+
|
3
|
+
This gem is a wrapper for the ASColour API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'as_colour'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install ascolour
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'as_colour'
|
25
|
+
|
26
|
+
auth = {
|
27
|
+
subscription_key: ENV['ASCOLOUR_SUBSCRIPTION_KEY']
|
28
|
+
}
|
29
|
+
|
30
|
+
client = AsColour::Client.new(auth)
|
31
|
+
|
32
|
+
client.colours.each do |colour|
|
33
|
+
puts colour
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
### Local Development using RVM
|
40
|
+
|
41
|
+
You will need to add a .env file to the root of the project with the following variables:
|
42
|
+
|
43
|
+
```
|
44
|
+
ASCOLOUR_SUBSCRIPTION_KEY=your_access_key
|
45
|
+
```
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
48
|
+
|
49
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
50
|
+
|
51
|
+
### Local Development using Docker
|
52
|
+
|
53
|
+
You can also use Docker to develop the gem. To do this, you will need to have Docker installed on your machine.
|
54
|
+
|
55
|
+
To get started, you will need to build the Docker image:
|
56
|
+
|
57
|
+
```
|
58
|
+
docker compose build
|
59
|
+
```
|
60
|
+
|
61
|
+
After the image is built, you can run the following command to start the container. Note that
|
62
|
+
you will want to do this in its own terminal window so you can attach to the container.
|
63
|
+
|
64
|
+
```
|
65
|
+
docker compose up
|
66
|
+
```
|
67
|
+
|
68
|
+
You will see "Attaching to ascolour" in the output. This means the container is running and you can now run the following command to attach to the container:
|
69
|
+
|
70
|
+
```
|
71
|
+
docker exec -it ascolour bash
|
72
|
+
```
|
73
|
+
|
74
|
+
To stop the container, you can run the following command:
|
75
|
+
|
76
|
+
```
|
77
|
+
docker compose down
|
78
|
+
```
|
79
|
+
|
80
|
+
# Rebuild Gemfile.lock
|
81
|
+
|
82
|
+
```
|
83
|
+
docker compose run ascolour bundle install
|
84
|
+
```
|
85
|
+
|
86
|
+
## Implemented Endpoints
|
87
|
+
|
88
|
+
- Catalog
|
89
|
+
- Colours
|
90
|
+
- List: `GET /catalog/colours`
|
91
|
+
- Products
|
92
|
+
- List: `GET /catalog/products`
|
93
|
+
- Item: `GET /catalog/products/{style_code}`
|
94
|
+
- Images: `GET /catalog/products/{style_code}/images`
|
95
|
+
- Product Variants
|
96
|
+
- List: `GET /catalog/products/{style_code}/variants`
|
97
|
+
- Item: `GET /catalog/products/{style_code}/variants/{variant_id}`
|
98
|
+
- Inventory: `GET /catalog/products/{style_code}/variants/{variant_id}/inventory`
|
99
|
+
- Inventory Inbound: `GET /catalog/products/{style_code}/variants/{variant_id}/inbound`
|
100
|
+
- Price List
|
101
|
+
- List: `GET /price-list`
|
102
|
+
- Inventory
|
103
|
+
- Items: `GET /inventory/items`
|
104
|
+
- Item: `GET /inventory/items/{sku}`
|
105
|
+
|
106
|
+
## TODO Endpoints
|
107
|
+
|
108
|
+
All known endpoints have been implemented. If you know of any endpoints that are not listed above, please open an issue or a pull request.
|
109
|
+
|
110
|
+
## Limitations
|
111
|
+
|
112
|
+
In order to use the ASColour API you must first have a ASColour account. At this time, ASColour does not offer a sandbox environment for testing, so you will need to reach out to them about getting access your account data.
|
113
|
+
|
114
|
+
## Contributing
|
115
|
+
|
116
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/BenefitMany/ascolour. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/BenefitMany/ascolour/blob/main/CODE_OF_CONDUCT.md).
|
117
|
+
|
118
|
+
## License
|
119
|
+
|
120
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
121
|
+
|
122
|
+
## Code of Conduct
|
123
|
+
|
124
|
+
Everyone interacting in the ascolour project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/BenefitMany/ascolour/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/as_colour.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), 'lib'))
|
4
|
+
|
5
|
+
require_relative 'lib/as_colour/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'as_colour'
|
9
|
+
spec.version = AsColour::VERSION
|
10
|
+
spec.authors = ['Wes Hays']
|
11
|
+
spec.email = ['weshays@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Ruby API wrapper for the ASColour.com API'
|
14
|
+
spec.description = 'Ruby API wrapper for the ASColour.com API'
|
15
|
+
spec.homepage = 'https://github.com/BenefitMany/as_colour'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
18
|
+
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/BenefitMany/as_colour'
|
20
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/BenefitMany/as_colour/issues'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/BenefitMany/as_colour/blob/main/CHANGELOG.md'
|
22
|
+
spec.metadata['documentation_uri'] = 'https://github.com/BenefitMany/as_colour/blob/main/as_colour_api.pdf'
|
23
|
+
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
spec.add_dependency 'typhoeus', '~> 1.4'
|
30
|
+
spec.add_dependency 'json', '~> 2.12'
|
31
|
+
spec.add_dependency 'plissken', '~> 3.0'
|
32
|
+
spec.add_dependency 'awrence', '~> 3.0'
|
33
|
+
spec.add_dependency 'ostruct', '~> 0.6.1'
|
34
|
+
end
|
data/as_colour_api.pdf
ADDED
Binary file
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'as_colour'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
services:
|
2
|
+
ascolour:
|
3
|
+
container_name: "ascolour"
|
4
|
+
platform: linux/x86_64
|
5
|
+
build: .
|
6
|
+
# command: bundle exec rails s -p 3000 -b '0.0.0.0'
|
7
|
+
environment:
|
8
|
+
LOG_LEVEL: DEBUG
|
9
|
+
volumes:
|
10
|
+
- .:/app
|
11
|
+
- ascolour_bundle:/usr/local/bundle
|
12
|
+
working_dir: /app
|
13
|
+
# Keeps the stdin open, so we can attach to our app container's process and
|
14
|
+
# do stuff such as `byebug` or `binding.pry`:
|
15
|
+
stdin_open: true
|
16
|
+
# Allows us to send signals (CTRL+C, CTRL+P + CTRL+Q) into the container
|
17
|
+
tty: true
|
18
|
+
|
19
|
+
volumes:
|
20
|
+
ascolour_bundle:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'pry-byebug'
|
2
|
+
require 'dotenv'
|
3
|
+
require_relative '../lib/as_colour'
|
4
|
+
|
5
|
+
Dotenv.load('../.env')
|
6
|
+
|
7
|
+
auth = {
|
8
|
+
subscription_key: ENV['ASCOLOUR_SUBSCRIPTION_KEY']
|
9
|
+
}
|
10
|
+
ascolor_client = AsColour::Client.new(auth)
|
11
|
+
|
12
|
+
# =========================================
|
13
|
+
# Colours List
|
14
|
+
# =========================================
|
15
|
+
ascolor_client.colours.each do |colour|
|
16
|
+
puts colour
|
17
|
+
end
|
18
|
+
|
19
|
+
# Filter by color name
|
20
|
+
# =========================================
|
21
|
+
ascolor_client.colours(colour_filter: 'red').each do |colour|
|
22
|
+
puts colour
|
23
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'pry-byebug'
|
2
|
+
require 'dotenv'
|
3
|
+
require_relative '../lib/as_colour'
|
4
|
+
|
5
|
+
Dotenv.load('../.env')
|
6
|
+
|
7
|
+
auth = {
|
8
|
+
subscription_key: ENV['ASCOLOUR_SUBSCRIPTION_KEY']
|
9
|
+
}
|
10
|
+
ascolor_client = AsColour::Client.new(auth)
|
11
|
+
|
12
|
+
# =========================================
|
13
|
+
# Products List
|
14
|
+
# =========================================
|
15
|
+
|
16
|
+
ascolor_client.products.each do |colour|
|
17
|
+
puts colour
|
18
|
+
end
|
19
|
+
|
20
|
+
# Filter by color name
|
21
|
+
# =========================================
|
22
|
+
ascolor_client.colours(colour_filter: 'red').each do |colour|
|
23
|
+
puts colour
|
24
|
+
end
|
25
|
+
|
26
|
+
# Variant List
|
27
|
+
# =========================================
|
28
|
+
ascolor_client.product_variants('1001').each do |variant|
|
29
|
+
puts variant
|
30
|
+
end
|
31
|
+
|
32
|
+
# Variant Item
|
33
|
+
# =========================================
|
34
|
+
ascolor_client.product_variant('1001', '1001-BLACK-P-OS').each do |inventory|
|
35
|
+
puts inventory
|
36
|
+
end
|
37
|
+
|
38
|
+
# Variant Inventory
|
39
|
+
# =========================================
|
40
|
+
ascolor_client.product_variant_inventory('1001', '1001-BLACK-P-OS').each do |inventory|
|
41
|
+
puts inventory
|
42
|
+
end
|
43
|
+
|
44
|
+
# Variant Inventory Inbound (NOT WORKING)
|
45
|
+
# =========================================
|
46
|
+
# ascolor_client.product_variant_inventory_inbound('1001', '1001-BLACK-P-OS').each do |inventory|
|
47
|
+
# puts inventory
|
48
|
+
# end
|
49
|
+
|
50
|
+
# Product Images
|
51
|
+
# =========================================
|
52
|
+
ascolor_client.product_images('1001').each do |variant|
|
53
|
+
puts variant
|
54
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'pry-byebug'
|
2
|
+
require 'dotenv'
|
3
|
+
require_relative '../lib/as_colour'
|
4
|
+
|
5
|
+
Dotenv.load('../.env')
|
6
|
+
|
7
|
+
auth = {
|
8
|
+
subscription_key: ENV['ASCOLOUR_SUBSCRIPTION_KEY']
|
9
|
+
}
|
10
|
+
ascolor_client = AsColour::Client.new(auth)
|
11
|
+
|
12
|
+
# =========================================
|
13
|
+
# Items List
|
14
|
+
# =========================================
|
15
|
+
ascolor_client.items.each do |item|
|
16
|
+
puts item
|
17
|
+
end
|
18
|
+
|
19
|
+
# Item by SKU
|
20
|
+
# =========================================
|
21
|
+
ascolor_client.item('1001-BLACK-P-OS').each do |item|
|
22
|
+
puts item
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pry-byebug'
|
2
|
+
require 'dotenv'
|
3
|
+
require_relative '../lib/as_colour'
|
4
|
+
|
5
|
+
Dotenv.load('../.env')
|
6
|
+
|
7
|
+
auth = {
|
8
|
+
subscription_key: ENV['ASCOLOUR_SUBSCRIPTION_KEY'],
|
9
|
+
email: ENV['ASCOLOUR_EMAIL'],
|
10
|
+
password: ENV['ASCOLOUR_PASSWORD']
|
11
|
+
}
|
12
|
+
ascolor_client = AsColour::Client.new(auth)
|
13
|
+
|
14
|
+
# =========================================
|
15
|
+
# Price List
|
16
|
+
# =========================================
|
17
|
+
ascolor_client.price_list.each do |price|
|
18
|
+
puts price
|
19
|
+
end
|
20
|
+
|
21
|
+
# Set Page Number and Page Size
|
22
|
+
# =========================================
|
23
|
+
ascolor_client.price_list(page_number: 2, page_size: 3).each do |price|
|
24
|
+
puts price
|
25
|
+
end
|