viadeo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,10 +46,9 @@ module Viadeo
46
46
  @access_token = access_token
47
47
  add_accessors(values.keys)
48
48
  values.each do |k, v|
49
- @values[k] = Util.convert_to_graph_object(v, access_token)
49
+ @values[k] = v
50
50
  @updated_attributes.delete(k)
51
51
  end
52
- log("response : graph_object : ", self)
53
52
  self
54
53
  end
55
54
 
@@ -82,11 +81,15 @@ module Viadeo
82
81
  @values.each(&blk)
83
82
  end
84
83
 
84
+ def data_to_graph_object
85
+ Util.convert_to_graph_object(@values[:data], access_token)
86
+ end
87
+
85
88
  protected
86
89
 
87
90
  def log(message, arg=nil)
88
91
  message += " : " + arg.inspect if arg
89
- puts message
92
+ Viadeo.log message
90
93
  end
91
94
 
92
95
  def metaclass
@@ -1,3 +1,3 @@
1
1
  module Viadeo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -137,5 +137,27 @@ describe Viadeo::GraphObject do
137
137
  @graph_object.values.should be_empty
138
138
  end
139
139
  end
140
+ describe "#data_to_graph_object" do
141
+ before(:all) do
142
+ access_token = "access_token_test_3e8c55877482b2"
143
+ data_list = []
144
+ 1.upto(5) do |x|
145
+ data_list << {id: x, name: "contact#{x}", email: "contact#{x}@email.com"}
146
+ end
147
+ data = { id: "azertyazerty", name: "dupond", email: "dupond@example.com", data: data_list}
148
+ graph_object = Viadeo::GraphObject.new_from(data, access_token)
149
+ @data_graph_object = graph_object.data_to_graph_object
150
+ end
151
+
152
+ it "should return a list of GraphObject elements" do
153
+ @data_graph_object.each do |e|
154
+ e.should be_a_kind_of(Viadeo::GraphObject)
155
+ end
156
+ end
157
+
158
+ it "should have 5 elements" do
159
+ @data_graph_object.size.should eql(5)
160
+ end
161
+ end
140
162
  end
141
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viadeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
12
+ date: 2013-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 1.8.24
185
+ rubygems_version: 1.8.25
186
186
  signing_key:
187
187
  specification_version: 3
188
188
  summary: The Viadeo Graph API is a simple way to bring a professional social context