Class: DevOrbit::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Client

Returns a new instance of Client.



37
38
39
40
41
42
43
44
# File 'lib/dev_orbit/client.rb', line 37

def initialize(params = {})
  @orbit_api_key = params.fetch(:orbit_api_key, ENV["ORBIT_API_KEY"])
  @orbit_workspace = params.fetch(:orbit_workspace, ENV["ORBIT_WORKSPACE_ID"])
  @dev_api_key = params.fetch(:dev_api_key, ENV["DEV_API_KEY"])
  @dev_username = params.fetch(:dev_username, ENV["DEV_USERNAME"])
  @dev_organization = params.fetch(:dev_organization, ENV["DEV_ORGANIZATION"])
  @historical_import = params.fetch(:historical_import, false)
end

Instance Attribute Details

#dev_api_keyObject

Returns the value of attribute dev_api_key.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def dev_api_key
  @dev_api_key
end

#dev_organizationObject

Returns the value of attribute dev_organization.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def dev_organization
  @dev_organization
end

#dev_usernameObject

Returns the value of attribute dev_username.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def dev_username
  @dev_username
end

#historical_importObject

Returns the value of attribute historical_import.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def historical_import
  @historical_import
end

#orbit_api_keyObject

Returns the value of attribute orbit_api_key.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def orbit_api_key
  @orbit_api_key
end

#orbit_workspaceObject

Returns the value of attribute orbit_workspace.



35
36
37
# File 'lib/dev_orbit/client.rb', line 35

def orbit_workspace
  @orbit_workspace
end

Instance Method Details

#comments(type: "user") ⇒ Object

Fetch new comments from DEV and post them to the Orbit workspace



47
48
49
50
51
52
53
54
55
# File 'lib/dev_orbit/client.rb', line 47

def comments(type: "user")
  DevOrbit::Dev.new(
    api_key: @dev_api_key,
    username: @dev_username,
    workspace_id: @orbit_workspace,
    orbit_api_key: @orbit_api_key,
    historical_import: @historical_import
  ).process_comments(type: type)
end

#followersObject



57
58
59
60
61
62
63
64
# File 'lib/dev_orbit/client.rb', line 57

def followers
  DevOrbit::Dev.new(
    api_key: @dev_api_key,
    username: @dev_username,
    workspace_id: @orbit_workspace,
    orbit_api_key: @orbit_api_key
  ).process_followers
end

#orbitObject



75
76
77
# File 'lib/dev_orbit/client.rb', line 75

def orbit
  DevOrbit::Orbit.new
end

#organization_comments(type: "organization") ⇒ Object



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

def organization_comments(type: "organization")
  DevOrbit::Dev.new(
    api_key: @dev_api_key,
    organization: @dev_organization,
    workspace_id: @orbit_workspace,
    orbit_api_key: @orbit_api_key
  ).process_comments(type: type)
end