doattend 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b430ff4f45048ed5826060285b2558271d07d9f6
4
- data.tar.gz: 6162cf7b437b8037da812bff7b464efbb5fc96f8
3
+ metadata.gz: 4002d28ae6dbafae05ef592835e2c429b300c74c
4
+ data.tar.gz: f1ee4c95a35f60544f5f17ffce1062573042ae2b
5
5
  SHA512:
6
- metadata.gz: 9c6c0b675729091b1ca9453f940776eafb6fb95238050d6c33c6c1d095ec3a0cde6590028be48cf463927bd0107315b0f294622995db8c837fd08a107ddaa77f
7
- data.tar.gz: fe830af5b2b57cce2eb87a8be8262894afd27507c83f517547f53e0b116011bb056313c3233e1cdf550d9fc0bace62052cf0dda87d523c85246dac9a606297fe
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
- @doattend = Doattend::Base.new # This loads the key and event that was generated from config/doattend.yml
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
- @doattend = Doattend::Base.new('YOUR_DOATTEND_EVENT_ID', 'YOUR_DOATTEND_API_KEY')
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
- @doattend.fetch
43
+ doattend.fetch
43
44
 
44
45
  #### Get total tickets
45
- @doattend.aggregate
46
+ doattend.aggregate
46
47
 
47
48
  #### Get ticket names/types used in an event
48
- @doattend.ticket.names
49
+ doattend.ticket.names
49
50
 
50
51
  #### Get total number of registrations for a ticket name/type
51
- @doattend.ticket.aggregate('ticket_type')
52
+ doattend.ticket.aggregate('ticket_type')
52
53
 
53
54
  Eg.:
54
- @doattend.ticket.aggregate(@doattend.ticket.names.first)
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Doattend
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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