polleverywhere 0.0.5 → 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.
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ group :development, :test do
9
9
  gem 'growl'
10
10
  gem 'rspec'
11
11
  gem 'ruby-debug19'
12
+ gem 'rake'
12
13
  end
13
14
 
14
15
  group :api_docs do
@@ -85,4 +85,31 @@
85
85
 
86
86
  %h3 Delete a free text poll
87
87
  :example
88
- @ftp.destroy
88
+ @ftp.destroy
89
+
90
+ %h1 Participants
91
+ %p Participants are used to identify who is responding to your polls.
92
+
93
+ %h2 Attributes
94
+ %dl.attributes
95
+ %dt=PollEverywhere::Participant.root_key
96
+ %dd Root key for participant data.
97
+ %dd
98
+ %dl
99
+ -PollEverywhere::Participant.props.each do |_, prop|
100
+ %dt=prop.name
101
+ %dd=prop.description
102
+
103
+ %h2 Creating a new Participant
104
+ %p Specify the details of a new participant
105
+ :example
106
+ @participant = PollEverywhere::Participant.from_hash(:email => 'b.obama@whitehouse.gov', :first_name => 'Barack', :last_name => 'Obama', :password => 'mickeymouse', :responding_as => 'Barack').save
107
+
108
+ %h2 Updating participant details
109
+ :example
110
+ @participant.first_name = "President"
111
+ @participant.save
112
+
113
+ %h2 Delete a Participant
114
+ :example
115
+ @participant.destroy
@@ -1,5 +1,58 @@
1
1
  module PollEverywhere # :nodoc
2
2
  module Models # :nodoc
3
+ class Participant
4
+ include Serializable
5
+
6
+ root_key :user
7
+
8
+ prop :first_name
9
+
10
+ prop :last_name
11
+
12
+ prop :email
13
+
14
+ prop :phone_number do
15
+ description %{Phone number associated with the participant.}
16
+ end
17
+
18
+ prop :responding_as do
19
+ description %{This is used to identify the participant in reports.}
20
+ end
21
+
22
+ prop :password
23
+
24
+ attr_accessor :http
25
+
26
+ def initialize(http=PollEverywhere.http)
27
+ self.http = http
28
+ end
29
+
30
+ def save
31
+ http.put(to_json).as(:json).to(path).response do |response|
32
+ from_json response.body
33
+ end
34
+ end
35
+
36
+ def self.get(email)
37
+ from_hash(:email => email).fetch
38
+ end
39
+
40
+ def destroy
41
+ http.delete(path).response do |response|
42
+ end
43
+ end
44
+
45
+ def path
46
+ "/participants/#{email}"
47
+ end
48
+
49
+ def fetch
50
+ http.get.from(path).as(:json).response do |response|
51
+ from_json response.body
52
+ end
53
+ end
54
+ end
55
+
3
56
  # Poll is an abstract base class for multiple choice and free text polls
4
57
  class Poll
5
58
  include Serializable
@@ -1,3 +1,3 @@
1
1
  module PollEverywhere
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -8,8 +8,10 @@ module PollEverywhere
8
8
 
9
9
  # Lets make life easier for developers and provide shortcuts to module and class names.
10
10
  # PollEverywhere::Model::MultipleChoicePoll now becomes PollEverywhere::MCP. Cool eh? Thank me later.
11
+ Participant = Models::Participant
11
12
  MCP = MultipleChoicePoll = Models::MultipleChoicePoll
12
13
  FTP = FreeTextPoll = Models::FreeTextPoll
14
+
13
15
 
14
16
  def self.config(&block)
15
17
  @config ||= Configuration.new
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.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-03 00:00:00.000000000 -06:00
12
+ date: 2011-07-12 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
- requirement: &2156899600 !ruby/object:Gem::Requirement
17
+ requirement: &2156511940 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156899600
25
+ version_requirements: *2156511940
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rest-client
28
- requirement: &2156899080 !ruby/object:Gem::Requirement
28
+ requirement: &2156511340 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 1.6.3
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2156899080
36
+ version_requirements: *2156511340
37
37
  description: An easy way to integrate Poll Everywhere into your Ruby applications.
38
38
  email:
39
39
  - opensource@polleverywhere.com