Class: Ragoon::Services
- Inherits:
-
Object
- Object
- Ragoon::Services
- Defined in:
- lib/ragoon/services.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Notification, Schedule
Constant Summary collapse
- SERVICE_LOCATIONS =
{ schedule: '/cbpapi/schedule/api?', notification: '/cbpapi/notification/api?', }.freeze
Instance Attribute Summary collapse
-
#action_type ⇒ Object
readonly
Returns the value of attribute action_type.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #endpoint ⇒ Object
-
#initialize ⇒ Services
constructor
A new instance of Services.
Constructor Details
#initialize ⇒ Services
Returns a new instance of Services.
9 10 11 12 |
# File 'lib/ragoon/services.rb', line 9 def initialize @action_type = self.class.name.split('::').pop.downcase.to_sym @client = Ragoon::Client.new(self.endpoint) end |
Instance Attribute Details
#action_type ⇒ Object (readonly)
Returns the value of attribute action_type.
7 8 9 |
# File 'lib/ragoon/services.rb', line 7 def action_type @action_type end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/ragoon/services.rb', line 7 def client @client end |
Class Method Details
.start_and_end(date = Date.today) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/ragoon/services.rb', line 19 def self.start_and_end(date = Date.today) { start: Time.local(date.year, date.month, date.day, 0).utc, end: Time.local(date.year, date.month, date.day + 1, 0).utc, } end |
Instance Method Details
#endpoint ⇒ Object
14 15 16 17 |
# File 'lib/ragoon/services.rb', line 14 def endpoint endpoint = URI(Ragoon.garoon_endpoint) "#{endpoint.scheme}://#{endpoint.host}#{endpoint.path}#{SERVICE_LOCATIONS[action_type]}" end |