Class: MediumExport::Publisher
- Inherits:
-
Object
- Object
- MediumExport::Publisher
- Defined in:
- lib/middleman-medium_export/publisher.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
readonly
Returns the value of attribute api_client.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content:, shell:, api_client:) ⇒ Publisher
constructor
A new instance of Publisher.
Constructor Details
#initialize(content:, shell:, api_client:) ⇒ Publisher
Returns a new instance of Publisher.
4 5 6 7 8 |
# File 'lib/middleman-medium_export/publisher.rb', line 4 def initialize(content:, shell:, api_client:) @content = content @shell = shell @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object (readonly)
Returns the value of attribute api_client.
2 3 4 |
# File 'lib/middleman-medium_export/publisher.rb', line 2 def api_client @api_client end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
2 3 4 |
# File 'lib/middleman-medium_export/publisher.rb', line 2 def content @content end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
2 3 4 |
# File 'lib/middleman-medium_export/publisher.rb', line 2 def shell @shell end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/middleman-medium_export/publisher.rb', line 10 def call shell.say("Preparing to publish #{content.size} articles") if content.size > 1 content.each do |article| publish(article) shell.say(%Q(Published: "#{article.title}"), :green) end end |