clio_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +169 -0
  5. data/Rakefile +9 -0
  6. data/clio_client.gemspec +27 -0
  7. data/lib/clio_client/api/activity.rb +23 -0
  8. data/lib/clio_client/api/activity_description.rb +17 -0
  9. data/lib/clio_client/api/base.rb +18 -0
  10. data/lib/clio_client/api/bill.rb +23 -0
  11. data/lib/clio_client/api/calendar.rb +19 -0
  12. data/lib/clio_client/api/calendar_entry.rb +20 -0
  13. data/lib/clio_client/api/communication.rb +25 -0
  14. data/lib/clio_client/api/contact.rb +23 -0
  15. data/lib/clio_client/api/crudable.rb +25 -0
  16. data/lib/clio_client/api/custom_field.rb +19 -0
  17. data/lib/clio_client/api/custom_field_set.rb +19 -0
  18. data/lib/clio_client/api/document.rb +20 -0
  19. data/lib/clio_client/api/document_version.rb +29 -0
  20. data/lib/clio_client/api/findable.rb +16 -0
  21. data/lib/clio_client/api/group.rb +22 -0
  22. data/lib/clio_client/api/listable.rb +44 -0
  23. data/lib/clio_client/api/matter.rb +22 -0
  24. data/lib/clio_client/api/note.rb +22 -0
  25. data/lib/clio_client/api/practice_area.rb +22 -0
  26. data/lib/clio_client/api/relationship.rb +22 -0
  27. data/lib/clio_client/api/task.rb +22 -0
  28. data/lib/clio_client/api/timeline_event.rb +19 -0
  29. data/lib/clio_client/api/timer.rb +31 -0
  30. data/lib/clio_client/api/user.rb +31 -0
  31. data/lib/clio_client/authorization.rb +41 -0
  32. data/lib/clio_client/http.rb +92 -0
  33. data/lib/clio_client/models/account.rb +16 -0
  34. data/lib/clio_client/models/activity.rb +31 -0
  35. data/lib/clio_client/models/activity_description.rb +21 -0
  36. data/lib/clio_client/models/bill.rb +45 -0
  37. data/lib/clio_client/models/calendar.rb +19 -0
  38. data/lib/clio_client/models/calendar_entry.rb +32 -0
  39. data/lib/clio_client/models/communication.rb +34 -0
  40. data/lib/clio_client/models/company.rb +7 -0
  41. data/lib/clio_client/models/contact.rb +38 -0
  42. data/lib/clio_client/models/custom_field.rb +21 -0
  43. data/lib/clio_client/models/custom_field_set.rb +21 -0
  44. data/lib/clio_client/models/document.rb +33 -0
  45. data/lib/clio_client/models/document_version.rb +26 -0
  46. data/lib/clio_client/models/email_communication.rb +8 -0
  47. data/lib/clio_client/models/expense_entry.rb +9 -0
  48. data/lib/clio_client/models/group.rb +18 -0
  49. data/lib/clio_client/models/matter.rb +45 -0
  50. data/lib/clio_client/models/note.rb +23 -0
  51. data/lib/clio_client/models/person.rb +9 -0
  52. data/lib/clio_client/models/phone_communication.rb +8 -0
  53. data/lib/clio_client/models/practice_area.rb +18 -0
  54. data/lib/clio_client/models/relationship.rb +19 -0
  55. data/lib/clio_client/models/task.rb +29 -0
  56. data/lib/clio_client/models/time_entry.rb +9 -0
  57. data/lib/clio_client/models/timeline_event.rb +25 -0
  58. data/lib/clio_client/models/timer.rb +28 -0
  59. data/lib/clio_client/models/user.rb +28 -0
  60. data/lib/clio_client/resource.rb +183 -0
  61. data/lib/clio_client/session.rb +56 -0
  62. data/lib/clio_client/support/address.rb +16 -0
  63. data/lib/clio_client/support/custom_field_checkbox_value.rb +7 -0
  64. data/lib/clio_client/support/custom_field_contact_value.rb +10 -0
  65. data/lib/clio_client/support/custom_field_currency_value.rb +7 -0
  66. data/lib/clio_client/support/custom_field_date_value.rb +7 -0
  67. data/lib/clio_client/support/custom_field_email_value.rb +7 -0
  68. data/lib/clio_client/support/custom_field_matter_value.rb +9 -0
  69. data/lib/clio_client/support/custom_field_numeric_value.rb +7 -0
  70. data/lib/clio_client/support/custom_field_picklist_option.rb +13 -0
  71. data/lib/clio_client/support/custom_field_picklist_value.rb +9 -0
  72. data/lib/clio_client/support/custom_field_text_area_value.rb +7 -0
  73. data/lib/clio_client/support/custom_field_text_line_value.rb +7 -0
  74. data/lib/clio_client/support/custom_field_time_value.rb +7 -0
  75. data/lib/clio_client/support/custom_field_url_value.rb +7 -0
  76. data/lib/clio_client/support/custom_field_value.rb +13 -0
  77. data/lib/clio_client/support/email_address.rb +12 -0
  78. data/lib/clio_client/support/instant_messenger.rb +12 -0
  79. data/lib/clio_client/support/phone_number.rb +13 -0
  80. data/lib/clio_client/support/rate.rb +16 -0
  81. data/lib/clio_client/support/reminder.rb +11 -0
  82. data/lib/clio_client/support/web_site.rb +12 -0
  83. data/lib/clio_client/version.rb +3 -0
  84. data/lib/clio_client.rb +107 -0
  85. data/spec/api/crudable_spec.rb +54 -0
  86. data/spec/api/findable_spec.rb +25 -0
  87. data/spec/api/listable_spec.rb +27 -0
  88. data/spec/features/activities_spec.rb +35 -0
  89. data/spec/models/account_spec.rb +12 -0
  90. data/spec/models/activity_description_spec.rb +47 -0
  91. data/spec/models/activity_spec.rb +29 -0
  92. data/spec/models/bill_spec.rb +63 -0
  93. data/spec/models/calendar_entry_spec.rb +62 -0
  94. data/spec/models/calendar_spec.rb +20 -0
  95. data/spec/models/communication_spec.rb +39 -0
  96. data/spec/models/company_spec.rb +5 -0
  97. data/spec/models/contact_spec.rb +5 -0
  98. data/spec/models/custom_field_set_spec.rb +5 -0
  99. data/spec/models/custom_field_spec.rb +5 -0
  100. data/spec/models/document_spec.rb +5 -0
  101. data/spec/models/document_version_spec.rb +6 -0
  102. data/spec/models/email_communication_spec.rb +6 -0
  103. data/spec/models/expense_entry_spec.rb +5 -0
  104. data/spec/models/group_spec.rb +5 -0
  105. data/spec/models/matter_spec.rb +5 -0
  106. data/spec/models/note_spec.rb +5 -0
  107. data/spec/models/person_spec.rb +5 -0
  108. data/spec/models/phone_communication_spec.rb +5 -0
  109. data/spec/models/practice_area_spec.rb +5 -0
  110. data/spec/models/relationship_spec.rb +5 -0
  111. data/spec/models/resource_spec.rb +116 -0
  112. data/spec/models/task_spec.rb +5 -0
  113. data/spec/models/time_entry_spec.rb +41 -0
  114. data/spec/models/timeline_event_spec.rb +6 -0
  115. data/spec/models/timer_spec.rb +6 -0
  116. data/spec/models/user_spec.rb +5 -0
  117. data/spec/spec_helper.rb +25 -0
  118. data/spec/support/associated_resource.rb +6 -0
  119. data/spec/support/dummy_endpoint.rb +11 -0
  120. data/spec/support/inherited_resource.rb +2 -0
  121. data/spec/support/resource_examples.rb +82 -0
  122. data/spec/support/test_resource.rb +11 -0
  123. metadata +286 -0
