Class: HatenaGroup::Calendar::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/hatenagroup/calendar/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(group, hatena_user_id, hatena_password) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
# File 'lib/hatenagroup/calendar/client.rb', line 9

def initialize(group, hatena_user_id, hatena_password)
  @group = group
  @agent = ::Mechanize.new
  agent.log = ::Logger.new(STDERR)
  agent.log.level = ::Logger::INFO
  agent.user_agent = USER_AGENT
  login! hatena_user_id, hatena_password
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



6
7
8
# File 'lib/hatenagroup/calendar/client.rb', line 6

def agent
  @agent
end

#groupObject (readonly)

Returns the value of attribute group.



7
8
9
# File 'lib/hatenagroup/calendar/client.rb', line 7

def group
  @group
end

Instance Method Details

#day(d) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/hatenagroup/calendar/client.rb', line 18

def day(d)
  if d.instance_of?(Date)
    Keyword.new self, d.strftime("%Y-%m-%d")
  else
    Keyword.new self, d
  end
end