class FBomb::Flowdock

Public Class Methods

new(organization, flow, token, options = {}) click to toggle source
# 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