Class: DevOrbit::Dev
- Inherits:
-
Object
- Object
- DevOrbit::Dev
- Defined in:
- lib/dev_orbit/dev.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Dev
constructor
A new instance of Dev.
- #process_comments(type:) ⇒ Object
- #process_followers ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Dev
Returns a new instance of Dev.
10 11 12 13 14 15 16 17 |
# File 'lib/dev_orbit/dev.rb', line 10 def initialize(params = {}) @username = params.fetch(:username, ENV["DEV_USERNAME"]) @organization = params.fetch(:organization, ENV["DEV_ORGANIZATION"]) @api_key = params.fetch(:api_key, ENV["DEV_API_KEY"]) @workspace_id = params.fetch(:workspace_id, ENV["ORBIT_WORKSPACE_ID"]) @orbit_api_key = params.fetch(:orbit_api_key, ENV["ORBIT_API_KEY"]) @historical_import = params.fetch(:historical_import, false) end |
Instance Method Details
#process_comments(type:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dev_orbit/dev.rb', line 19 def process_comments(type:) articles = get_articles(type: type) return if articles.empty? || articles.nil? articles.each do |article| comments = get_article_comments(article["id"]) next if comments.nil? || comments.empty? return DevOrbit::Orbit.new( type: "comments", data: { comments: comments, title: article["title"], url: article["url"] }, workspace_id: @workspace_id, api_key: @orbit_api_key, historical_import: @historical_import ).call end end |
#process_followers ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dev_orbit/dev.rb', line 43 def process_followers followers = get_followers return if followers.empty? || followers.nil? DevOrbit::Orbit.new( type: "followers", data: { followers: followers }, workspace_id: @workspace_id, api_key: @orbit_api_key, historical_import: @historical_import, last_orbit_member_timestamp: ).call end |