solve360 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +16 -0
- data/VERSION +1 -1
- data/lib/solve360/item.rb +7 -0
- data/spec/api_settings.yml +2 -1
- data/spec/fixtures/contacts/create-success.json +1 -1
- data/spec/solve360/item_spec.rb +37 -0
- metadata +2 -2
data/README.markdown
CHANGED
@@ -82,6 +82,22 @@ And added:
|
|
82
82
|
contact.add_related_item({"name" => "ACME Ltd", "id" => "91284"})
|
83
83
|
contact.save
|
84
84
|
|
85
|
+
### Ownership
|
86
|
+
|
87
|
+
You can specify the ownership of a record directly:
|
88
|
+
|
89
|
+
contact.ownership = 123456
|
90
|
+
|
91
|
+
Or you can add a default value to the configuration:
|
92
|
+
|
93
|
+
config.default_ownership = 123456
|
94
|
+
|
95
|
+
If no ownership is specified, the default will be used.
|
96
|
+
|
97
|
+
### API IDs
|
98
|
+
|
99
|
+
All Solve360 API IDs can be found in the 'My Account' > 'API Reference' section of the desktop.
|
100
|
+
|
85
101
|
## Support/Bugs
|
86
102
|
|
87
103
|
[Lighthouse](http://c21.lighthouseapp.com/projects/38966-solve360/overview)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/solve360/item.rb
CHANGED
@@ -42,6 +42,11 @@ module Solve360
|
|
42
42
|
# @return [Hash] response values from API
|
43
43
|
def save
|
44
44
|
response = []
|
45
|
+
|
46
|
+
if self.ownership.blank?
|
47
|
+
self.ownership = Solve360::Config.config.default_ownership
|
48
|
+
end
|
49
|
+
|
45
50
|
if new_record?
|
46
51
|
response = self.class.request(:post, "/#{self.class.resource_name}", to_request)
|
47
52
|
self.id = response["response"]["item"]["id"]
|
@@ -72,6 +77,8 @@ module Solve360
|
|
72
77
|
|
73
78
|
xml << "</relateditems>"
|
74
79
|
end
|
80
|
+
|
81
|
+
xml << "<ownership>#{ownership}</ownership>"
|
75
82
|
xml << "</request>"
|
76
83
|
|
77
84
|
xml
|
data/spec/api_settings.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"response" : {"relateditems" : nil, "activities" : nil, "categories" : nil, "status" : "success", "item" : {"name" : "Test ", "typeid" : "1", "id" : "12345", "fields" : {"modificatorid" : "536663", "lastname" : "Bartholomew", "creatorname" : "Stephen Bartholomew", "businessemail" : nil, "modificatorname" : "Stephen Bartholomew", "firstname" : "Catherine", "creatorid" : "536663", "personalemail" : nil}, "viewed" : "2009-10-06T08:15:27+00:00", "ownership" : "
|
1
|
+
{"response" : {"relateditems" : nil, "activities" : nil, "categories" : nil, "status" : "success", "item" : {"name" : "Test ", "typeid" : "1", "id" : "12345", "fields" : {"modificatorid" : "536663", "lastname" : "Bartholomew", "creatorname" : "Stephen Bartholomew", "businessemail" : nil, "modificatorname" : "Stephen Bartholomew", "firstname" : "Catherine", "creatorid" : "536663", "personalemail" : nil}, "viewed" : "2009-10-06T08:15:27+00:00", "ownership" : "12345", "flagged" : nil, "updated" : "2009-10-06T08:15:27+00:00", "created" : "2009-10-06T08:15:27+00:00"}}}
|
data/spec/solve360/item_spec.rb
CHANGED
@@ -106,6 +106,39 @@ describe "Creating a record" do
|
|
106
106
|
@contact.id.should == "12345"
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
context "specifying ownership" do
|
111
|
+
before do
|
112
|
+
stub_http_response_with("contacts/create-success.json")
|
113
|
+
@contact = Solve360::Contact.new(:fields => {"First Name" => "Catherine"})
|
114
|
+
@contact.ownership = "12345"
|
115
|
+
@contact.save
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should have assigned a default ownership" do
|
119
|
+
@contact.ownership.should == "12345"
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should contain ownership in any requests" do
|
123
|
+
@contact.to_request.should match(/\<ownership\>12345\<\/ownership\>/)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "default ownership" do
|
128
|
+
before do
|
129
|
+
stub_http_response_with("contacts/create-success.json")
|
130
|
+
@contact = Solve360::Contact.new(:fields => {"First Name" => "Catherine"})
|
131
|
+
@contact.save
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should have assigned a default ownership" do
|
135
|
+
@contact.ownership.should == 536664
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should contain ownership in any requests" do
|
139
|
+
@contact.to_request.should match(/\<ownership\>536664\<\/ownership\>/)
|
140
|
+
end
|
141
|
+
end
|
109
142
|
end
|
110
143
|
|
111
144
|
describe "Finding a record" do
|
@@ -123,6 +156,10 @@ describe "Finding a record" do
|
|
123
156
|
it "should have relations" do
|
124
157
|
@contact.related_items.first["name"].should == "Curve21"
|
125
158
|
end
|
159
|
+
|
160
|
+
it "should have ownership" do
|
161
|
+
@contact.ownership.should == "536663"
|
162
|
+
end
|
126
163
|
end
|
127
164
|
end
|
128
165
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solve360
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Bartholomew
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-12 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|