MissionHub 1.0rc7 → 1.0rc8
Sign up to get free protection for your applications and to get access to all the features.
- data/fixtures/vcr_cassettes/auth.yml +31 -3
- data/lib/missionhub/api.rb +0 -4
- data/lib/missionhub/person.rb +3 -0
- data/lib/missionhub/version.rb +1 -1
- data/spec/lib/missionhub/api_spec.rb +2 -0
- metadata +1 -1
@@ -40,7 +40,7 @@ http_interactions:
|
|
40
40
|
encoding: US-ASCII
|
41
41
|
string: ! '{"error":"invalid_client","error_description":"{\"error\": {\"message\":\"Client
|
42
42
|
ID and client secret do not match.\", \"code\": \"52\"}}"}'
|
43
|
-
http_version:
|
43
|
+
http_version:
|
44
44
|
recorded_at: Wed, 03 Oct 2012 23:28:06 GMT
|
45
45
|
- request:
|
46
46
|
method: post
|
@@ -83,7 +83,7 @@ http_interactions:
|
|
83
83
|
body:
|
84
84
|
encoding: US-ASCII
|
85
85
|
string: ! '{"access_token":"e83b007f75ad49d480303f892de884204b7864bc817f0fb547c9d87444c39a75","scope":"contacts,userinfo,contact_assignment,followup_comments,roles,organization_info"}'
|
86
|
-
http_version:
|
86
|
+
http_version:
|
87
87
|
recorded_at: Wed, 03 Oct 2012 23:28:06 GMT
|
88
88
|
- request:
|
89
89
|
method: post
|
@@ -129,6 +129,34 @@ http_interactions:
|
|
129
129
|
body:
|
130
130
|
encoding: US-ASCII
|
131
131
|
string: ! '{"meta":{"request_time":1349306917},"id":"1050"}'
|
132
|
-
http_version:
|
132
|
+
http_version:
|
133
133
|
recorded_at: Wed, 03 Oct 2012 23:28:13 GMT
|
134
|
+
- request:
|
135
|
+
method: post
|
136
|
+
uri: http://www.missionhub.com/api/v2/contacts.json
|
137
|
+
body:
|
138
|
+
encoding: US-ASCII
|
139
|
+
string: person[firstName]=Test&person[lastName]=User&person[gender]=female&person[current_address_attributes][address1]=123%20Somewhere%20St&person[current_address_attributes][address2]=Dept%202500&person[current_address_attributes][city]=Orlando&person[current_address_attributes][country]=US&person[current_address_attributes][state]=FL&person[current_address_attributes][zip]=32832&person[email_address][email]=mail%40google.com&person[email_address][primary]=0&person[phone_number][number]=021021021&person[phone_number][primary]=0&person[phone_number][location]=mobile&answers[4952]=Hello%20World&answers[4953]=R2&answers[4955]=D2&answers[4954][]=&answers[4954][C3]=C3&answers[4954][C4]=C4&org_id=5522&user_id=1615180&access_token=e83b007f75ad49d480303f892de884204b7864bc817f0fb547c9d87444c39a75
|
140
|
+
headers: {}
|
141
|
+
response:
|
142
|
+
status:
|
143
|
+
code: 502
|
144
|
+
message: Bad Gateway
|
145
|
+
headers:
|
146
|
+
Server:
|
147
|
+
- nginx/1.0.14
|
148
|
+
Date:
|
149
|
+
- Wed, 10 Oct 2012 00:41:41 GMT
|
150
|
+
Content-Type:
|
151
|
+
- text/html
|
152
|
+
Connection:
|
153
|
+
- keep-alive
|
154
|
+
Content-Length:
|
155
|
+
- '172'
|
156
|
+
body:
|
157
|
+
encoding: US-ASCII
|
158
|
+
string: ! "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>502
|
159
|
+
Bad Gateway</h1></center>\r\n<hr><center>nginx/1.2.2</center>\r\n</body>\r\n</html>\r\n"
|
160
|
+
http_version:
|
161
|
+
recorded_at: Wed, 10 Oct 2012 00:40:14 GMT
|
134
162
|
recorded_with: VCR 2.2.5
|
data/lib/missionhub/api.rb
CHANGED
@@ -12,10 +12,6 @@ module MissionHub
|
|
12
12
|
self.class.base_uri MissionHub.base_uri
|
13
13
|
end
|
14
14
|
|
15
|
-
def debug
|
16
|
-
debug_output $stderr
|
17
|
-
end
|
18
|
-
|
19
15
|
def auth
|
20
16
|
options = {:body => { :grant_type => 'none', :client_id => MissionHub.client_id, :client_secret => MissionHub.client_secret } }
|
21
17
|
response = self.class.post('/oauth/access_token', options)
|
data/lib/missionhub/person.rb
CHANGED
@@ -33,6 +33,9 @@ module MissionHub
|
|
33
33
|
|
34
34
|
if message.is_a?(String) or message.is_a?(Hash) or message.is_a?(Array)
|
35
35
|
if id.is_a?(Integer)
|
36
|
+
if message.is_a?(Array)
|
37
|
+
message = Hash[ *message.collect { |v| [ v, v ] }.flatten ]
|
38
|
+
end
|
36
39
|
@answers[id] = message
|
37
40
|
else
|
38
41
|
raise "Invalid type for id"
|
data/lib/missionhub/version.rb
CHANGED
@@ -83,6 +83,8 @@ describe MissionHub::API do
|
|
83
83
|
person.set_answer(4955, "D2")
|
84
84
|
hash_answer = {"2" => "C3", "3" => "C4"}
|
85
85
|
person.set_answer(4954, hash_answer)
|
86
|
+
array_answer = ["","C3","C4"]
|
87
|
+
person.set_answer(4954, array_answer)
|
86
88
|
person.phone = "021021021"
|
87
89
|
response = api.create_person(person)
|
88
90
|
response.must_be_instance_of Hash
|