MissionHub 1.0rc3 → 1.0rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,17 +5,17 @@ http_interactions:
5
5
  uri: http://www.missionhub.com/oauth/access_token
6
6
  body:
7
7
  encoding: US-ASCII
8
- string: grant_type=none&client_id=12&client_secret=83f84763001c1fb4ce96adc4908b9ba285b510d6
8
+ string: grant_type=none&client_id=12&client_secret=
9
9
  headers: {}
10
10
  response:
11
11
  status:
12
- code: 200
13
- message: OK
12
+ code: 400
13
+ message: Bad Request
14
14
  headers:
15
15
  Server:
16
16
  - nginx/1.0.14
17
17
  Date:
18
- - Wed, 03 Oct 2012 22:39:16 GMT
18
+ - Wed, 03 Oct 2012 23:29:16 GMT
19
19
  Content-Type:
20
20
  - application/json
21
21
  Transfer-Encoding:
@@ -23,42 +23,41 @@ http_interactions:
23
23
  Connection:
24
24
  - keep-alive
25
25
  Status:
26
- - '200'
26
+ - '400'
27
27
  X-Powered-By:
28
28
  - Phusion Passenger (mod_rails/mod_rack) 3.0.15
29
29
  Cache-Control:
30
30
  - no-store
31
31
  X-Ua-Compatible:
32
32
  - IE=Edge,chrome=1
33
- Etag:
34
- - ! '"d0d53d93eea872825c2d3ddf4602b136"'
35
33
  X-Request-Id:
36
- - 349184278b44962580048593d664a0cc
34
+ - 7b1ff696190f4c801aff3c9d946d59ff
37
35
  X-Runtime:
38
- - '0.021574'
36
+ - '0.004363'
39
37
  X-Rack-Cache:
40
38
  - invalidate, pass
41
39
  body:
42
40
  encoding: US-ASCII
43
- string: ! '{"access_token":"b08f825c2543643e561ba92b296028c4de2887a17179269c311ba680a96574d6","scope":"contacts,userinfo,contact_assignment,followup_comments,roles,organization_info"}'
41
+ string: ! '{"error":"invalid_client","error_description":"{\"error\": {\"message\":\"Client
42
+ ID and client secret do not match.\", \"code\": \"52\"}}"}'
44
43
  http_version:
45
- recorded_at: Wed, 03 Oct 2012 22:38:06 GMT
44
+ recorded_at: Wed, 03 Oct 2012 23:28:06 GMT
46
45
  - request:
47
46
  method: post
48
47
  uri: http://www.missionhub.com/oauth/access_token
49
48
  body:
50
49
  encoding: US-ASCII
51
- string: grant_type=none&client_id=12&client_secret=
50
+ string: grant_type=none&client_id=12&client_secret=83f84763001c1fb4ce96adc4908b9ba285b510d6
52
51
  headers: {}
53
52
  response:
54
53
  status:
55
- code: 400
56
- message: Bad Request
54
+ code: 200
55
+ message: OK
57
56
  headers:
58
57
  Server:
59
58
  - nginx/1.0.14
60
59
  Date:
61
- - Wed, 03 Oct 2012 22:39:17 GMT
60
+ - Wed, 03 Oct 2012 23:29:16 GMT
62
61
  Content-Type:
63
62
  - application/json
64
63
  Transfer-Encoding:
@@ -66,31 +65,32 @@ http_interactions:
66
65
  Connection:
67
66
  - keep-alive
68
67
  Status:
69
- - '400'
68
+ - '200'
70
69
  X-Powered-By:
71
70
  - Phusion Passenger (mod_rails/mod_rack) 3.0.15
72
71
  Cache-Control:
73
72
  - no-store
74
73
  X-Ua-Compatible:
75
74
  - IE=Edge,chrome=1
75
+ Etag:
76
+ - ! '"5e899e87b14129ae3a0b4045e60aa034"'
76
77
  X-Request-Id:
77
- - bc57010e2ca62e9c3ac610e8fd5f7444
78
+ - 86584ba26c5eca90804362c68b672f07
78
79
  X-Runtime:
79
- - '0.052999'
80
+ - '0.012294'
80
81
  X-Rack-Cache:
81
82
  - invalidate, pass
82
83
  body:
83
84
  encoding: US-ASCII
84
- string: ! '{"error":"invalid_client","error_description":"{\"error\": {\"message\":\"Client
85
- ID and client secret do not match.\", \"code\": \"52\"}}"}'
85
+ string: ! '{"access_token":"e83b007f75ad49d480303f892de884204b7864bc817f0fb547c9d87444c39a75","scope":"contacts,userinfo,contact_assignment,followup_comments,roles,organization_info"}'
86
86
  http_version:
87
- recorded_at: Wed, 03 Oct 2012 22:38:07 GMT
87
+ recorded_at: Wed, 03 Oct 2012 23:28:06 GMT
88
88
  - request:
89
89
  method: post
90
90
  uri: http://www.missionhub.com/api/v2/contacts.json
91
91
  body:
92
92
  encoding: US-ASCII
