Class: V2Intuity::Endpoints::Stream

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/v2_intuity/endpoints/stream.rb

Constant Summary

Constants inherited from Endpoint

Endpoint::ENDPOINTS

Instance Attribute Summary

Attributes inherited from Endpoint

#base_uri, #endpoint, #id, #org_id, #path, #token

Instance Method Summary collapse

Methods inherited from Endpoint

#sign_with

Constructor Details

#initialize(options = {}) ⇒ Stream

Returns a new instance of Stream.



4
5
6
7
8
9
10
# File 'lib/v2_intuity/endpoints/stream.rb', line 4

def initialize(options = {})
  super
  @org_id = nil
  @path = nil
  @base_uri = options[:stream_uri]
  @endpoint = Endpoint::ENDPOINTS[:streams]
end

Instance Method Details

#uri(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/v2_intuity/endpoints/stream.rb', line 12

def uri(options = {})
  uri_options(options)
  if @id.nil?
    "#{@base_uri}/#{@endpoint}"
  else
    "#{@base_uri}/#{@endpoint}/#{@id}"
  end
end

#uri_options(options = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/v2_intuity/endpoints/stream.rb', line 21

def uri_options(options = {})

  @base_uri ||= options[:base_uri]
  @id ||= options[:id]

  raise 'base_uri is needed' unless @base_uri
end