Sha256: ad8f4ff87f1eaa73a079babade48dbf8629f0556f26d6cc62c2ba01fdc454ba2

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

class Ragoon::Services
  SERVICE_LOCATIONS = {
    schedule:     '/cbpapi/schedule/api?',
    notification: '/cbpapi/notification/api?',
  }.freeze

  attr_reader :client, :action_type

  def initialize
    @action_type = self.class.name.split('::').pop.downcase.to_sym
    @client = Ragoon::Client.new(self.endpoint)
  end

  def endpoint
    endpoint = URI(Ragoon.garoon_endpoint)
    "#{endpoint.scheme}://#{endpoint.host}#{endpoint.path}#{SERVICE_LOCATIONS[action_type]}"
  end

  def self.start_and_end(date = Date.today)
    {
      start: date.to_time.utc,
      end:   ((date + 1).to_time - 1).utc,
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ragoon-0.5.2 lib/ragoon/services.rb
ragoon-0.5.1 lib/ragoon/services.rb