doattend 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -7
- data/lib/doattend/base.rb +6 -0
- data/lib/doattend/participant.rb +24 -0
- data/lib/doattend/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4002d28ae6dbafae05ef592835e2c429b300c74c
|
4
|
+
data.tar.gz: f1ee4c95a35f60544f5f17ffce1062573042ae2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9fd3f9fc03f9d2f498b3c3b83c2e40fa5415dc486e9c907c2046f3d1c61d35c08e334a731d3153f53a6828cc7a3af7795acef92f151b71cf76c726c6be6c43
|
7
|
+
data.tar.gz: d843d0e2bc51af171d8a1200cc3b51b023c0cfadf195503c1a9e62d3ab43c6f97407ce80f0e578bbda15b2bb42b09f56c1af590bb15d005a8b77b1f030fc62a2
|
data/README.md
CHANGED
@@ -31,27 +31,35 @@ If you are not using Rails you can use require to include it:
|
|
31
31
|
|
32
32
|
## Getting Started
|
33
33
|
Rails Way:
|
34
|
-
|
34
|
+
doattend = Doattend::Base.new # This loads the key and event that was generated from config/doattend.yml
|
35
35
|
|
36
36
|
Non-Rails Way:
|
37
|
-
|
37
|
+
doattend = Doattend::Base.new('YOUR_DOATTEND_EVENT_ID', 'YOUR_DOATTEND_API_KEY')
|
38
38
|
|
39
39
|
|
40
40
|
## Methods
|
41
|
+
### Tickets
|
41
42
|
#### Fetch all data from DoAttend
|
42
|
-
|
43
|
+
doattend.fetch
|
43
44
|
|
44
45
|
#### Get total tickets
|
45
|
-
|
46
|
+
doattend.aggregate
|
46
47
|
|
47
48
|
#### Get ticket names/types used in an event
|
48
|
-
|
49
|
+
doattend.ticket.names
|
49
50
|
|
50
51
|
#### Get total number of registrations for a ticket name/type
|
51
|
-
|
52
|
+
doattend.ticket.aggregate('ticket_type')
|
52
53
|
|
53
54
|
Eg.:
|
54
|
-
|
55
|
+
doattend.ticket.aggregate(doattend.ticket.names.first)
|
56
|
+
|
57
|
+
### Participants
|
58
|
+
#### Pluck a field from all all participants
|
59
|
+
doattend.participant.pluck('FIELD_NAME')
|
60
|
+
|
61
|
+
Eg.:
|
62
|
+
doattend.participant.plcuk('Gender')
|
55
63
|
|
56
64
|
## Contributing
|
57
65
|
|
data/lib/doattend/base.rb
CHANGED
@@ -2,6 +2,7 @@ require "rest-client"
|
|
2
2
|
require "json"
|
3
3
|
|
4
4
|
require_relative "ticket.rb"
|
5
|
+
require_relative "participant.rb"
|
5
6
|
|
6
7
|
module Doattend
|
7
8
|
|
@@ -41,6 +42,11 @@ module Doattend
|
|
41
42
|
Doattend::Ticket.new(self.result['participants'])
|
42
43
|
end
|
43
44
|
|
45
|
+
# Use methods of Participant class.
|
46
|
+
def participant
|
47
|
+
Doattend::Participant.new(self.result['participants'])
|
48
|
+
end
|
49
|
+
|
44
50
|
end
|
45
51
|
|
46
52
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Doattend
|
2
|
+
|
3
|
+
class Participant
|
4
|
+
|
5
|
+
attr_accessor :result, :info, :general_info
|
6
|
+
|
7
|
+
def initialize(result)
|
8
|
+
self.result = result
|
9
|
+
#self.info = result['participant_information']
|
10
|
+
self.general_info = ['Ticket_Number', 'Email', 'Date', 'Name']
|
11
|
+
end
|
12
|
+
|
13
|
+
# Pluck a particular field from participants
|
14
|
+
def pluck(field)
|
15
|
+
if self.general_info.include? field
|
16
|
+
self.result.map{ |p| p[field] }
|
17
|
+
else
|
18
|
+
self.result.map{ |p| p['participant_information'].select{ |a| a['desc'] == field } }.flatten.map{ |x| x['info'] }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/doattend/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doattend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swaroop SM
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- Rakefile
|
93
93
|
- lib/doattend/ticket.rb
|
94
94
|
- lib/doattend/version.rb
|
95
|
+
- lib/doattend/participant.rb
|
95
96
|
- lib/doattend/base.rb
|
96
97
|
- lib/generators/doattend/install/USAGE
|
97
98
|
- lib/generators/doattend/install/templates/doattend.erb
|