Sha256: 23ac123ccf0e29e8ea4d3e5893511cc1b0f9da53cb2ef96a5e157ac3458e0a9b

Contents?: true

Size: 687 Bytes

Versions: 8

Compression:

Stored size: 687 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: Time.local(date.year, date.month, date.day,     0).utc,
      end:   Time.local(date.year, date.month, date.day + 1, 0).utc,
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ragoon-0.4.2 lib/ragoon/services.rb
ragoon-0.4.1 lib/ragoon/services.rb
ragoon-0.4.0 lib/ragoon/services.rb
ragoon-0.3.1 lib/ragoon/services.rb
ragoon-0.3.0 lib/ragoon/services.rb
ragoon-0.2.2 lib/ragoon/services.rb
ragoon-0.2.1 lib/ragoon/services.rb
ragoon-0.2.0 lib/ragoon/services.rb