Class: Rdmm::Client

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

Constant Summary collapse

BASE_URL =
"https://api.dmm.com"
PATH_TO_LIST_ACTRESSES =
"/affiliate/v3/ActressSearch"
PATH_TO_LIST_AUTHORS =
"/affiliate/v3/AuthorSearch"
PATH_TO_LIST_FLOORS =
"/affiliate/v3/FloorList"
PATH_TO_LIST_GENRES =
"/affiliate/v3/GenreSearch"
PATH_TO_LIST_ITEMS =
"/affiliate/v3/ItemList"
PATH_TO_LIST_MAKERS =
"/affiliate/v3/MakerSearch"
PATH_TO_LIST_SERIES =
"/affiliate/v3/SeriesSearch"

Instance Method Summary collapse

Constructor Details

#initialize(affiliate_id:, api_id:) ⇒ Client

Returns a new instance of Client.

Parameters:

  • affiliate_id (String)
  • api_id (String)


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

def initialize(affiliate_id:, api_id:)
  @affiliate_id = affiliate_id
  @api_id = api_id
end

Instance Method Details

#connectionFaraday::Connection

Returns:

  • (Faraday::Connection)


23
24
25
26
27
28
# File 'lib/rdmm/client.rb', line 23

def connection
  @connection ||= ::Faraday::Connection.new(url: BASE_URL) do |connection|
    connection.adapter :net_http
    connection.response :json
  end
end

#list_actresses(options = {}) ⇒ Rdmm::Responses::ListActressesResponse

Parameters:

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

Returns:



32
33
34
35
36
37
38
39
# File 'lib/rdmm/client.rb', line 32

def list_actresses(options = {})
  list(
    query_class: ::Rdmm::Queries::ListActressesQuery,
    options: options,
    path: PATH_TO_LIST_ACTRESSES,
    response_class: ::Rdmm::Responses::ListActressesResponse,
  )
end

#list_authors(options = {}) ⇒ Rdmm::Responses::ListAuthorsResponse

Parameters:

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

Returns:



43
44
45
46
47
48
49
50
# File 'lib/rdmm/client.rb', line 43

def list_authors(options = {})
  list(
    query_class: ::Rdmm::Queries::ListAuthorsQuery,
    options: options,
    path: PATH_TO_LIST_AUTHORS,
    response_class: ::Rdmm::Responses::ListAuthorsResponse,
  )
end

#list_floors(options = {}) ⇒ Rdmm::Responses::ListFloorsResponse

Parameters:

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

Returns:



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

def list_floors(options = {})
  list(
    query_class: ::Rdmm::Queries::ListFloorsQuery,
    options: options,
    path: PATH_TO_LIST_FLOORS,
    response_class: ::Rdmm::Responses::ListFloorsResponse,
  )
end

#list_genres(options = {}) ⇒ Rdmm::Responses::ListGenresResponse

Parameters:

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

Returns:



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

def list_genres(options = {})
  list(
    query_class: ::Rdmm::Queries::ListGenresQuery,
    options: options,
    path: PATH_TO_LIST_GENRES,
    response_class: ::Rdmm::Responses::ListGenresResponse,
  )
end

#list_items(options = {}) ⇒ Rdmm::Responses::ListItemsResponse

Parameters:

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

Returns:



76
77
78
79
80
81
82
83
# File 'lib/rdmm/client.rb', line 76

def list_items(options = {})
  list(
    query_class: ::Rdmm::Queries::ListItemsQuery,
    options: options,
    path: PATH_TO_LIST_ITEMS,
    response_class: ::Rdmm::Responses::ListItemsResponse,
  )
end

#list_makers(options = {}) ⇒ Rdmm::Responses::ListMakersResponse

Parameters:

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

Returns:



87
88
89
90
91
92
93
94
# File 'lib/rdmm/client.rb', line 87

def list_makers(options = {})
  list(
    query_class: ::Rdmm::Queries::ListMakersQuery,
    options: options,
    path: PATH_TO_LIST_MAKERS,
    response_class: ::Rdmm::Responses::ListMakersResponse,
  )
end

#list_series(options = {}) ⇒ Rdmm::Responses::ListSeriesResponse

Parameters:

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

Returns:



98
99
100
101
102
103
104
105
# File 'lib/rdmm/client.rb', line 98

def list_series(options = {})
  list(
    query_class: ::Rdmm::Queries::ListSeriesQuery,
    options: options,
    path: PATH_TO_LIST_SERIES,
    response_class: ::Rdmm::Responses::ListSeriesResponse,
  )
end