Class: IsbmAdaptor::Channel
- Inherits:
-
Object
- Object
- IsbmAdaptor::Channel
- Defined in:
- lib/isbm_adaptor/channel.rb
Constant Summary collapse
- TYPES =
Channel types permitted by the ISBM specification
['Publication', 'Request']
Instance Attribute Summary collapse
-
#description ⇒ String
The channel description.
-
#type ⇒ String
The channel type, either ‘Publication’ or ‘Request’.
-
#uri ⇒ String
The channel URI.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates a new Channel based on a hash.
Instance Method Summary collapse
-
#initialize(uri, type, description) ⇒ Channel
constructor
Creates a new Channel.
Constructor Details
#initialize(uri, type, description) ⇒ Channel
Creates a new Channel.
20 21 22 23 24 |
# File 'lib/isbm_adaptor/channel.rb', line 20 def initialize(uri, type, description) @uri = uri.to_s @type = type @description = description.to_s unless description.nil? end |
Instance Attribute Details
#description ⇒ String
Returns the channel description.
13 14 15 |
# File 'lib/isbm_adaptor/channel.rb', line 13 def description @description end |
#type ⇒ String
Returns the channel type, either ‘Publication’ or ‘Request’.
10 11 12 |
# File 'lib/isbm_adaptor/channel.rb', line 10 def type @type end |
#uri ⇒ String
Returns the channel URI.
7 8 9 |
# File 'lib/isbm_adaptor/channel.rb', line 7 def uri @uri end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates a new Channel based on a hash.
31 32 33 34 35 36 |
# File 'lib/isbm_adaptor/channel.rb', line 31 def self.from_hash(hash) uri = hash[:channel_uri] type = hash[:channel_type] description = hash[:channel_description] new(uri, type, description) end |