@@ -0,0 +1,18 @@
1
+ module ClioClient
2
+ class Group < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ created_at: {type: :datetime, readonly: true},
6
+ updated_at: {type: :datetime, readonly: true},
7
+ name: {type: :string},
8
+ )
9
+
10
+ has_many_association :users, ClioClient::User
11
+
12
+ private
13
+ def api
14
+ session.groups
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ module ClioClient
2
+
3
+ class Matter < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ display_number: {type: :string },
9
+ status: {type: :string, required: true},
10
+ description: {type: :string, required: true},
11
+ client_reference: {type: :string},
12
+ location: {type: :string},
13
+ pending_date: {type: :date},
14
+ open_date: {type: :date},
15
+ close_date: {type: :date},
16
+ billable: {type: :boolean},
17
+ maildrop_address: {type: :int, readonly: true},
18
+ )
19
+
20
+ alias_method :name, :display_number
21
+ alias_method :name=, :display_number=
22
+
23
+ has_association(:client, ClioClient::Contact,
24
+ :polymorphic => true, :accepted_types => %w(Person Company))
25
+ has_association :responsible_attorney, ClioClient::User
26
+ has_association :practice_area, ClioClient::PracticeArea
27
+ has_many_association(:custom_field_values, ClioClient::CustomFieldValue,
28
+ :polymorphic => true,
29
+ :accepted_types => %w(CustomFieldCheckboxValue CustomFieldContactValue
30
+ CustomFieldCurrencyValue CustomFieldDateValue CustomFieldTimeValue
31
+ CustomFieldEmailValue CustomFieldMatterValue CustomFieldNumericValue
32
+ CustomFieldPicklistValue CustomFieldTextAreaValue
33
+ CustomFieldTextLineValue CustomFieldUrlValue))
34
+
35
+ has_association(:permission, ClioClient::Resource,
36
+ :polymorphic => true,
37
+ :accepted_types => %w(Group User))
38
+
39
+ has_many_association :activity_rates, ClioClient::Rate
40
+ has_association :flat_rate_activity, ClioClient::Rate
41
+ has_association :flat_rate_activity_description, ClioClient::ActivityDescription
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,23 @@
1
+ module ClioClient
2
+
3
+ class Note < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ subject: {type: :string},
9
+ detail: {type: :string},
10
+ date: {type: :date}
11
+ )
12
+
13
+ has_association(:regarding, ClioClient::Resource,
14
+ :polymorphic => true, :accepted_types => %w(Contact Matter))
15
+
16
+ private
17
+ def api
18
+ session.notes
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,9 @@
1
+ module ClioClient
2
+ class Person < Contact
3
+
4
+ def type; 'Person'; end
5
+
6
+ has_association :company, ClioClient::Company
7
+
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module ClioClient
2
+
3
+ class PhoneCommunication < Communication
4
+
5
+ def type; 'PhoneCommunication'; end
6
+
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ module ClioClient
2
+
3
+ class PracticeArea < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ name: {type: :string}
9
+ )
10
+
11
+ private
12
+ def api
13
+ session.practice_areas
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,19 @@
1
+ module ClioClient
2
+ class Relationship < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ created_at: {type: :datetime, readonly: true},
6
+ updated_at: {type: :datetime, readonly: true},
7
+ description: {type: :string},
8
+ )
9
+
10
+ has_association :contact, ClioClient::Contact
11
+ has_association :matter, ClioClient::Matter
12
+
13
+ private
14
+ def api
15
+ session.relationships
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ module ClioClient
2
+ class Task < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ created_at: {type: :datetime, readonly: true},
6
+ updated_at: {type: :datetime, readonly: true},
7
+ name: {type: :string},
8
+ description: {type: :string},
9
+ priority: {type: :string},
10
+ due_at: {type: :date},
11
+ complete: {type: :boolean},
12
+ complete_at: {type: :date},
13
+ is_private: {type: :boolean},
14
+ is_statute_of_limitations: {type: :boolean}
15
+ )
16
+
17
+ has_association :user, ClioClient::User
18
+ has_association :assigner, ClioClient::User
19
+ has_association :matter, ClioClient::Matter
20
+ has_many_association :reminders, ClioClient::Reminder
21
+
22
+
23
+ private
24
+ def api
25
+ session.tasks
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module ClioClient
2
+
3
+ class TimeEntry < Activity
4
+
5
+ def type; 'TimeEntry'; end
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,25 @@
1
+ module ClioClient
2
+ class TimelineEvent < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ created_at: {type: :datetime, readonly: true},
6
+ updated_at: {type: :datetime, readonly: true},
7
+ event_type: {type: :string},
8
+ old_subject_name: {type: :string},
9
+ subject: {type: :hash}
10
+ )
11
+
12
+ has_association(:actor, ClioClient::Resource,
13
+ :polymorphic => true,
14
+ :accepted_types => %w(Contact User))
15
+
16
+ has_association :matter, ClioClient::Matter
17
+
18
+
19
+ private
20
+ def api
21
+ session.timeline_events
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ module ClioClient
2
+
3
+ class Timer < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ start_time: {type: :datetime},
9
+ )
10
+
11
+ has_association :activity, ClioClient::TimeEntry
12
+
13
+ def start
14
+ api.start({activity_id: self.to_params[(:activity_id)]})
15
+ end
16
+
17
+ def stop
18
+ api.stop
19
+ end
20
+
21
+ private
22
+ def api
23
+ session.timer
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,28 @@
1
+ module ClioClient
2
+
3
+ class User < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ subscription_plan: {type: :string, readonly: true},
9
+ time_zone: {type: :string, readonly: true},
10
+ first_name: {type: :string, readonly: true},
11
+ last_name: {type: :string, readonly: true},
12
+ email: {type: :string, readonly: true},
13
+ enabled: {type: :boolean, readonly: true},
14
+ name: {type: :string, readonly: true}
15
+ )
16
+
17
+ def avatar
18
+ api.avatar(id)
19
+ end
20
+
21
+ private
22
+ def api
23
+ session.users
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,183 @@
1
+ module ClioClient
2
+
3
+ class ResourceNotSaved < Exception; end
4
+ class AttributeReadOnly < Exception; end
5
+
6
+ class Resource
7
+
8
+ attr_accessor :session
9
+
10
+ def self.inspect
11
+ attr_list = attributes.inject([]) do |a, (attr, opts)|
12
+ a << "#{attr}: #{opts[:type]}"
13
+ end * ", "
14
+ "#{super}(#{attr_list})"
15
+ end
16
+
17
+ def inspect
18
+ attr_list = self.class.attributes.inject([]) do |a, (attr, opts)|
19
+ if has_attribute?(attr)
20
+ a << "#{attr}: #{self[attr].inspect}"
21
+ else
22
+ a
23
+ end
24
+ end * ", "
25
+ "#<#{self.class} #{attr_list}>"
26
+ end
27
+
28
+ def initialize(values = {}, session = nil)
29
+ self.session = session
30
+ values.each_pair do |k, v|
31
+ self.send("#{k}=", v) if respond_to?("#{k}=") && !v.nil?
32
+ end
33
+ end
34
+
35
+ def to_params
36
+ self.class.attributes.inject({}) do |h, (attr, opts)|
37
+ has_attribute?(attr) ? h.merge(attr => paramify(self[attr])) : h
38
+ end
39
+ end
40
+
41
+
42
+
43
+ class << self
44
+
45
+
46
+ attr_accessor :attributes
47
+ def set_attributes(attrs)
48
+ self.attributes = attrs
49
+ attrs.each_pair do |name, options|
50
+ attr_reader name
51
+ define_method "#{name}=" do |value|
52
+ if options[:readonly] && !instance_variable_get("@#{name}").nil?
53
+ raise AttributeReadOnly
54
+ end
55
+ write_attribute("#{name}", convert_attribute(value, options))
56
+ end
57
+ end
58
+ end
59
+
60
+ def inherited(subclass)
61
+ if !self.attributes.nil?
62
+ subclass.attributes = self.attributes
63
+ end
64
+ end
65
+
66
+ def has_association(name, klass, options = {})
67
+ attr_accessor "#{name}_id"
68
+ attr_reader name
69
+ self.attributes["#{name}_id".intern] = {type: :foreign_key}
70
+ define_method "#{name}=" do |attributes|
71
+ write_attribute("#{name}_id", attributes["id"])
72
+ if options[:polymorphic]
73
+ obj = polymorphic_object(attributes, options[:accepted_types])
74
+ else
75
+ obj = klass.new(attributes, session)
76
+ end
77
+ write_attribute("#{name}", obj)
78
+ end
79
+ end
80
+
81
+ def has_many_association(name, klass, options = {})
82
+ attr_reader name
83
+ self.attributes[name.intern] = {type: :has_many_association}
84
+ define_method "#{name}=" do |arr|
85
+ many = arr.collect do |attributes|
86
+ if options[:polymorphic]
87
+ polymorphic_object(attributes, options[:accepted_types])
88
+ else
89
+ klass.new(attributes, session)
90
+ end
91
+ end
92
+ write_attribute(name, many)
93
+ end
94
+ end
95
+
96
+ end
97
+
98
+ def ==(o)
99
+ self.class == o.class && !self.id.nil? && self.id != "" && self.id == o.id
100
+ end
101
+ alias_method :eql?, :==
102
+
103
+ def [](val)
104
+ self.send(val)
105
+ end
106
+
107
+
108
+ def save
109
+ if self.id.nil?
110
+ saved_item = api.create(self.to_params)
111
+ self.id = saved_item && saved_item.id
112
+ self
113
+ else
114
+ api.update(self.id, self.to_params)
115
+ self
116
+ end
117
+ end
118
+
119
+ def reload
120
+ raise ResourceNotSaved if self.id.nil?
121
+ api.find(self.id)
122
+ end
123
+
124
+ def destroy
125
+ raise ResourceNotSaved if self.id.nil?
126
+ api.destroy(self.id)
127
+ end
128
+
129
+ private
130
+ def polymorphic_object(attributes, accepted_types)
131
+ if accepted_types.include? attributes["type"]
132
+ klass = ClioClient.const_get attributes["type"].intern
133
+ klass.new(attributes, session)
134
+ end
135
+ end
136
+
137
+ def write_attribute(name, value)
138
+ instance_variable_set("@#{name}", value)
139
+ end
140
+
141
+ def api
142
+ raise NotImplementedError
143
+ end
144
+
145
+ def has_attribute?(attr)
146
+ instance_variable_defined?("@#{attr}")
147
+ end
148
+
149
+ def paramify(val)
150
+ if val.kind_of? ClioClient::Resource
151
+ val.to_params
152
+ elsif val.kind_of? Array
153
+ val.collect{|v| paramify(v) }
154
+ else
155
+ val
156
+ end
157
+ end
158
+
159
+ def convert_attribute(val, options)
160
+ case options[:type]
161
+ when :int
162
+ val.to_i
163
+ when :string
164
+ val.to_s
165
+ when :date
166
+ val.kind_of?(Date) ? val : Date.parse(val)
167
+ when :decimal
168
+ val.to_f
169
+ when :boolean
170
+ val == "true"
171
+ when :datetime
172
+ val.kind_of?(DateTime) ? val : DateTime.parse(val)
173
+ when :datetime
174
+ val.kind_of?(Time) ? val : Time.parse(val)
175
+ when :foreign_key
176
+ (val == "" || val.nil?) ? nil : val.to_i
177
+ else
178
+ val
179
+ end
180
+ end
181
+
182
+ end
183
+ end
@@ -0,0 +1,56 @@
1
+ module ClioClient
2
+
3
+ class Session
4
+
5
+ include Http
6
+ include Authorization
7
+
8
+ attr_accessor :access_token, :client_id, :client_secret
9
+ attr_accessor :end_points
10
+
11
+ def initialize(credentials = {})
12
+ self.access_token = credentials[:access_token]
13
+ self.client_id = credentials[:client_id]
14
+ self.client_secret = credentials[:client_secret]
15
+ self.end_points = {}
16
+ end
17
+
18
+ { activities: ClioClient::Api::Activity,
19
+ activity_descriptions: ClioClient::Api::ActivityDescription,
20
+ bills: ClioClient::Api::Bill,
21
+ calendar_entries: ClioClient::Api::CalendarEntry,
22
+ calendars: ClioClient::Api::Calendar,
23
+ communications: ClioClient::Api::Communication,
24
+ contacts: ClioClient::Api::Contact,
25
+ custom_field_sets: ClioClient::Api::CustomFieldSet,
26
+ custom_fields: ClioClient::Api::CustomField,
27
+ document_versions: ClioClient::Api::DocumentVersion,
28
+ documents: ClioClient::Api::Document,
29
+ groups: ClioClient::Api::Group,
30
+ matters: ClioClient::Api::Matter,
31
+ notes: ClioClient::Api::Note,
32
+ practice_areas: ClioClient::Api::PracticeArea,
33
+ relationships: ClioClient::Api::Relationship,
34
+ tasks: ClioClient::Api::Task,
35
+ timeline_events: ClioClient::Api::TimelineEvent,
36
+ timer: ClioClient::Api::Timer,
37
+ users: ClioClient::Api::User
38
+ }.each_pair do |method, klass|
39
+ define_method method do
40
+ end_points[method] ||= klass.new(self)
41
+ end
42
+ end
43
+
44
+ def document_versions(document_id)
45
+ end_points[:document_versions] ||= {}
46
+ unless end_points[:document_versions][document_id]
47
+ e = ClioClient::Api::DocumentVersion.new(self)
48
+ e.document_id = document_id
49
+ end_points[:document_versions][document_id] = e
50
+ end
51
+ end_points[:document_versions][document_id]
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,16 @@
1
+ module ClioClient
2
+ class Address < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ created_at: {type: :datetime, readonly: true},
6
+ updated_at: {type: :datetime, readonly: true},
7
+ name: {type: :string},
8
+ street: {type: :string},
9
+ city: {type: :string},
10
+ province: {type: :string},
11
+ postal_code: {type: :string},
12
+ country: {type: :string}
13
+ )
14
+
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldCheckboxValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :boolean}
5
+
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module ClioClient
2
+ class CustomFieldContactValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :int}
5
+
6
+ has_association(:contact, ClioClient::Contact, :polymorphc => true,
7
+ :accepted_types => %w(Person Company))
8
+
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldCurrencyValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :decimal}
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldDateValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :date}
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldEmailValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :string}
5
+
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module ClioClient
2
+ class CustomFieldMatterValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :int}
5
+
6
+ has_association :matter, ClioClient::Matter
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldNumericValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :decimal}
5
+
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module ClioClient
2
+ class CustomFieldPicklistOption < Resource
3
+
4
+ set_attributes(id: {type: :int, readonly: true},
5
+ deleted_at: {type: :datetime, readonly: true},
6
+ created_at: {type: :datetime, readonly: true},
7
+ updated_at: {type: :datetime, readonly: true},
8
+ name: {type: :string },
9
+ )
10
+
11
+
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module ClioClient
2
+ class CustomFieldPicklistValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :int}
5
+
6
+ has_association :custom_field_picklist_option, ClioClient::CustomFieldPicklistOption
7
+
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldTextAreaValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :string}
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldTextLineValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :string}
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldTimeValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :time}
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ClioClient
2
+ class CustomFieldUrlValue < CustomFieldValue
3
+
4
+ self.attributes[:value] = {type: :string}
5
+
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module ClioClient
2
+
3
+ class CustomFieldValue < Resource
4
+
5
+ set_attributes(id: {type: :int, readonly: true},
6
+ type: {type: :string},
7
+ created_at: {type: :datetime, readonly: true},
8
+ updated_at: {type: :datetime, readonly: true},
9
+ value: {type: :variable}
10
+ )
11
+
12
+ end
13
+ end