Skip to content

Commit e248e98

Browse files
committed
Merge branch 'fix/error-codes-enum' into development
* fix/error-codes-enum: add license update changelog and readme use string variant name
2 parents 2f4389c + 8aef897 commit e248e98

File tree

4 files changed

+12
-37
lines changed

4 files changed

+12
-37
lines changed

crates/smbcloud-model/src/error_codes.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::fmt;
22
use serde::{Deserialize, Serialize};
33
use serde_repr::{Deserialize_repr, Serialize_repr};
44
use std::fmt::{Display, Formatter};
5-
use strum_macros::EnumIter;
5+
use strum_macros::{EnumIter, IntoStaticStr};
66
use thiserror::Error;
77

88
#[derive(Error, Serialize, Deserialize, Debug)]
@@ -20,7 +20,7 @@ impl Display for ErrorResponse {
2020
}
2121
}
2222

23-
#[derive(Error, Serialize_repr, Deserialize_repr, Debug, EnumIter)]
23+
#[derive(Error, Serialize_repr, Deserialize_repr, Debug, EnumIter, IntoStaticStr)]
2424
#[repr(i32)]
2525
pub enum ErrorCode {
2626
#[error("Unknown error.")]
@@ -66,6 +66,9 @@ impl ErrorCode {
6666
}
6767

6868
pub fn rb_constant_name(&self) -> String {
69-
self.to_string()
69+
// Using IntoStaticStr to get the variant name directly.
70+
// self.into() will return a &'static str representing the variant name.
71+
let variant_name_static_str: &'static str = self.into();
72+
variant_name_static_str.to_string()
7073
}
7174
}

gems/model/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# v0.3
2+
3+
Bleeding edge.

gems/model/README.md

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
# Model
1+
# smbcloud-model Gem
22

3-
TODO: Delete this and the text below, and describe your gem
4-
5-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/model`. To experiment with that code, run `bin/console` for an interactive prompt.
6-
7-
## Installation
8-
9-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10-
11-
Install the gem and add to the application's Gemfile by executing:
12-
13-
```bash
14-
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15-
```
16-
17-
If bundler is not being used to manage dependencies, install the gem by executing:
18-
19-
```bash
20-
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21-
```
22-
23-
## Usage
24-
25-
TODO: Write usage instructions here
26-
27-
## Development
28-
29-
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.
30-
31-
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).
32-
33-
## Contributing
34-
35-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/model.
3+
Ruby Gem version of `smbcloud-model`.

gems/model/model.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
1111
spec.summary = "Ruby binding for smbcloud-cli model."
1212
spec.description = "Ruby binding for smbcloud-cli modellllllllllll."
1313
spec.homepage = "https://github.com/smbcloudXYZ/smbcloud-cli/tree/development/gems/model"
14+
spec.license = "MIT"
1415
spec.required_ruby_version = ">= 3.1.0"
1516
spec.required_rubygems_version = ">= 3.3.11"
1617

0 commit comments

Comments
 (0)