Class: BungieClient::Service
- Inherits:
-
Object
- Object
- BungieClient::Service
- Defined in:
- lib/bungie_client/service.rb
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
24 25 26 27 28 29 30 31 32 |
# File 'lib/bungie_client/service.rb', line 24 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.
6 7 8 |
# File 'lib/bungie_client/service.rb', line 6 def endpoint @endpoint end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/bungie_client/service.rb', line 6 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/bungie_client/service.rb', line 6 def type @type end |
Class Method Details
.services ⇒ Hash
Get list of services
13 14 15 16 17 |
# File 'lib/bungie_client/service.rb', line 13 def self.services return @services unless @services.nil? @services = YAML.load_file "#{File.dirname(__FILE__)}/services.yml" || {} end |