Class: DurableHuggingfaceHub::Types::Organization
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/user.rb
Overview
Information about a HuggingFace Hub organization.
Instance Attribute Summary collapse
-
#avatar_url ⇒ String?
readonly
Organization avatar URL.
-
#fullname ⇒ String?
readonly
Full display name.
-
#is_enterprise ⇒ Boolean?
readonly
Whether this is an Enterprise organization.
-
#name ⇒ String
readonly
Organization name/ID.
Class Method Summary collapse
-
.from_hash(data) ⇒ Object
Transform isEnterprise from API to is_enterprise.
Instance Method Summary collapse
-
#display_name ⇒ String
Returns the display name (fullname if available, otherwise name).
-
#enterprise? ⇒ Boolean
Checks if this is an Enterprise organization.
-
#inspect ⇒ String
Returns a detailed inspection string.
-
#to_s ⇒ String
Returns a short description of the organization.
Instance Attribute Details
#avatar_url ⇒ String? (readonly)
Returns Organization avatar URL.
138 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 138 attribute :avatar_url, Types::OptionalString.default(nil) |
#fullname ⇒ String? (readonly)
Returns Full display name.
134 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 134 attribute :fullname, Types::OptionalString.default(nil) |
#is_enterprise ⇒ Boolean? (readonly)
Returns Whether this is an Enterprise organization.
142 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 142 attribute :is_enterprise, Types::OptionalBool.default(nil) |
#name ⇒ String (readonly)
Returns Organization name/ID.
130 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 130 attribute :name, Types::String |
Class Method Details
.from_hash(data) ⇒ Object
Transform isEnterprise from API to is_enterprise
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 145 def self.from_hash(data) transformed = data.dup if transformed.key?("isEnterprise") && !transformed.key?("is_enterprise") transformed["is_enterprise"] = transformed.delete("isEnterprise") elsif transformed.key?(:isEnterprise) && !transformed.key?(:is_enterprise) transformed[:is_enterprise] = transformed.delete(:isEnterprise) end if transformed.key?("avatarUrl") && !transformed.key?("avatar_url") transformed["avatar_url"] = transformed.delete("avatarUrl") elsif transformed.key?(:avatarUrl) && !transformed.key?(:avatar_url) transformed[:avatar_url] = transformed.delete(:avatarUrl) end new(transformed) end |
Instance Method Details
#display_name ⇒ String
Returns the display name (fullname if available, otherwise name).
172 173 174 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 172 def display_name fullname || name end |
#enterprise? ⇒ Boolean
Checks if this is an Enterprise organization.
165 166 167 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 165 def enterprise? is_enterprise == true end |
#inspect ⇒ String
Returns a detailed inspection string.
186 187 188 189 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 186 def inspect "#<#{self.class.name} name=#{name.inspect} fullname=#{fullname.inspect} " \ "enterprise=#{enterprise?}>" end |
#to_s ⇒ String
Returns a short description of the organization.
179 180 181 |
# File 'lib/durable_huggingface_hub/types/user.rb', line 179 def to_s display_name end |