Class: FBomb::Flowdock

Inherits:
Object
  • Object
show all
Defined in:
lib/fbomb/flowdock.rb

Defined Under Namespace

Modules: Cache Classes: Flow, Object, Organization, Token, User

Instance Method Summary collapse

Constructor Details

#initialize(organization, flow, token, options = {}) ⇒ Flowdock

Returns a new instance of Flowdock.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fbomb/flowdock.rb', line 10

def initialize(organization, flow, token, options = {})
  raise ArgumentError.new('no organization') if organization.to_s.strip.empty?
  raise ArgumentError.new('no flow') if flow.to_s.strip.empty?
  raise ArgumentError.new('no token') if token.to_s.strip.empty?

  @organization = Organization.new(organization, self)
  @flow = Flow.new(flow, self)
  @token = String.new(token)

  @options = Map.for(options)
  @client_options = Map.for(@options.get(:client))

  unless @client_options.has_key?(:token)
    unless @token.empty?
      @client_options[:api_token] ||= @token
    end
  end

  @client = ::Flowdock::Flow.new(@client_options)
end