Class: Panoptes::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Cellect, Classifications, Collections, Comments, Discussions, Me, ProjectPreferences, Projects, SubjectSets, Subjects, UserGroups, Users, Workflows
Defined in:
lib/panoptes/client.rb,
lib/panoptes/client/me.rb,
lib/panoptes/client/users.rb,
lib/panoptes/client/cellect.rb,
lib/panoptes/client/version.rb,
lib/panoptes/client/comments.rb,
lib/panoptes/client/projects.rb,
lib/panoptes/client/subjects.rb,
lib/panoptes/client/workflows.rb,
lib/panoptes/client/collections.rb,
lib/panoptes/client/discussions.rb,
lib/panoptes/client/user_groups.rb,
lib/panoptes/client/subject_sets.rb,
lib/panoptes/client/authentication.rb,
lib/panoptes/client/classifications.rb,
lib/panoptes/client/project_preferences.rb

Direct Known Subclasses

TalkClient

Defined Under Namespace

Modules: Authentication, Cellect, Classifications, Collections, Comments, Discussions, Me, ProjectPreferences, Projects, SubjectSets, Subjects, UserGroups, Users, Workflows Classes: AuthenticationExpired, ConnectionFailed, GenericError, NotLoggedIn, ResourceNotFound, ServerError

Constant Summary collapse

VERSION =
'1.2.1'

Instance Attribute Summary collapse

Attributes included from Authentication

#payload

Instance Method Summary collapse

Methods included from Cellect

#cellect_subjects, #cellect_workflows

Methods included from Discussions

#discussions

Methods included from Comments

#create_comment

Methods included from Workflows

#add_subject_set_to_workflow, #create_workflow, #workflow

Methods included from UserGroups

#create_user_group, #delete_user_group, #join_user_group, #remove_user_from_user_group, #user_groups

Methods included from Users

#user

Methods included from SubjectSets

#add_subjects_to_subject_set, #create_subject_set, #subject_set, #update_subject_set

Methods included from Subjects

#retire_subject, #subject, #subjects

Methods included from ProjectPreferences

#project_preferences, #promote_user_to_workflow, #set_user_workflow, #user_project_preferences

Methods included from Projects

#create_aggregations_export, #create_classifications_export, #create_subjects_export, #create_workflow_contents_export, #create_workflows_export, #project, #projects

Methods included from Collections

#add_subjects_to_collection, #collection

Methods included from Classifications

#get_subject_classifications, #get_user_classifications

Methods included from Authentication

#authenticated?, #authenticated_admin?, #authenticated_user_display_name, #authenticated_user_id, #authenticated_user_login, #jwt_payload, #token_contents, #token_expiry

Methods included from Me

#me

Constructor Details

#initialize(env: :production, auth: {}, public_key_path: nil, params: {}) ⇒ Client

Returns a new instance of Client.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/panoptes/client.rb', line 54

def initialize(env: :production, auth: {}, public_key_path: nil, params: {})
  @env = env
  @auth = auth
  @public_key_path = public_key_path || public_key_for_env(env)
  @panoptes = Panoptes::Endpoints::JsonApiEndpoint.new(
    auth: auth, url: panoptes_url, prefix: '/api', params: params
  )
  @talk = Panoptes::Endpoints::JsonApiEndpoint.new(
    auth: auth, url: talk_url, params: params
  )
  @cellect = Panoptes::Endpoints::JsonEndpoint.new(
    url: panoptes_url, prefix: '/cellect'
  )
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



52
53
54
# File 'lib/panoptes/client.rb', line 52

def auth
  @auth
end

#cellectObject (readonly)

Returns the value of attribute cellect.



52
53
54
# File 'lib/panoptes/client.rb', line 52

def cellect
  @cellect
end

#envObject (readonly)

Returns the value of attribute env.



52
53
54
# File 'lib/panoptes/client.rb', line 52

def env
  @env
end

#panoptesObject (readonly)

Returns the value of attribute panoptes.



52
53
54
# File 'lib/panoptes/client.rb', line 52

def panoptes
  @panoptes
end

#talkObject (readonly)

Returns the value of attribute talk.



52
53
54
# File 'lib/panoptes/client.rb', line 52

def talk
  @talk
end

Instance Method Details

#panoptes_urlObject



69
70
71
72
73
74
75
76
# File 'lib/panoptes/client.rb', line 69

def panoptes_url
  case env
  when :production, 'production'
    'https://panoptes.zooniverse.org'
  else
    'https://panoptes-staging.zooniverse.org'
  end
end

#talk_urlObject



78
79
80
81
82
83
84
85
# File 'lib/panoptes/client.rb', line 78

def talk_url
  case env
  when :production, 'production'
    'https://talk.zooniverse.org'
  else
    'https://talk-staging.zooniverse.org'
  end
end