Class: DoorkeeperJp::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(access_token = nil) ⇒ Client

Returns a new instance of Client.

Parameters:

  • access_token (String) (defaults to: nil)


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

def initialize(access_token = nil)
  @access_token = access_token
end

Instance Method Details

#event(id, is_expand_group: false, locale: nil) ⇒ DoorkeeperJp::Response

Show a specific event

Parameters:

  • id (Integer)
  • is_expand_group (Boolean) (defaults to: false)

    Expands the group object.

  • locale (String) (defaults to: nil)

    The localized text for an event. One of en, ja. Default: ja.

Returns:

See Also:



81
82
83
84
85
86
87
88
89
90
# File 'lib/doorkeeper_jp/client.rb', line 81

def event(id, is_expand_group: false, locale: nil)
  params = {
    locale: locale,
  }.compact

  params["expand[]"] = "group" if is_expand_group

  res = connection.get("events/#{id}", params).body
  res.event
end

#events(page: nil, locale: nil, sort: nil, since_date: nil, until_date: nil, keyword: nil, prefecture: nil, is_expand_group: false) ⇒ Array<DoorkeeperJp::Response>

List all featured events

Parameters:

  • page (Integer) (defaults to: nil)

    The page offset of the results.

  • locale (String) (defaults to: nil)

    The localized text for an event. One of en, ja. Default: ja.

  • sort (String) (defaults to: nil)

    The order of the results. One of published_at, starts_at, updated_at. Default: published_at.

  • since_date (Date) (defaults to: nil)

    Only events taking place during or after this date will be included. Default: Today.

  • until_date (Date) (defaults to: nil)

    Only events taking place during or before this date will be included.

  • keyword (String) (defaults to: nil)

    Keyword to search for from the title or description fields.

  • prefecture (String) (defaults to: nil)

    Only events with an address in prefecture.

  • is_expand_group (Boolean) (defaults to: false)

    Expands the group object.

Returns:

See Also:



24
25
26
27
28
29
30
# File 'lib/doorkeeper_jp/client.rb', line 24

def events(page: nil, locale: nil, sort: nil, since_date: nil, until_date: nil, keyword: nil, prefecture: nil, is_expand_group: false)
  get_events(
    path: "events",
    page: page, locale: locale, sort: sort, since_date: since_date, until_date: until_date,
    keyword: keyword, prefecture: prefecture, is_expand_group: is_expand_group,
  )
end

#group(group, locale: nil) ⇒ DoorkeeperJp::Response

Show a specific group

Parameters:

  • group (String)
  • locale (String) (defaults to: nil)

    The localized text for an event. One of en, ja. Default: ja.

Returns:

See Also:



63
64
65
66
67
68
69
70
# File 'lib/doorkeeper_jp/client.rb', line 63

def group(group, locale: nil)
  params = {
    locale: locale,
  }.compact

  res = connection.get("groups/#{group}", params).body
  res.group
end

#group_events(group, page: nil, locale: nil, sort: nil, since_date: nil, until_date: nil, keyword: nil, prefecture: nil, is_expand_group: false) ⇒ Array<DoorkeeperJp::Response>

List a community’s events

Parameters:

  • group (String)
  • page (Integer) (defaults to: nil)

    The page offset of the results.

  • locale (String) (defaults to: nil)

    The localized text for an event. One of en, ja. Default: ja.

  • sort (String) (defaults to: nil)

    The order of the results. One of published_at, starts_at, updated_at. Default: published_at.

  • since_date (Date) (defaults to: nil)

    Only events taking place during or after this date will be included. Default: Today.

  • until_date (Date) (defaults to: nil)

    Only events taking place during or before this date will be included.

  • keyword (String) (defaults to: nil)

    Keyword to search for from the title or description fields.

  • prefecture (String) (defaults to: nil)

    Only events with an address in prefecture.

  • is_expand_group (Boolean) (defaults to: false)

    Expands the group object.

Returns:

See Also:



47
48
49
50
51
52
53
# File 'lib/doorkeeper_jp/client.rb', line 47

def group_events(group, page: nil, locale: nil, sort: nil, since_date: nil, until_date: nil, keyword: nil, prefecture: nil, is_expand_group: false)
  get_events(
    path: "groups/#{group}/events",
    page: page, locale: locale, sort: sort, since_date: since_date, until_date: until_date,
    keyword: keyword, prefecture: prefecture, is_expand_group: is_expand_group,
  )
end