93
- 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][2]=C3&answers[4954][3]=C4&org_id=5522&user_id=1615180&access_token=b08f825c2543643e561ba92b296028c4de2887a17179269c311ba680a96574d6
93
+ 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][2]=C3&answers[4954][3]=C4&org_id=5522&user_id=1615180&access_token=e83b007f75ad49d480303f892de884204b7864bc817f0fb547c9d87444c39a75
94
94
  headers: {}
95
95
  response:
96
96
  status:
@@ -100,7 +100,7 @@ http_interactions:
100
100
  Server:
101
101
  - nginx/1.0.14
102
102
  Date:
103
- - Wed, 03 Oct 2012 22:39:18 GMT
103
+ - Wed, 03 Oct 2012 23:29:23 GMT
104
104
  Content-Type:
105
105
  - application/json; charset=utf-8
106
106
  Transfer-Encoding:
@@ -114,22 +114,21 @@ http_interactions:
114
114
  X-Ua-Compatible:
115
115
  - IE=Edge,chrome=1
116
116
  Etag:
117
- - ! '"3dcdd09d5cbaecb64214082017b4217f"'
117
+ - ! '"74011cce4197da546e01a09a5e8ce450"'
118
118
  Cache-Control:
119
119
  - max-age=0, private, must-revalidate
120
120
  Set-Cookie:
121
- - _mh_session=442712f2622c96725ffa979ebf420216; path=/; expires=Fri, 05-Oct-2012
122
- 22:39:16 GMT; HttpOnly
123
- - logged_in=true; path=/
121
+ - _mh_session=09142d775c25a060139eb5fabbdf1320; path=/; expires=Fri, 05-Oct-2012
122
+ 23:28:37 GMT; HttpOnly
124
123
  X-Request-Id:
125
- - fc4796e6abe7872a110570a706b0bf12
124
+ - cd61e19dd9bcef433ad39e1e8e8b02a6
126
125
  X-Runtime:
127
- - '0.158785'
126
+ - '5.300431'
128
127
  X-Rack-Cache:
129
128
  - invalidate, pass
130
129
  body:
131
130
  encoding: US-ASCII
132
- string: ! '{"id":2592834,"name":"Test User","assignment":{"assigned_to_person":[],"person_assigned_to":[]},"gender":"female","request_org_id":5522,"organizational_roles":[]}'
131
+ string: ! '{"meta":{"request_time":1349306917},"id":"1050"}'
133
132
  http_version:
134
- recorded_at: Wed, 03 Oct 2012 22:38:08 GMT
133
+ recorded_at: Wed, 03 Oct 2012 23:28:13 GMT
135
134
  recorded_with: VCR 2.2.5
@@ -51,6 +51,18 @@ module MissionHub
51
51
  @current_address_attributes = address
52
52
  end
53
53
 
54
+ def phone
55
+ @phone_number[:number]
56
+ end
57
+
58
+ def phone=(phone)
59
+ unless phone.empty?
60
+ @phone_number = {:number => phone.gsub(/[^0-9]/, ""), :primary => 0, :location => "mobile"}
61
+ else
62
+ raise "Phone appears to be empty"
63
+ end
64
+ end
65
+
54
66
  def email_address
55
67
  @email_address[:email]
56
68
  end
@@ -93,7 +105,7 @@ module MissionHub
93
105
  self.instance_variables.each do |var|
94
106
  temp = self.instance_variable_get(var)
95
107
  if not temp.nil? and var.to_s != "@mx"
96
- if temp.kind_of? MissionHub::Person::Address or temp.kind_of? MissionHub::Person::Phone
108
+ if temp.kind_of? MissionHub::Person::Address
97
109
  hash_to_return[var.to_s.gsub("@","")] = temp.hash
98
110
  else
99
111
  hash_to_return[var.to_s.gsub("@","")] = temp
@@ -1,3 +1,3 @@
1
1
  module MissionHub
2
- VERSION = "1.0rc3"
2
+ VERSION = "1.0rc4"
3
3
  end
@@ -83,11 +83,7 @@ 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
- phone = MissionHub::Person::Phone.new
87
- phone.number = "021021021"
88
- phone.primary = 0
89
- phone.location = "mobile"
90
- person.phone = phone
86
+ person.phone = "021021021"
91
87
  response = api.create_person(person)
92
88
  response.must_be_instance_of Fixnum
93
89
  end
@@ -17,15 +17,9 @@ describe MissionHub::Person do
17
17
  end
18
18
 
19
19
  describe "Set Phone" do
20
- it "must throw exception when phone is wrong type" do
21
- phone_error = lambda { person.phone = '' }
22
- phone_error.must_raise RuntimeError
23
- end
24
-
25
20
  it "must be able to set phone" do
26
- phone = MissionHub::Person::Phone.new
27
- person.phone = phone
28
- person.phone.must_equal phone
21
+ person.phone = "078556821"
22
+ person.phone.must_equal "078556821"
29
23
  end
30
24
  end
31
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MissionHub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0rc3
4
+ version: 1.0rc4
5
5
  prerelease: 3
6
6
  platform: ruby
7
7
  authors: