Class: KintoneNotifier::Bot

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

Overview

configuration (required)

url       : includes ".cybozu.com"
user      : kintone user name
password  : kintone user password
app_id    : kintone application id

examples #in your config/initializers/

KintoneNotifier::Bot.config = {
  :url => "xxxxx.cybozu.com",
  :user  => "your-user-name",
  :password => "your-password",
  :app_id => 1
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Bot

Returns a new instance of Bot.

Raises:

  • (ArgumentError)


35
36
37
38
39
# File 'lib/kintone_notifier.rb', line 35

def initialize(options={})
  raise ArgumentError, "invalid argument. class configuration haven't been given." if @@config.blank?
  @options = default_options.reverse_merge(default_options)
  @api =  Kintone::Api.new(@options["url"],@options["user"],@options["password"])
end

Class Method Details

.config=(h) ⇒ Object



44
45
46
# File 'lib/kintone_notifier.rb', line 44

def self.config=(h)
  @@config = h
end

Instance Method Details

#tweet(values = {}) ⇒ Object



40
41
42
# File 'lib/kintone_notifier.rb', line 40

def tweet(values={})
  @api.record.create(@options["app_id"],convert_hash(values.reverse_merge(default_values)))
end