Class: BungieClient::Service
- Inherits:
-
Object
- Object
- BungieClient::Service
- Defined in:
- lib/bungie_client/service.rb
Overview
Simple class for service structure
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.services ⇒ Hash
Get list of services.
Instance Method Summary collapse
-
#initialize(name) ⇒ Service
constructor
Initialize service by name with snake case style.
Constructor Details
#initialize(name) ⇒ Service
Initialize service by name with snake case style
21 22 23 24 25 26 27 28 29 |
# File 'lib/bungie_client/service.rb', line 21 def initialize(name) service = self.class.services[name] raise 'Undefined service' if service.nil? @type = service[:method] @name = service[:name] @endpoint = service[:endpoint] end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/bungie_client/service.rb', line 3 def endpoint @endpoint end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/bungie_client/service.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/bungie_client/service.rb', line 3 def type @type end |
Class Method Details
.services ⇒ Hash
Get list of services
10 11 12 13 14 |
# File 'lib/bungie_client/service.rb', line 10 def self.services return @services unless @services.nil? @services = YAML.load_file "#{File.dirname(__FILE__)}/services.yml" || {} end |