Class: MassdebatorApi::Service
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- MassdebatorApi::Service
- Defined in:
- lib/massdebator_api/service.rb
Direct Known Subclasses
Class Method Summary collapse
- .base_path ⇒ Object
- .base_uri ⇒ Object
- .configuration_hash ⇒ Object
-
.headers ⇒ Object
If headers are not defined in a given subclass, then obtain headers from the superclass.
- .host ⇒ Object
- .port ⇒ Object
- .secret ⇒ Object
- .token ⇒ Object
Class Method Details
.base_path ⇒ Object
5 6 7 |
# File 'lib/massdebator_api/service.rb', line 5 def self.base_path "/api/v1" end |
.base_uri ⇒ Object
9 10 11 |
# File 'lib/massdebator_api/service.rb', line 9 def self.base_uri "http://#{self.host}#{self.base_path}" end |
.configuration_hash ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/massdebator_api/service.rb', line 13 def self.configuration_hash if Rails.root @@config_hash ||= YAML.load_file("#{Rails.root}/config/massdebator.yml") else @@config_hash ||= YAML.load_file("config/massdebator.yml") end end |
.headers ⇒ Object
If headers are not defined in a given subclass, then obtain headers from the superclass.
45 46 47 48 49 50 51 |
# File 'lib/massdebator_api/service.rb', line 45 def headers if defined?(@headers) @headers elsif superclass != Object && superclass.headers superclass.headers end end |
.host ⇒ Object
21 22 23 |
# File 'lib/massdebator_api/service.rb', line 21 def self.host self.configuration_hash[Rails.env]['host'] end |
.port ⇒ Object
33 34 35 |
# File 'lib/massdebator_api/service.rb', line 33 def self.port self.configuration_hash[Rails.env]['port'] end |
.secret ⇒ Object
29 30 31 |
# File 'lib/massdebator_api/service.rb', line 29 def self.secret self.configuration_hash[Rails.env]['secret'] end |
.token ⇒ Object
25 26 27 |
# File 'lib/massdebator_api/service.rb', line 25 def self.token self.configuration_hash[Rails.env]['token'] end |