Module: StudyplusForSchoolSync::Endpoint::Partner

Included in:
StudyplusForSchoolSync::Endpoint
Defined in:
lib/studyplus_for_school_sync/endpoint/partner.rb

Instance Method Summary collapse

Instance Method Details

#create_partner(school_name:, **options) ⇒ Hash

Create partner

Parameters:

  • partner_name (String)
  • options (Hash)

Options Hash (**options):

  • :name (String)
  • :timezone (String)
  • :started_on (String)
  • :customer_id (String)

Returns:

  • (Hash)

    API response


12
13
14
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 12

def create_partner(school_name:, **options)
  post(path: "#{BASE_PAH}/partners", params: options.merge(school_name: school_name))
end

#create_student(partner_public_id:, last_name:, first_name:, last_name_kana:, first_name_kana:, **options) ⇒ Hash

Create student

Parameters:

  • partner_public_id (String)
  • last_name (String)
  • first_name (String)
  • last_name_kana (String)
  • first_name_kana (String)
  • options (Hash)

Options Hash (**options):

  • :school_type (String)
  • :grade (String)
  • :code (String)

Returns:

  • (Hash)

    API response


27
28
29
30
31
32
33
34
35
36
37
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 27

def create_student(partner_public_id:, last_name:, first_name:, last_name_kana:, first_name_kana:, **options)
  post(
    path: "#{BASE_PAH}/partners/#{partner_public_id}/students",
    params: options.merge(
      last_name: last_name,
      first_name: first_name,
      last_name_kana: last_name_kana,
      first_name_kana: first_name_kana
    )
  )
end

#create_tag(partner_id:, name:, **options) ⇒ Hash

Creae tag

Parameters:

  • partner_id (String)
  • name (String)
  • options (Hash)

Options Hash (**options):

  • :customer_id (String)

Returns:

  • (Hash)

    API response


53
54
55
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 53

def create_tag(partner_id:, name:, **options)
  post(path: "#{BASE_PAH}/partners/#{partner_id}/tags", params: options.merge(name: name))
end

#delete_tag(partner_id:, tag_id:) ⇒ Hash

Delete tag

Parameters:

  • partner_id (String)
  • tag_id (String)

Returns:

  • (Hash)

    API response


72
73
74
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 72

def delete_tag(partner_id:, tag_id:)
  delete(path: "#{BASE_PAH}/partners/#{partner_id}/tags/#{tag_id}")
end

#tags(partner_id:, page: 1) ⇒ Hash

Get tags

Parameters:

  • parner_id (String)
  • page (Integer) (defaults to: 1)

Returns:

  • (Hash)

    API response


43
44
45
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 43

def tags(partner_id:, page: 1)
  get(path: "#{BASE_PAH}/partners/#{partner_id}/tags", params: { page: page })
end

#update_tag(partner_id:, tag_id:, name:, **options) ⇒ Hash

Update tag

Parameters:

  • partner_id (String)
  • tag_id (String)
  • name (String)
  • options (Hash)
  • options (String)

    :customer_id

Returns:

  • (Hash)

    API response


64
65
66
# File 'lib/studyplus_for_school_sync/endpoint/partner.rb', line 64

def update_tag(partner_id:, tag_id:, name:, **options)
  patch(path: "#{BASE_PAH}/partners/#{partner_id}/tags/#{tag_id}", params: options.merge(name: name))
end