Class: Ros::Urn
- Inherits:
-
Struct
- Object
- Struct
- Ros::Urn
- Defined in:
- lib/ros/core.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#partition_name ⇒ Object
Returns the value of attribute partition_name.
-
#region ⇒ Object
Returns the value of attribute region.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#service_name ⇒ Object
Returns the value of attribute service_name.
-
#txt ⇒ Object
Returns the value of attribute txt.
Class Method Summary collapse
Instance Method Summary collapse
- #instance ⇒ Object
- #model ⇒ Object
- #model_name ⇒ Object
- #resource_id ⇒ Object
- #resource_type ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id
32 33 34 |
# File 'lib/ros/core.rb', line 32 def account_id @account_id end |
#partition_name ⇒ Object
Returns the value of attribute partition_name
32 33 34 |
# File 'lib/ros/core.rb', line 32 def partition_name @partition_name end |
#region ⇒ Object
Returns the value of attribute region
32 33 34 |
# File 'lib/ros/core.rb', line 32 def region @region end |
#resource ⇒ Object
Returns the value of attribute resource
32 33 34 |
# File 'lib/ros/core.rb', line 32 def resource @resource end |
#service_name ⇒ Object
Returns the value of attribute service_name
32 33 34 |
# File 'lib/ros/core.rb', line 32 def service_name @service_name end |
#txt ⇒ Object
Returns the value of attribute txt
32 33 34 |
# File 'lib/ros/core.rb', line 32 def txt @txt end |
Class Method Details
.from_jwt(token) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/ros/core.rb', line 35 def self.from_jwt(token) jwt = Jwt.decode(token) return unless urn_string = jwt[0]['urn'] urn_array = urn_string.split(':') new(*urn_array) rescue JWT::DecodeError end |
Instance Method Details
#instance ⇒ Object
48 |
# File 'lib/ros/core.rb', line 48 def instance; model.find_by_urn(resource_id) end |
#model ⇒ Object
47 |
# File 'lib/ros/core.rb', line 47 def model; model_name.constantize end |
#model_name ⇒ Object
46 |
# File 'lib/ros/core.rb', line 46 def model_name; resource_type.classify end |
#resource_id ⇒ Object
44 |
# File 'lib/ros/core.rb', line 44 def resource_id; resource.split('/').last end |
#resource_type ⇒ Object
43 |
# File 'lib/ros/core.rb', line 43 def resource_type; resource.split('/').first end |
#to_s ⇒ Object
33 |
# File 'lib/ros/core.rb', line 33 def to_s; to_a.join(':') end |