Class: SyoboiCalendar::Client

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

Constant Summary collapse

ENDPOINT_BASE_URL =
"http://cal.syoboi.jp"
ENDPOINT_PATH =
"/db.php"

Instance Method Summary collapse

Instance Method Details

#connectionFaraday::Connection

Returns:

  • (Faraday::Connection)


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

def connection
  @connection ||= ::Faraday::Connection.new(url: ENDPOINT_BASE_URL) do |connection|
    connection.adapter :net_http
    connection.response :xml
    connection.response :raise_error
  end
end

#list_channel_groups(options = {}) ⇒ SyoboiCalendar::Response

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (SyoboiCalendar::Response)


20
21
22
23
24
25
26
# File 'lib/syoboi_calendar/client.rb', line 20

def list_channel_groups(options = {})
  list(
    options: options,
    query_class: ::SyoboiCalendar::Queries::ListChannelGroupsQuery,
    response_class: ::SyoboiCalendar::Responses::ListChannelGroupsResponse,
  )
end

#list_channels(options = {}) ⇒ SyoboiCalendar::Response

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (SyoboiCalendar::Response)


30
31
32
33
34
35
36
# File 'lib/syoboi_calendar/client.rb', line 30

def list_channels(options = {})
  list(
    options: options,
    query_class: ::SyoboiCalendar::Queries::ListChannelsQuery,
    response_class: ::SyoboiCalendar::Responses::ListChannelsResponse,
  )
end

#list_programs(options = {}) ⇒ SyoboiCalendar::Response

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (SyoboiCalendar::Response)


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

def list_programs(options = {})
  list(
    options: options,
    query_class: ::SyoboiCalendar::Queries::ListProgramsQuery,
    response_class: ::SyoboiCalendar::Responses::ListProgramsResponse,
  )
end

#list_titles(options = {}) ⇒ SyoboiCalendar::Response

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (SyoboiCalendar::Response)


50
51
52
53
54
55
56
# File 'lib/syoboi_calendar/client.rb', line 50

def list_titles(options = {})
  list(
    options: options,
    query_class: ::SyoboiCalendar::Queries::ListTitlesQuery,
    response_class: ::SyoboiCalendar::Responses::ListTitlesResponse,
  )
end