capsulecrm-b 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples.rb +3 -1
- data/lib/capsulecrm/opportunity.rb +11 -1
- data/lib/capsulecrm/version.rb +1 -1
- metadata +1 -1
data/examples.rb
CHANGED
@@ -5,8 +5,10 @@ CapsuleCRM.account_name = "futureworkshops"
|
|
5
5
|
CapsuleCRM.api_token = ENV['CAPSULE_CRM_API_KEY']
|
6
6
|
CapsuleCRM.initialize!
|
7
7
|
|
8
|
-
oppo = CapsuleCRM::Opportunity.find(
|
8
|
+
oppo = CapsuleCRM::Opportunity.find(1084419)
|
9
9
|
puts oppo.party.name
|
10
|
+
puts oppo.custom_fields[0].label
|
11
|
+
puts oppo.custom_fields[0].text
|
10
12
|
|
11
13
|
# find by id
|
12
14
|
person = CapsuleCRM::Person.find 123
|
@@ -50,16 +50,26 @@ class CapsuleCRM::Opportunity < CapsuleCRM::Base
|
|
50
50
|
CapsuleCRM::Collection.new(self, data)
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
53
|
# nodoc
|
55
54
|
def self.init_one(response)
|
56
55
|
data = response['opportunity']
|
57
56
|
new(attributes_from_xml_hash(data))
|
58
57
|
end
|
59
58
|
|
59
|
+
# nodoc
|
60
60
|
def party
|
61
61
|
return nil if party_id.nil?
|
62
62
|
@party ||= CapsuleCRM::Party.find(party_id)
|
63
63
|
end
|
64
|
+
|
65
|
+
# nodoc
|
66
|
+
def custom_fields
|
67
|
+
return @custom_fields if @custom_fields
|
68
|
+
path = self.class.get_path
|
69
|
+
path = [path, '/', id, '/customfield'].join
|
70
|
+
last_response = self.class.get(path)
|
71
|
+
data = last_response['customFields'].try(:[], 'customField')
|
72
|
+
@custom_fields = CapsuleCRM::CustomField.init_many(self, data)
|
73
|
+
end
|
64
74
|
|
65
75
|
end
|
data/lib/capsulecrm/version.rb
CHANGED