Class: Io::Flow::V0::Models::Role
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Role
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .admin ⇒ Object
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of Role for this value, creating a new instance for an unknown value.
-
.from_string(value) ⇒ Object
Returns the instance of Role for this value, or nil if not found.
- .member ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ Role
constructor
A new instance of Role.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ Role
Returns a new instance of Role.
14213 14214 14215 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14213 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
14211 14212 14213 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14211 def value @value end |
Class Method Details
.admin ⇒ Object
14237 14238 14239 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14237 def Role.admin @@_admin ||= Role.new('admin') end |
.ALL ⇒ Object
14233 14234 14235 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14233 def Role.ALL @@all ||= [Role.admin, Role.member] end |
.apply(value) ⇒ Object
Returns the instance of Role for this value, creating a new instance for an unknown value
14218 14219 14220 14221 14222 14223 14224 14225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14218 def Role.apply(value) if value.instance_of?(Role) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || Role.new(value)) end end |
.from_string(value) ⇒ Object
Returns the instance of Role for this value, or nil if not found
14228 14229 14230 14231 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14228 def Role.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) Role.ALL.find { |v| v.value == value } end |
Instance Method Details
#to_hash ⇒ Object
14245 14246 14247 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14245 def to_hash value end |