rightnow-client 0.0.6

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.
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Rightnow::Models::User do
4
+ let(:user) { Rightnow::Models::User.new(data) }
5
+
6
+ context "from PostGet call" do
7
+ let(:data) { fixture('post_get.json', :json).underscore['post']['created_by'] }
8
+
9
+ it "should have correct attributes" do
10
+ user.hash.should == "45394358f2"
11
+ user.name.should == "Elsa"
12
+ user.avatar.should == "http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
13
+ end
14
+
15
+ it "should set api_uri" do
16
+ user.api_uri.should == "http://communityname.com/api/users/45394358f2"
17
+ end
18
+ end
19
+
20
+ context "from CommentList call" do
21
+ let(:data) { fixture('comment_list.json', :json).underscore['comments'].first['created_by'] }
22
+
23
+ it "should have correct attributes" do
24
+ user.guid.should == 35948
25
+ user.web_uri.should == "http://communityname.com/people/3e2ce69336"
26
+ user.api_uri.should == "http://communityname.com/api/users/3e2ce69336"
27
+ user.name.should == "Francoise ."
28
+ user.avatar.should == "http://communityname.com/common/images/avatars/user/default.jpg"
29
+ end
30
+
31
+ it "should guess hash from URI if not present" do
32
+ data['hash'].should be_nil
33
+ user.hash.should == "3e2ce69336"
34
+ end
35
+ end
36
+
37
+ context "from UserGet call" do
38
+ let(:data) { fixture('user_get.json', :json).underscore['user'] }
39
+
40
+ it "should have correct attributes" do
41
+ user.hash.should == "45394358f2"
42
+ user.guid.should == 21709
43
+ user.user_id.should == 19982
44
+ user.api_uri.should == "http://communityname.com/api/users/45394358f2"
45
+ user.name.should == "Elsa"
46
+ user.avatar.should == "http://communityname.com/files/b6eec94a24/mickey_plays_accordion.gif"
47
+ user.email.should == "elsa.foster-cg8p1qi@yopmail.com"
48
+ user.type.should == 6
49
+ user.status.should == 1
50
+ user.created_at.should == Time.utc(2012, 2, 18, 9, 49, 15)
51
+ user.last_login_at.should == Time.utc(2013, 1, 4, 6, 45, 16)
52
+ end
53
+
54
+ it "should have reputation fields" do
55
+ user.reputation.should be_instance_of(Rightnow::Models::Reputation)
56
+ user.reputation.level.should == "Intense User"
57
+ user.reputation.score.should == 122500
58
+ user.reputation.avatar.should == "/files/716841fe8c/icon_mem_intense.png"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,16 @@
1
+ require 'rightnow'
2
+ require 'webmock/rspec'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ end
7
+
8
+ # Simple helper loading fixture content and applying choosen parser
9
+ # ex:
10
+ # fixture('post.rb', :ruby) will eval the file as ruby code and return the last value
11
+ def fixture file, parser=nil
12
+ res = File.read("spec/fixtures/#{file}")
13
+ res = eval(res) if parser == :ruby
14
+ res = JSON.parse(res) if parser == :json
15
+ res
16
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rightnow-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adrien Jarthon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: virtus
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.5.3
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.5.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: typhoeus
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '2.6'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '2.6'
78
+ - !ruby/object:Gem::Dependency
79
+ name: webmock
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '1.8'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '1.8'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Rightnow API Ruby wrapper
111
+ email:
112
+ - adrien.jarthon@dimelo.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .travis.yml
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - lib/rightnow-client.rb
124
+ - lib/rightnow.rb
125
+ - lib/rightnow/client.rb
126
+ - lib/rightnow/error.rb
127
+ - lib/rightnow/ext/underscore.rb
128
+ - lib/rightnow/models/comment.rb
129
+ - lib/rightnow/models/field.rb
130
+ - lib/rightnow/models/post.rb
131
+ - lib/rightnow/models/reputation.rb
132
+ - lib/rightnow/models/user.rb
133
+ - lib/rightnow/version.rb
134
+ - rightnow.gemspec
135
+ - spec/client_spec.rb
136
+ - spec/fixtures/comment_add.json
137
+ - spec/fixtures/comment_list.json
138
+ - spec/fixtures/post.rb
139
+ - spec/fixtures/post_get.json
140
+ - spec/fixtures/search.json
141
+ - spec/fixtures/user_get.json
142
+ - spec/models/comment_spec.rb
143
+ - spec/models/field_spec.rb
144
+ - spec/models/post_spec.rb
145
+ - spec/models/user_spec.rb
146
+ - spec/spec_helper.rb
147
+ homepage: https://github.com/dimelo/rightnow
148
+ licenses: []
149
+ post_install_message:
150
+ rdoc_options: []
151
+ require_paths:
152
+ - lib
153
+ required_ruby_version: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ! '>='
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ requirements: []
166
+ rubyforge_project:
167
+ rubygems_version: 1.8.23
168
+ signing_key:
169
+ specification_version: 3
170
+ summary: Ruby wrapper for the Oracle Rightnow Social API v2
171
+ test_files:
172
+ - spec/client_spec.rb
173
+ - spec/fixtures/comment_add.json
174
+ - spec/fixtures/comment_list.json
175
+ - spec/fixtures/post.rb
176
+ - spec/fixtures/post_get.json
177
+ - spec/fixtures/search.json
178
+ - spec/fixtures/user_get.json
179
+ - spec/models/comment_spec.rb
180
+ - spec/models/field_spec.rb
181
+ - spec/models/post_spec.rb
182
+ - spec/models/user_spec.rb
183
+ - spec/spec_helper.rb