polleverywhere 0.0.15 → 0.0.16

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.
data/.gitignore CHANGED
@@ -4,4 +4,5 @@
4
4
  .sass-cache
5
5
  Gemfile.lock
6
6
  pkg/*
7
- api/build/*
7
+ api/build/*
8
+ tmp/
@@ -73,9 +73,9 @@ module PollEverywhere # :nodoc
73
73
  # Poll is an abstract base class for multiple choice and free text polls
74
74
  class Poll
75
75
  include Serializable
76
-
76
+
77
77
  prop :id
78
-
78
+
79
79
  prop :updated_at do
80
80
  description %{The date and time the poll was last updated.}
81
81
  end
@@ -163,6 +163,13 @@ module PollEverywhere # :nodoc
163
163
  end
164
164
  end
165
165
 
166
+ def fetch
167
+ http.get.from(path).as(:json).response do |response|
168
+ from_json response.body
169
+ end
170
+ end
171
+
172
+
166
173
  def archive
167
174
  if persisted?
168
175
  http.delete.to(path + "/results/archive").response do |response|
@@ -220,6 +227,10 @@ module PollEverywhere # :nodoc
220
227
  prop :keyword do
221
228
  description "The keyword that's used to submit a response to the poll from participants that use SMS."
222
229
  end
230
+
231
+ def results=(results)
232
+ # no op
233
+ end
223
234
  end
224
235
 
225
236
  class MultipleChoicePoll < Poll
@@ -272,12 +283,6 @@ module PollEverywhere # :nodoc
272
283
  end
273
284
  end
274
285
 
275
- def fetch
276
- http.get.from(path).as(:json).response do |response|
277
- from_json response.body
278
- end
279
- end
280
-
281
286
  # Add the serialize options hash to the meix
282
287
  def to_hash
283
288
  hash = super
@@ -1,3 +1,3 @@
1
1
  module PollEverywhere
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -45,7 +45,7 @@ describe "API" do
45
45
  @gotten_mcp.title.should eql(@mcp.title)
46
46
  end
47
47
  end
48
-
48
+
49
49
  context "updates" do
50
50
  before(:all) do
51
51
  @mcp.title = "My pita bread is moldy"
@@ -56,7 +56,7 @@ describe "API" do
56
56
  it "should update options" do
57
57
  @mcp.options.first.value.should eql("MOLD SUCKS!")
58
58
  end
59
-
59
+
60
60
  it "should update title" do
61
61
  @mcp.title.should eql("My pita bread is moldy")
62
62
  end
@@ -88,5 +88,68 @@ describe "API" do
88
88
  end
89
89
  end
90
90
 
91
+ context "free text" do
92
+ before(:all) do
93
+ @ftp = PollEverywhere::FreeTextPoll.from_hash(:title => 'Got feedback?')
94
+ end
95
+
96
+ context "creation" do
97
+ before(:all) do
98
+ @ftp.save
99
+ end
100
+
101
+ it "should have id" do
102
+ @ftp.id.should_not be_nil
103
+ end
104
+
105
+ it "should have permalink" do
106
+ @ftp.permalink.should_not be_nil
107
+ end
108
+ end
109
+
110
+ context "get" do
111
+ it "should get poll" do
112
+ @gotten_ftp = PollEverywhere::FreeTextPoll.get(@ftp.permalink)
113
+ @gotten_ftp.title.should eql(@ftp.title)
114
+ end
115
+ end
116
+
117
+ context "updates" do
118
+ before(:all) do
119
+ @ftp.title = "My pita bread is moldy"
120
+ @ftp.save
121
+ end
122
+
123
+ it "should update title" do
124
+ @ftp.title.should eql("My pita bread is moldy")
125
+ end
126
+
127
+ it "should start" do
128
+ @ftp.start
129
+ @ftp.state.should eql("opened")
130
+ end
131
+
132
+ it "should stop" do
133
+ @ftp.stop
134
+ @ftp.state.should eql("closed")
135
+ end
136
+ end
137
+
138
+ it "should clear results" do
139
+ @ftp.save
140
+ @ftp.clear.should be_true
141
+ end
142
+
143
+ it "should archive results" do
144
+ @ftp.save
145
+ @ftp.archive.should be_true
146
+ end
147
+
148
+ it "should destroy" do
149
+ @ftp.destroy
150
+ @ftp.id.should be_nil
151
+ end
152
+ end
153
+
91
154
  end
92
155
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polleverywhere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
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: 2012-10-26 00:00:00.000000000Z
12
+ date: 2013-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -85,22 +85,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  - - ! '>='
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
- segments:
89
- - 0
90
- hash: 2541631176748140984
91
88
  required_rubygems_version: !ruby/object:Gem::Requirement
92
89
  none: false
93
90
  requirements:
94
91
  - - ! '>='
95
92
  - !ruby/object:Gem::Version
96
93
  version: '0'
97
- segments:
98
- - 0
99
- hash: 2541631176748140984
100
94
  requirements: []
101
95
  rubyforge_project: polleverywhere
102
- rubygems_version: 1.8.19
96
+ rubygems_version: 1.8.23
103
97
  signing_key:
104
98
  specification_version: 3
105
99
  summary: Integrate Poll Everywhere into your Ruby applications
106
- test_files: []
100
+ test_files:
101
+ - spec/integration/api_spec.rb
102
+ - spec/lib/models_spec.rb
103
+ - spec/lib/polleverywhere_spec.rb
104
+ - spec/lib/serializable_spec.rb
105
+ - spec/spec_helper.rb