class SyoboiCalendar::Client
Constants
- ENDPOINT_BASE_URL
- ENDPOINT_PATH
Public Instance Methods
connection()
click to toggle source
@return [Faraday::Connection]
# File lib/syoboi_calendar/client.rb, line 10 def connection @connection ||= ::Faraday::Connection.new(url: ENDPOINT_BASE_URL) do |connection| connection.response :xml connection.adapter :net_http end end
list_channel_groups(options = {})
click to toggle source
@param options [Hash] @return [SyoboiCalendar::Response]
# File lib/syoboi_calendar/client.rb, line 19 def list_channel_groups(options = {}) list( options: options, query_class: ::SyoboiCalendar::Queries::ListChannelGroupsQuery, response_class: ::SyoboiCalendar::Responses::ListChannelGroupsResponse, ) end
list_channels(options = {})
click to toggle source
@param options [Hash] @return [SyoboiCalendar::Response]
# File lib/syoboi_calendar/client.rb, line 29 def list_channels(options = {}) list( options: options, query_class: ::SyoboiCalendar::Queries::ListChannelsQuery, response_class: ::SyoboiCalendar::Responses::ListChannelsResponse, ) end
list_programs(options = {})
click to toggle source
@param options [Hash] @return [SyoboiCalendar::Response]
# File lib/syoboi_calendar/client.rb, line 39 def list_programs(options = {}) list( options: options, query_class: ::SyoboiCalendar::Queries::ListProgramsQuery, response_class: ::SyoboiCalendar::Responses::ListProgramsResponse, ) end
list_titles(options = {})
click to toggle source
@param options [Hash] @return [SyoboiCalendar::Response]
# File lib/syoboi_calendar/client.rb, line 49 def list_titles(options = {}) list( options: options, query_class: ::SyoboiCalendar::Queries::ListTitlesQuery, response_class: ::SyoboiCalendar::Responses::ListTitlesResponse, ) end
Private Instance Methods
get(query)
click to toggle source
@private @param query [Hash] @return [Faraday::Response]
# File lib/syoboi_calendar/client.rb, line 62 def get(query) connection.get(ENDPOINT_PATH, query) end
list(options:, query_class:, response_class:)
click to toggle source
@private @param options [Hash] @param query_class [Class] @param response_class [Class] @return [SyoboiCalendar::Responses::ListBaseResponse]
# File lib/syoboi_calendar/client.rb, line 71 def list(options:, query_class:, response_class:) query = query_class.new(options) faraday_response = get(query.to_hash) response_class.new(faraday_response) end