Class: Basecamp3::TypeMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/basecamp3/type_mapper.rb

Overview

The basecamp type to wrapper type mapper

Class Method Summary collapse

Class Method Details

.map(basecamp_type) ⇒ Class, OpenStruct

Maps the basecamp model type to wrapper model type.

Parameters:

  • basecamp_type (String)

    the basecamp model name

Returns:

  • (Class, OpenStruct)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/basecamp3/type_mapper.rb', line 9

def self.map(basecamp_type)
  case basecamp_type
  when 'Project'
    Basecamp3::Project
  when 'Chat::Transcript'
    Basecamp3::Campfire
  when 'Chat::Lines::Text'
    Basecamp3::CampfireLine
  when 'Comment'
    Basecamp3::Comment
  when 'Document'
    Basecamp3::Document
  when 'Inbox::Forward'
    Basecamp3::Forward
  when 'Inbox'
    Basecamp3::Inbox
  when 'Message::Board'
    Basecamp3::MessageBoard
  when 'Message'
    Basecamp3::Message
  when 'User'
    Basecamp3::Person
  when 'Question::Answer'
    Basecamp3::QuestionAnswer
  when 'Questionnaire'
    Basecamp3::Questionnaire
  when 'Question'
    Basecamp3::Question
  when 'Schedule::Entry'
    Basecamp3::ScheduleEntry
  when 'Schedule'
    Basecamp3::Schedule
  when 'Todolist'
    Basecamp3::TodoList
  when 'Todo'
    Basecamp3::Todo
  when 'Todoset'
    Basecamp3::TodoSet
  when 'Vault'
    Basecamp3::Vault
  else
    OpenStruct
  end
end