Class: BungieClient::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/bungie_client/service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Service

Initialize service by name with snake case style

Examples:

service =

Parameters:



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

#endpointObject (readonly)

Returns the value of attribute endpoint.



6
7
8
# File 'lib/bungie_client/service.rb', line 6

def endpoint
  @endpoint
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/bungie_client/service.rb', line 6

def name
  @name
end

#typeObject (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

.servicesHash

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