Class: DownloadSolutions::Api::Reddit::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/download_solutions/api/reddit/params.rb

Overview

A parameter object that is passed into each step within Reddit#get_comments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year:, day:, languages:, connection:) ⇒ Params

Returns a new instance of Params.

Parameters:

  • year (Integer)
  • day (Integer)
  • languages (Array<String>)

    e.g. [“ruby”]



12
13
14
15
16
17
18
19
# File 'lib/download_solutions/api/reddit/params.rb', line 12

def initialize(year:, day:, languages:, connection:)
  @year = year
  @day = day
  @languages = languages
  @connection = connection
  @megathread_path = build_megathread_path(year:, day:)
  @thread_id = "t3_#{megathread_id(year:, day:)}"
end

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



7
8
9
# File 'lib/download_solutions/api/reddit/params.rb', line 7

def comments
  @comments
end

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def connection
  @connection
end

#dayObject (readonly)

Returns the value of attribute day.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def day
  @day
end

#initial_responseObject

Returns the value of attribute initial_response.



7
8
9
# File 'lib/download_solutions/api/reddit/params.rb', line 7

def initial_response
  @initial_response
end

#languagesObject (readonly)

Returns the value of attribute languages.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def languages
  @languages
end

#megathread_pathObject (readonly)

Returns the value of attribute megathread_path.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def megathread_path
  @megathread_path
end

#more_childrensObject

Returns the value of attribute more_childrens.



7
8
9
# File 'lib/download_solutions/api/reddit/params.rb', line 7

def more_childrens
  @more_childrens
end

#original_commentsObject

Returns the value of attribute original_comments.



7
8
9
# File 'lib/download_solutions/api/reddit/params.rb', line 7

def original_comments
  @original_comments
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def thread_id
  @thread_id
end

#yearObject (readonly)

Returns the value of attribute year.



6
7
8
# File 'lib/download_solutions/api/reddit/params.rb', line 6

def year
  @year
end