Class: ConnpassApiV2::Client

Inherits:
Object
  • Object
show all
Includes:
EventMethods, GroupMethods, UserMethods
Defined in:
lib/connpass_api_v2/client.rb,
lib/connpass_api_v2/client/user_methods.rb,
lib/connpass_api_v2/client/event_methods.rb,
lib/connpass_api_v2/client/group_methods.rb

Overview

connpass API client

Defined Under Namespace

Modules: EventMethods, GroupMethods, UserMethods

Constant Summary collapse

API_ENDPOINT =
"https://connpass.com/api/v2"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from UserMethods

#get_user_attended_events, #get_user_groups, #get_user_presenter_events, #get_users

Methods included from GroupMethods

#get_groups

Methods included from EventMethods

#get_event_presentations, #get_events

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.

Parameters:

  • api_key (String)


17
18
19
# File 'lib/connpass_api_v2/client.rb', line 17

def initialize(api_key)
  @api_key = api_key
end

Class Method Details

.joined_param(param) ⇒ String?

Parameters:

  • param (Object)

Returns:

  • (String, nil)


30
31
32
33
34
# File 'lib/connpass_api_v2/client.rb', line 30

def self.joined_param(param)
  return nil unless param

  Array(param).join(",")
end

.to_order_num(order) ⇒ Integer?

Parameters:

  • order (Integer, Symbol, nil)

Returns:

  • (Integer, nil)


65
66
67
68
69
70
71
72
73
# File 'lib/connpass_api_v2/client.rb', line 65

def self.to_order_num(order)
  order_to_num = {
    updated_at: 1,
    started_at: 2,
    newest:     3,
  }

  order_to_num[order] || order # steep:ignore
end

.to_ym(param) ⇒ String?

Convert to yyyymm formatted string

Parameters:

  • param (String, Date, nil)

Returns:

  • (String, nil)


54
55
56
57
58
59
60
# File 'lib/connpass_api_v2/client.rb', line 54

def self.to_ym(param)
  return nil unless param

  return param.strftime("%Y%m") if param.is_a?(Date)

  param
end

.to_ymd(param) ⇒ String?

Convert to yyyymmdd formatted string

Parameters:

  • param (String, Date, nil)

Returns:

  • (String, nil)


41
42
43
44
45
46
47
# File 'lib/connpass_api_v2/client.rb', line 41

def self.to_ymd(param)
  return nil unless param

  return param.strftime("%Y%m%d") if param.is_a?(Date)

  param
end

Instance Method Details

#inspectString

Returns:

  • (String)


22
23
24
25
# File 'lib/connpass_api_v2/client.rb', line 22

def inspect
  # NOTE: hide @api_key
  %Q(#<ConnpassApiV2::Client:0x#{"%016X" % object_id} @api_key="*****************">)
end