Class: QiitaExport::Fetcher::ApiEndPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/qiita-export/fetcher/api_end_point.rb

Constant Summary collapse

MAX_PER_PAGE =
100

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ ApiEndPoint

Returns a new instance of ApiEndPoint.



8
9
10
# File 'lib/qiita-export/fetcher/api_end_point.rb', line 8

def initialize
  @config = ::QiitaExport::Config
end

Class Method Details

.instance(end_point_sym) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/qiita-export/fetcher/api_end_point.rb', line 16

def self.instance(end_point_sym)
  case end_point_sym
  when :item
    ItemEndPoint.new
  when :comment
    CommentEndPoint.new
  when :user
    UserEndPoint.new
  when :team
    TeamEndPoint.new
  else
    raise ArgumentError("unsupported endpont: #{end_point_sym}")
  end
end

Instance Method Details

#url(article_url: nil, page: 1) ⇒ Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/qiita-export/fetcher/api_end_point.rb', line 12

def url(article_url: nil, page: 1)
  raise NotImplementedError.new("You must implement #{self.class}##{__method__}")
end