rightnow-client 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/Rakefile +6 -0
- data/lib/rightnow-client.rb +1 -0
- data/lib/rightnow.rb +11 -0
- data/lib/rightnow/client.rb +235 -0
- data/lib/rightnow/error.rb +12 -0
- data/lib/rightnow/ext/underscore.rb +16 -0
- data/lib/rightnow/models/comment.rb +32 -0
- data/lib/rightnow/models/field.rb +19 -0
- data/lib/rightnow/models/post.rb +58 -0
- data/lib/rightnow/models/reputation.rb +13 -0
- data/lib/rightnow/models/user.rb +44 -0
- data/lib/rightnow/version.rb +3 -0
- data/rightnow.gemspec +25 -0
- data/spec/client_spec.rb +197 -0
- data/spec/fixtures/comment_add.json +21 -0
- data/spec/fixtures/comment_list.json +120 -0
- data/spec/fixtures/post.rb +29 -0
- data/spec/fixtures/post_get.json +51 -0
- data/spec/fixtures/search.json +141 -0
- data/spec/fixtures/user_get.json +107 -0
- data/spec/models/comment_spec.rb +41 -0
- data/spec/models/field_spec.rb +14 -0
- data/spec/models/post_spec.rb +77 -0
- data/spec/models/user_spec.rb +61 -0
- data/spec/spec_helper.rb +16 -0
- metadata +183 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"id" => 58,
|
3
|
+
"hash" => "fa8e6cc713",
|
4
|
+
"webUrl" => "http://communityname.com/posts/fa8e6cc713",
|
5
|
+
"apiUrl" => "http://communityname.com/api/posts/fa8e6cc713",
|
6
|
+
"status" => 1,
|
7
|
+
"eventStart" => nil,
|
8
|
+
"eventEnd" => nil,
|
9
|
+
"eventTimeZone" => "",
|
10
|
+
"hiveId" => 72,
|
11
|
+
"postTypeId" => 109,
|
12
|
+
"postTypeName" => "White Page Tester",
|
13
|
+
"answerId" => nil,
|
14
|
+
"answerSelectedById" => nil,
|
15
|
+
"answerSelected" => nil,
|
16
|
+
"created" => 1250703211,
|
17
|
+
"createdById" => 2,
|
18
|
+
"createdByName" => "HiveLive Root User",
|
19
|
+
"createdByHash" => "xxyyzzoopp",
|
20
|
+
"createdByAvatar" => "http://communityname.com/common/images/avatars/user/default.jpg",
|
21
|
+
"lastActivity" => 1250703252,
|
22
|
+
"name" => "White Page Tester",
|
23
|
+
"commentCount" => 1,
|
24
|
+
"flagCount" => 0,
|
25
|
+
"viewCount" => 0,
|
26
|
+
"ratingCount" => 0,
|
27
|
+
"ratingTotal" => 0,
|
28
|
+
"preview" => "White Page Tester White Page Tester White Page ..."
|
29
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"post":{
|
3
|
+
"uri":"http://communityname.com/api/posts/81d3c4ebd8",
|
4
|
+
"postType":{
|
5
|
+
"uri":"http://communityname.com/api/hives/8054cbc1b4/types/97",
|
6
|
+
"name":"Onderwerp"
|
7
|
+
},
|
8
|
+
"created":1354694056,
|
9
|
+
"createdBy":{
|
10
|
+
"hash":"45394358f2",
|
11
|
+
"uri":"http://communityname.com/api/users/45394358f2",
|
12
|
+
"loginId":"45394358f2",
|
13
|
+
"name":"Elsa",
|
14
|
+
"avatar":"http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
|
15
|
+
},
|
16
|
+
"lastEdited":1355333163,
|
17
|
+
"lastEditedBy":{
|
18
|
+
"hash":"45394358f2",
|
19
|
+
"uri":"http://communityname.com/api/users/45394358f2",
|
20
|
+
"loginId":"45394358f2",
|
21
|
+
"name":"Elsa",
|
22
|
+
"avatar":"http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
|
23
|
+
},
|
24
|
+
"eventStart":"1970-01-01T00:00:00+00:00",
|
25
|
+
"eventEnd":"1970-01-01T00:00:00+00:00",
|
26
|
+
"eventTimeZone":"",
|
27
|
+
"title":"Decoder V4: firmware update Charles2_2.7.5.62 (04\/12\/12)",
|
28
|
+
"status":1,
|
29
|
+
"commentCount":65,
|
30
|
+
"viewCount":795,
|
31
|
+
"ratingCount":0,
|
32
|
+
"ratingTotal":0,
|
33
|
+
"flagCount":0,
|
34
|
+
"fields":
|
35
|
+
[{
|
36
|
+
"id":40695,
|
37
|
+
"postTypeField":{
|
38
|
+
"name":"Titel",
|
39
|
+
"type":1
|
40
|
+
},
|
41
|
+
"value":"Decoder V4: firmware update Charles2_2.7.5.62 (04\/12\/12)"
|
42
|
+
},{
|
43
|
+
"id":40696,
|
44
|
+
"postTypeField":{
|
45
|
+
"name":"Content",
|
46
|
+
"type":4
|
47
|
+
},
|
48
|
+
"value":"<h3>\r\n\t<a href=\"http:\/\/communityname.com\/posts\/81d3c4ebd8\"><span style=\"color: rgb(0, 0, 0);\">• <em>Decoder V4: firmware update Charles2_2.7.5.62 (04 dec 2012)<\/em><\/span><\/a><\/h3>\r\n<h4>\r\n\t<span style=\"color: red;\">zie ook ten gevolge van de nieuwe Charles software de bijgekomen Apps<br \/>\r\n\t <\/span><span style=\"color: rgb(0, 0, 0);\">•Klik Hier op onderstaand link; <span style=\"font-size: x-large;\">\u261e<\/span> <\/span> <a href=\"http:\/\/communityname.com\/comment\/92565\" target=\"_blank\"> apps op Belgacom TV <\/a><\/h4>\r\n<p>\r\n\t<a href=\"http:\/\/www.youtube.com\/watch?feature=player_embedded&v=ytBT9SRxAr0\" target=\"_blank\">Belgacom TV demo - Hoe de interactieve apps gebruiken ?<\/a><\/p>\r\n<p>\r\n\t <\/p>\r\n<p style=\"margin-left: 80px;\">\r\n\tvorige versie : <span style=\"color: rgb(0, 0, 0);\">• <strong><span style=\"font-size: x-large;\">\u261e<\/span><\/strong><\/span> <a href=\"http:\/\/communityname.com\/posts\/ddbdbfe4e7\/\">Decoder V4: firmware update Charles1_2.7.2.248 (25\/09\/12)<\/a><\/p>"
|
49
|
+
}]
|
50
|
+
}
|
51
|
+
}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
[{
|
2
|
+
"id":58,
|
3
|
+
"hash":"fa8e6cc713",
|
4
|
+
"webUrl":"http://communityname.com/posts/fa8e6cc713",
|
5
|
+
"apiUrl":"http://communityname.com/api/posts/fa8e6cc713",
|
6
|
+
"status":1,
|
7
|
+
"eventStart":null,
|
8
|
+
"eventEnd":null,
|
9
|
+
"eventTimeZone":"",
|
10
|
+
"hiveId":72,
|
11
|
+
"postTypeId":109,
|
12
|
+
"postTypeName":"White Page Tester",
|
13
|
+
"answerId":null,
|
14
|
+
"answerSelectedById":null,
|
15
|
+
"answerSelected":null,
|
16
|
+
"created":1250703211,
|
17
|
+
"createdById":2,
|
18
|
+
"createdByName":"HiveLive Root User",
|
19
|
+
"createdByHash":"xxyyzzoopp",
|
20
|
+
"createdByAvatar":"http://communityname.com/common/images/avatars/user/default.jpg",
|
21
|
+
"lastActivity":1250703252,
|
22
|
+
"name":"White Page Tester",
|
23
|
+
"commentCount":1,
|
24
|
+
"flagCount":0,
|
25
|
+
"viewCount":0,
|
26
|
+
"ratingCount":0,
|
27
|
+
"ratingTotal":0,
|
28
|
+
"preview":"White Page Tester White Page Tester White Page ..."
|
29
|
+
},{
|
30
|
+
"id":20256,
|
31
|
+
"hash":"58936ca115",
|
32
|
+
"webUrl":"http://communityname.com/posts/58936ca115",
|
33
|
+
"apiUrl":"http://communityname.com/api/posts/58936ca115",
|
34
|
+
"status":1,
|
35
|
+
"eventStart":null,
|
36
|
+
"eventEnd":null,
|
37
|
+
"eventTimeZone":"",
|
38
|
+
"hiveId":107,
|
39
|
+
"postTypeId":107,
|
40
|
+
"postTypeName":"Sujet",
|
41
|
+
"answerId":null,
|
42
|
+
"answerSelectedById":null,
|
43
|
+
"answerSelected":null,
|
44
|
+
"created":1355860477,
|
45
|
+
"createdById":34107,
|
46
|
+
"createdByName":"christophe .",
|
47
|
+
"createdByHash":"00590aa171",
|
48
|
+
"createdByAvatar":"http://communityname.com/common/images/avatars/user/default.jpg",
|
49
|
+
"lastActivity":1355937520,
|
50
|
+
"name":"nouveau client, pack maxi et que de d\u00e9ceptions !!!!!",
|
51
|
+
"commentCount":9,
|
52
|
+
"flagCount":0,
|
53
|
+
"viewCount":166,
|
54
|
+
"ratingCount":0,
|
55
|
+
"ratingTotal":0,
|
56
|
+
"preview":"\r\n\tLe 15 novembre je franchis le pas, et je décide de quitter scarlet pour belgacom\r\n\r\n\tla date est prévue pour le 14\/12 (ca au moins c'est fait dans les dates)\r\n\r\n\tN'ayant tjs..."
|
57
|
+
},{
|
58
|
+
"id":20265,
|
59
|
+
"hash":"12610a04ef",
|
60
|
+
"webUrl":"http://communityname.com/posts/12610a04ef",
|
61
|
+
"apiUrl":"http://communityname.com/api/posts/12610a04ef",
|
62
|
+
"status":1,
|
63
|
+
"eventStart":null,
|
64
|
+
"eventEnd":null,
|
65
|
+
"eventTimeZone":"",
|
66
|
+
"hiveId":108,
|
67
|
+
"postTypeId":107,
|
68
|
+
"postTypeName":"Sujet",
|
69
|
+
"answerId":null,
|
70
|
+
"answerSelectedById":null,
|
71
|
+
"answerSelected":null,
|
72
|
+
"created":1355937016,
|
73
|
+
"createdById":34148,
|
74
|
+
"createdByName":"Laura .",
|
75
|
+
"createdByHash":"9a7ffb9009",
|
76
|
+
"createdByAvatar":"http://communityname.com/common/images/avatars/user/default.jpg",
|
77
|
+
"lastActivity":1355937017,
|
78
|
+
"name":"Concernant les frais unique",
|
79
|
+
"commentCount":0,
|
80
|
+
"flagCount":0,
|
81
|
+
"viewCount":4,
|
82
|
+
"ratingCount":0,
|
83
|
+
"ratingTotal":0,
|
84
|
+
"preview":"\r\n\tBonjour, \r\n\r\n\tVoilà j'ai reçu ma facture et j'ai eu 39euro de frais unique c'est à dire 9euro frais de rappel, alors qu'a la facture..."
|
85
|
+
},{
|
86
|
+
"id":20003,
|
87
|
+
"hash":"81d3c4ebd8",
|
88
|
+
"webUrl":"http://communityname.com/posts/81d3c4ebd8",
|
89
|
+
"apiUrl":"http://communityname.com/api/posts/81d3c4ebd8",
|
90
|
+
"status":1,
|
91
|
+
"eventStart":null,
|
92
|
+
"eventEnd":null,
|
93
|
+
"eventTimeZone":"",
|
94
|
+
"hiveId":101,
|
95
|
+
"postTypeId":97,
|
96
|
+
"postTypeName":"Onderwerp",
|
97
|
+
"answerId":null,
|
98
|
+
"answerSelectedById":null,
|
99
|
+
"answerSelected":null,
|
100
|
+
"created":1354694056,
|
101
|
+
"createdById":19982,
|
102
|
+
"createdByName":"Elsa",
|
103
|
+
"createdByHash":"45394358f2",
|
104
|
+
"createdByAvatar":"http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif",
|
105
|
+
"lastActivity":1355935000,
|
106
|
+
"name":"Decoder V4: firmware update Charles2_2.7.5.62 (04\/12\/12)",
|
107
|
+
"commentCount":65,
|
108
|
+
"flagCount":0,
|
109
|
+
"viewCount":795,
|
110
|
+
"ratingCount":0,
|
111
|
+
"ratingTotal":0,
|
112
|
+
"preview":"\r\n\t• Decoder V4: firmware update Charles2_2.7.5.62 (04 dec 2012)\r\n\r\n\tzie ook ten gevolge van de nieuwe Charles software de bijgekomen..."
|
113
|
+
},{
|
114
|
+
"id":20264,
|
115
|
+
"hash":"eac2da670b",
|
116
|
+
"webUrl":"http://communityname.com/posts/eac2da670b",
|
117
|
+
"apiUrl":"http://communityname.com/api/posts/eac2da670b",
|
118
|
+
"status":1,
|
119
|
+
"eventStart":null,
|
120
|
+
"eventEnd":null,
|
121
|
+
"eventTimeZone":"",
|
122
|
+
"hiveId":107,
|
123
|
+
"postTypeId":107,
|
124
|
+
"postTypeName":"Sujet",
|
125
|
+
"answerId":null,
|
126
|
+
"answerSelectedById":null,
|
127
|
+
"answerSelected":null,
|
128
|
+
"created":1355933561,
|
129
|
+
"createdById":7547,
|
130
|
+
"createdByName":"Julien86",
|
131
|
+
"createdByHash":"ef4afe2089",
|
132
|
+
"createdByAvatar":"http://communityname.com/common/images/avatars/user/default.jpg",
|
133
|
+
"lastActivity":1355933561,
|
134
|
+
"name":"Modifiaction de pack annulation",
|
135
|
+
"commentCount":0,
|
136
|
+
"flagCount":0,
|
137
|
+
"viewCount":13,
|
138
|
+
"ratingCount":0,
|
139
|
+
"ratingTotal":0,
|
140
|
+
"preview":"\r\n\tBonjour , \r\n\r\n\tJ'ai modifié hier mon pack pour passer de maxi à confort, je voulais savoir comment est-ce que je pouvais annuler cette demande ?\r\n\r\n\tPar les e-services ?..."
|
141
|
+
}]
|
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
{ "user": {
|
3
|
+
"hash":"45394358f2",
|
4
|
+
"uri":"http://communityname.com/api/users/45394358f2",
|
5
|
+
"loginId":"45394358f2",
|
6
|
+
"userId":19982,
|
7
|
+
"name":"Elsa",
|
8
|
+
"avatar":"http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif",
|
9
|
+
"email":"elsa.foster-cg8p1qi@yopmail.com",
|
10
|
+
"type":"6",
|
11
|
+
"status":"1",
|
12
|
+
"guid":"21709",
|
13
|
+
"created":"1329558555",
|
14
|
+
"lastLogin":"1357281916",
|
15
|
+
"buddyCount":"1",
|
16
|
+
"groupCount":"0",
|
17
|
+
"hiveCount":"0",
|
18
|
+
"postCount":"53",
|
19
|
+
"commentCount":"5929",
|
20
|
+
"commentsSelectedAsBestAnswerCount":"2",
|
21
|
+
"reputation": {
|
22
|
+
"level":"Intense User",
|
23
|
+
"score":"122500",
|
24
|
+
"avatar":"/files/716841fe8c/icon_mem_intense.png"
|
25
|
+
},
|
26
|
+
"groupsSummary": {
|
27
|
+
"total":"0",
|
28
|
+
"owned":"0",
|
29
|
+
"admin":"0",
|
30
|
+
"member":"0",
|
31
|
+
"moderator":"0",
|
32
|
+
"builder":"0",
|
33
|
+
"listed":"0"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"postsSummary": {
|
37
|
+
"total":"53",
|
38
|
+
"listed":"3",
|
39
|
+
"posts": [
|
40
|
+
{"webUrl":"http://communityname.com/posts/3cd203b776",
|
41
|
+
"apiUrl":"http://communityname.com/api/groups/3cd203b776",
|
42
|
+
"title":"Nieuws & persberichten"},
|
43
|
+
{"webUrl":"http://communityname.com/posts/41aaafa142",
|
44
|
+
"apiUrl":"http://communityname.com/api/groups/41aaafa142",
|
45
|
+
"title":"Teletekst"},
|
46
|
+
{"webUrl":"http://communityname.com/posts/81d3c4ebd8",
|
47
|
+
"apiUrl":"http://communityname.com/api/groups/81d3c4ebd8",
|
48
|
+
"title":"Decoder V4: firmware update Charles2_2.7.5.62 (04\/12\/12)"}
|
49
|
+
]
|
50
|
+
},
|
51
|
+
"commentsSummary": {
|
52
|
+
"total":"5929",
|
53
|
+
"listed":"3",
|
54
|
+
"comments":[
|
55
|
+
{"webUrl":"http://communityname.com/posts/afc39b51a9#95775",
|
56
|
+
"apiUrl":"http://communityname.com/api/comments/95775",
|
57
|
+
"value":"<p>\r\n\tJe kan inloggen als "admin" => http:\/\/192.168.1.1\/index.cgi?user_name=admin&password=LKXXXXXDPXXXXXX<\/p>\r\n<p>\r\n\ten als "user" => http:\/\/192.168.1.1\/index.cgi?user_name=user&password=LKXXXXXDPXXXXX<\/p>\r\n<p>\r\n\t<br \/>\r\n\tbij inloggen op http:\/\/192.168.1.1 wordt SerieNr. gevraagd<\/p>\r\n<p>\r\n\tLKXXXXXDPXXXXXX bevindt zich op de sticker van de BBOX2<\/p>\r\n<p>\r\n\tje kan ook een shortcut op je bureaublad maken :<\/p>\r\n<p>\r\n\t- create a new schortcut to desktop by right clicking and put one of this links above into the input field<br \/>\r\n\t click next and put in the input field for example :<br \/>\r\n\t" BBOX2 Admin Login "<br \/>\r\n\tand click finish<\/p>\r\n<p>\r\n\tDit vind je allemaal op ricy's blog <a href=\"http:\/\/bgctv.skynetblogs.be\/#bbox2firmwareversies\">hier<\/a> (en nog veel meer)<\/p>\r\n<p>\r\n\tgrtjs, Elsa<br \/>\r\n\t <\/p>\r\n<p>\r\n\t <\/p>\r\n<p>\r\n\t <\/p>"
|
58
|
+
},
|
59
|
+
{"webUrl":"http://communityname.com/posts/7c59ca3065#95771",
|
60
|
+
"apiUrl":"http://communityname.com/api/comments/95771",
|
61
|
+
"value":"<p>\r\n\tAls je wilt kontroleren of alles goed aangesloten is kijk dan eens op ricy's blog <a href=\"http:\/\/bgctv.skynetblogs.be\/#vdsl2splitterbeschrijving\">hier<\/a><\/p>\r\n<p>\r\n\t( daar vind je ook de uitleg over <a href=\"http:\/\/bgctv.skynetblogs.be\/#vdsl2vectoring\">vectoring<\/a> maar dit heeft niks met je probleem te maken)<\/p>\r\n<p>\r\n\tdaar staat oa ook de link <a href=\"http:\/\/communityname.com\/files\/05a64d8aef\/InstallguideVDSL2_NL.pdf\"><font color=\"#0066cc\">Installatiegids VDSL2<\/font><\/a><\/p>\r\n<p>\r\n\tgroetjes, Elsa <\/p>"
|
62
|
+
},
|
63
|
+
{"webUrl":"http://communityname.com/posts/81d3c4ebd8#95762",
|
64
|
+
"apiUrl":"http://communityname.com/api/comments/95762",
|
65
|
+
"value":"<p>\r\n\tDat is nog iets anders want dit heeft natuurlijk niks met HDMI charles bug te zien want dat even wegzappen en terug in orde komen is nog een andere bug in Charles en het is nog straffer het problmeem HDMI Charles bug valt niet bij alle LCD TV types voor, zo bijvoorbeeld heb ik het nog nooit voorgehad zelf niet van in de eerste release van Charles1 tot de laatste van Charles1 ook niet want je kan bij het bekende fenomeen van de charles bug ivm HDMI dit niet in orde krijgen door te zappen.<\/p>\r\n<p>\r\n\tHet is gewoon wachten op een nieuwe release van Charles ! en dan is het nog afwwachten of alle problemen zulle verdwenen zijn.<\/p>\r\n<p>\r\n\tgrtjs, Elsa<\/p>"
|
66
|
+
}
|
67
|
+
]
|
68
|
+
},
|
69
|
+
"profile": {
|
70
|
+
"lastEdited":"1348411371",
|
71
|
+
"lastEditedBy": {
|
72
|
+
"uri":"http://communityname.com/api/users/45394358f2",
|
73
|
+
"hash":"45394358f2"
|
74
|
+
},
|
75
|
+
"fields": [{
|
76
|
+
"id":8048,
|
77
|
+
"profileTypeField":{
|
78
|
+
"name":"Voornaam",
|
79
|
+
"type":1},
|
80
|
+
"value":"Elsa"},{
|
81
|
+
"id":11716,
|
82
|
+
"profileTypeField":{
|
83
|
+
"name":"Naam",
|
84
|
+
"type":1},
|
85
|
+
"value":"Foster"},{
|
86
|
+
"id":11717,
|
87
|
+
"profileTypeField":{
|
88
|
+
"name":"Taal",
|
89
|
+
"type":300},
|
90
|
+
"value":"Dutch Nederlandish Holland"},{
|
91
|
+
"id":11719,
|
92
|
+
"profileTypeField":{
|
93
|
+
"name":"Geboortedatum",
|
94
|
+
"type":400},
|
95
|
+
"value":"25\/12\/1975"},{
|
96
|
+
"id":11718,
|
97
|
+
"profileTypeField":{
|
98
|
+
"name":"Geweest\/Provincie",
|
99
|
+
"type":300},
|
100
|
+
"value":"Vlaams-Brabant"},{
|
101
|
+
"id":11720,
|
102
|
+
"profileTypeField":{
|
103
|
+
"name":"Postcode (priv\u00e9)",
|
104
|
+
"type":1},
|
105
|
+
"value":"1850"}
|
106
|
+
]
|
107
|
+
}}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rightnow::Models::Comment do
|
4
|
+
let(:comment) { Rightnow::Models::Comment.new(data) }
|
5
|
+
|
6
|
+
context "from CommentList call" do
|
7
|
+
let(:data) { fixture('comment_list.json', :json).underscore['comments'].first }
|
8
|
+
|
9
|
+
it "should have correct attributes" do
|
10
|
+
comment.id.should == 94224
|
11
|
+
comment.parent_id.should == nil
|
12
|
+
comment.uri.should == "http://communityname.com/api/comments/94224"
|
13
|
+
comment.status.should == 1
|
14
|
+
comment.created_at.should == Time.utc(2012, 12, 17, 17, 24, 8)
|
15
|
+
comment.last_edited_at.should == Time.utc(2012, 12, 17, 17, 24, 8)
|
16
|
+
comment.rating_count.should == 0
|
17
|
+
comment.rating_value_total.should == 0
|
18
|
+
comment.rating_weighted.should == 0
|
19
|
+
comment.flagged_count.should == 0
|
20
|
+
comment.value.should =~ /impossible d'avoir/
|
21
|
+
end
|
22
|
+
|
23
|
+
it "stores creator as user" do
|
24
|
+
comment.created_by.should be_instance_of(Rightnow::Models::User)
|
25
|
+
comment.created_by.guid.should == 35948
|
26
|
+
comment.created_by.api_uri.should == "http://communityname.com/api/users/3e2ce69336"
|
27
|
+
comment.created_by.name.should == "Francoise ."
|
28
|
+
comment.created_by.avatar.should == "http://communityname.com/common/images/avatars/user/default.jpg"
|
29
|
+
comment.created_by.hash.should == "3e2ce69336"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "stores last editor as user" do
|
33
|
+
comment.last_edited_by.should be_instance_of(Rightnow::Models::User)
|
34
|
+
comment.last_edited_by.api_uri.should == "http://communityname.com/api/users/3e2ce69336"
|
35
|
+
comment.last_edited_by.guid.should == 35948
|
36
|
+
comment.last_edited_by.name.should == "Francoise ."
|
37
|
+
comment.last_edited_by.avatar.should == "http://communityname.com/common/images/avatars/user/default.jpg"
|
38
|
+
comment.last_edited_by.hash.should == "3e2ce69336"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rightnow::Models::Field do
|
4
|
+
let(:field) { Rightnow::Models::Field.new(data.underscore) }
|
5
|
+
let(:data) { { "id" => 40695, "postTypeField" => {"name" => "Titel", "type" => 1}, "value" => "Value"} }
|
6
|
+
|
7
|
+
it "creates with correct values" do
|
8
|
+
field.id.should == 40695
|
9
|
+
field.value.should == "Value"
|
10
|
+
field.name.should == "Titel"
|
11
|
+
field.type.should == 1
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rightnow::Models::Post do
|
4
|
+
let(:post) { Rightnow::Models::Post.new(data) }
|
5
|
+
|
6
|
+
context "from search result" do
|
7
|
+
let(:data) { fixture('post.rb', :ruby).underscore }
|
8
|
+
|
9
|
+
it "stores search attributes correctly" do
|
10
|
+
post.id.should == 58
|
11
|
+
post.hash.should == "fa8e6cc713"
|
12
|
+
post.web_url.should == "http://communityname.com/posts/fa8e6cc713"
|
13
|
+
post.hive_id.should == 72
|
14
|
+
post.created.should == 1250703211
|
15
|
+
post.created_at.should == Time.utc(2009, 8, 19, 17, 33, 31)
|
16
|
+
post.last_activity_at.should == Time.utc(2009, 8, 19, 17, 34, 12)
|
17
|
+
post.preview.should =~ /White Page Tester/
|
18
|
+
post.post_type.should == {'id' => 109}
|
19
|
+
post.answer_id.should be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "from PostGet call" do
|
24
|
+
let(:data) { fixture('post_get.json', :json).underscore['post'] }
|
25
|
+
|
26
|
+
it "stores detailed attributes correctly" do
|
27
|
+
post.uri.should == "http://communityname.com/api/posts/81d3c4ebd8"
|
28
|
+
post.post_type.should == {'uri' => "http://communityname.com/api/hives/8054cbc1b4/types/97", 'name' => 'Onderwerp'}
|
29
|
+
post.created.should == 1354694056
|
30
|
+
post.last_edited.should == 1355333163
|
31
|
+
post.event_start.should == Time.at(0)
|
32
|
+
post.event_end.should == Time.at(0)
|
33
|
+
post.event_time_zone.should == ""
|
34
|
+
post.title.should == "Decoder V4: firmware update Charles2_2.7.5.62 (04\/12\/12)"
|
35
|
+
post.status.should == 1
|
36
|
+
post.comment_count.should == 65
|
37
|
+
post.view_count.should == 795
|
38
|
+
post.rating_count.should == 0
|
39
|
+
post.rating_total.should == 0
|
40
|
+
post.flag_count.should == 0
|
41
|
+
end
|
42
|
+
|
43
|
+
it "stores creator as user" do
|
44
|
+
post.created_by.should be_instance_of(Rightnow::Models::User)
|
45
|
+
post.created_by.hash.should == "45394358f2"
|
46
|
+
post.created_by.api_uri.should == "http://communityname.com/api/users/45394358f2"
|
47
|
+
post.created_by.login_id.should == "45394358f2"
|
48
|
+
post.created_by.name.should == "Elsa"
|
49
|
+
post.created_by.avatar.should == "http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "stores last editor as user" do
|
53
|
+
post.last_edited_by.should be_instance_of(Rightnow::Models::User)
|
54
|
+
post.last_edited_by.hash.should == "45394358f2"
|
55
|
+
post.last_edited_by.api_uri.should == "http://communityname.com/api/users/45394358f2"
|
56
|
+
post.last_edited_by.login_id.should == "45394358f2"
|
57
|
+
post.last_edited_by.name.should == "Elsa"
|
58
|
+
post.last_edited_by.avatar.should == "http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "stores fields details" do
|
62
|
+
post.fields.should have(2).items
|
63
|
+
# Title
|
64
|
+
post.fields.first.should be_instance_of(Rightnow::Models::Field)
|
65
|
+
post.fields.first.id.should == 40695
|
66
|
+
post.fields.first.value.should =~ /Decoder V4/
|
67
|
+
post.fields.first.name.should == "Titel"
|
68
|
+
post.fields.first.type.should == 1
|
69
|
+
# Content
|
70
|
+
post.fields.last.should be_instance_of(Rightnow::Models::Field)
|
71
|
+
post.fields.last.id.should == 40696
|
72
|
+
post.fields.last.value.should =~ /gevolge van de nieuwe/
|
73
|
+
post.fields.last.name.should == "Content"
|
74
|
+
post.fields.last.type.should == 4
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|