the-city-admin 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +2 -0
- data/.pryrc +3 -0
- data/.rspec +1 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +6 -3
- data/Gemfile.lock +58 -28
- data/README.rdoc +4 -1
- data/examples/barcodes_checkins.rb +37 -14
- data/lib/api/checkin.rb +1 -1
- data/lib/api/checkin_list.rb +0 -1
- data/lib/api/checkin_list_by_callboard_number.rb +61 -0
- data/lib/api/checkin_list_by_pager_number.rb +61 -0
- data/lib/api/group_checkin.rb +13 -2
- data/lib/api/group_checkin_event.rb +24 -0
- data/lib/api/group_checkin_events_list.rb +64 -0
- data/lib/api/group_checkin_list.rb +2 -2
- data/lib/readers/api_reader.rb +9 -2
- data/lib/readers/checkin_list_by_callboard_number_reader.rb +27 -0
- data/lib/readers/checkin_list_by_pager_number_reader.rb +27 -0
- data/lib/readers/checkin_list_reader.rb +2 -2
- data/lib/readers/group_checkin_events_list_reader.rb +28 -0
- data/lib/readers/group_checkin_reader.rb +32 -0
- data/lib/readers/group_list_reader.rb +0 -1
- data/spec/api/checkin_list_by_callboard_number_spec.rb +91 -0
- data/spec/api/checkin_list_by_pager_number_spec.rb +98 -0
- data/spec/api/checkin_list_spec.rb +91 -0
- data/spec/api/group_address_list_spec.rb +1 -1
- data/spec/api/group_address_spec.rb +2 -3
- data/spec/api/group_checkin_events_list_spec.rb +91 -0
- data/spec/api/group_checkin_list_spec.rb +1 -1
- data/spec/api/group_checkin_spec.rb +12 -0
- data/spec/api/group_event_attendance_list_spec.rb +1 -1
- data/spec/api/group_export_spec.rb +1 -5
- data/spec/api/group_invitation_list_spec.rb +6 -6
- data/spec/api/group_invitation_spec.rb +1 -5
- data/spec/api/group_list_spec.rb +72 -7
- data/spec/api/group_role_list_spec.rb +6 -6
- data/spec/api/group_role_spec.rb +1 -5
- data/spec/api/group_spec.rb +1 -5
- data/spec/api/group_tag_list_spec.rb +6 -6
- data/spec/api/group_tag_spec.rb +1 -5
- data/spec/api/metric_list_spec.rb +6 -6
- data/spec/api/metric_measurement_list_spec.rb +6 -6
- data/spec/api/metric_measurement_spec.rb +2 -2
- data/spec/api/metric_spec.rb +2 -2
- data/spec/api/role_list_spec.rb +1 -1
- data/spec/api/role_spec.rb +2 -2
- data/spec/api/skill_list_spec.rb +1 -1
- data/spec/api/skilled_user_id_list_spec.rb +1 -1
- data/spec/api/skilled_user_list_spec.rb +1 -1
- data/spec/api/tag_group_list_spec.rb +1 -1
- data/spec/api/tag_list_spec.rb +1 -1
- data/spec/api/tag_spec.rb +2 -2
- data/spec/api/terminology_list_spec.rb +1 -1
- data/spec/api/terminology_spec.rb +2 -2
- data/spec/api/user_address_list_spec.rb +1 -1
- data/spec/api/user_address_spec.rb +2 -2
- data/spec/api/user_admin_privilege_list_spec.rb +1 -1
- data/spec/api/user_admin_privilege_spec.rb +2 -2
- data/spec/api/user_barcode_spec.rb +2 -2
- data/spec/api/user_family_list_spec.rb +1 -1
- data/spec/api/user_family_member_spec.rb +2 -2
- data/spec/api/user_invitation_list_spec.rb +1 -1
- data/spec/api/user_invitation_spec.rb +2 -2
- data/spec/api/user_list_spec.rb +1 -1
- data/spec/api/user_note_list_spec.rb +1 -1
- data/spec/api/user_note_spec.rb +2 -2
- data/spec/api/user_process_answer_list_spec.rb +1 -1
- data/spec/api/user_process_list_spec.rb +1 -1
- data/spec/api/user_process_spec.rb +2 -2
- data/spec/api/user_role_list_spec.rb +1 -1
- data/spec/api/user_role_spec.rb +2 -2
- data/spec/api/user_skill_list_spec.rb +1 -1
- data/spec/api/user_skill_spec.rb +2 -2
- data/spec/api/user_spec.rb +1 -2
- data/spec/api/web_hook_list_spec.rb +1 -1
- data/spec/api/web_hook_spec.rb +2 -2
- data/spec/factories/group_checkin_event.rb +20 -0
- data/spec/factories/group_checkin_events_list.rb +14 -0
- data/spec/factories/group_list.rb +13 -0
- data/spec/functional/the_city_admin_spec.rb +5 -5
- data/spec/readers/api_reader_spec.rb +3 -5
- data/spec/readers/user_reader_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -7
- data/thecity_admin_api.gemspec +6 -5
- metadata +51 -8
- data/.autotest +0 -9
- data/.rvmrc +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzE0NmI4NWUyMjA0NDc5YTA3YWU0YTJmZmUwMjAzOWFlNDZmN2UwYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTFjOGI0OTA2MmQ5NDk0NzY1NjQ0Mzc2MmFhYzk5MDhmYmRlYjBiMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWIzNzVjZGUyNTFkNDgyMjRjOWQwZGUyYmEyZDExM2QzYTUxMWU4ZjE4OTZi
|
10
|
+
ZDI4MDlmZmQ3MzUxZjEwNDYwZjI2YWMwOGY1MmFlNWM3ODA0ZTE2M2VkMTk5
|
11
|
+
NjIwNDNlNTdhMmQwM2EzNTM5ZDI1NjU1ZjgwOTQyYjVkNmNlNmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmExMmQ2YmQyZmNiYzc1ZTk4ODJlYzE5NDM4YzIyZjlhODJmOWE2YjIwOThj
|
14
|
+
NmNmYTBkZGVhYWUyYWI5YzllMmM1NWZiYzZlY2U1MjQ0ZWY3ZjI3NWZiMWE1
|
15
|
+
NmNhNjNlZGE2ZjViOTYyNTFiNDFhYWZkYTlhNGNhNDVjMTRkODc=
|
data/.gitignore
CHANGED
data/.pryrc
ADDED
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format progress
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
admin-api
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p545
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
gem 'json'
|
3
|
+
gemspec
|
5
4
|
|
6
5
|
group :development, :test do
|
6
|
+
gem 'rake'
|
7
7
|
gem 'rspec'
|
8
|
-
gem '
|
8
|
+
gem 'pry'
|
9
|
+
gem 'pry-nav'
|
9
10
|
gem 'factory_girl'
|
11
|
+
gem 'simplecov', :require => false
|
12
|
+
gem 'coveralls', :require => false
|
10
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,52 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
the-city-admin (0.7.1)
|
5
|
+
json
|
6
|
+
typhoeus (= 0.6.6)
|
7
|
+
|
1
8
|
GEM
|
2
9
|
remote: http://rubygems.org/
|
3
10
|
specs:
|
4
|
-
activesupport (4.0
|
5
|
-
i18n (~> 0.6, >= 0.6.
|
6
|
-
|
7
|
-
|
11
|
+
activesupport (4.1.0)
|
12
|
+
i18n (~> 0.6, >= 0.6.9)
|
13
|
+
json (~> 1.7, >= 1.7.7)
|
14
|
+
minitest (~> 5.1)
|
8
15
|
thread_safe (~> 0.1)
|
9
|
-
tzinfo (~>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
debugger-ruby_core_source (1.2.3)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
coderay (1.1.0)
|
18
|
+
coveralls (0.7.0)
|
19
|
+
multi_json (~> 1.3)
|
20
|
+
rest-client
|
21
|
+
simplecov (>= 0.7)
|
22
|
+
term-ansicolor
|
23
|
+
thor
|
18
24
|
diff-lcs (1.2.5)
|
19
|
-
|
25
|
+
docile (1.1.3)
|
26
|
+
ethon (0.6.3)
|
20
27
|
ffi (>= 1.3.0)
|
21
28
|
mime-types (~> 1.18)
|
22
|
-
factory_girl (4.
|
29
|
+
factory_girl (4.4.0)
|
23
30
|
activesupport (>= 3.0.0)
|
24
31
|
ffi (1.9.3)
|
25
|
-
i18n (0.6.
|
32
|
+
i18n (0.6.9)
|
26
33
|
json (1.8.1)
|
27
|
-
|
28
|
-
|
29
|
-
|
34
|
+
method_source (0.8.2)
|
35
|
+
mime-types (1.25.1)
|
36
|
+
minitest (5.3.2)
|
37
|
+
multi_json (1.9.2)
|
38
|
+
pry (0.9.12.6)
|
39
|
+
coderay (~> 1.0)
|
40
|
+
method_source (~> 0.8)
|
41
|
+
slop (~> 3.4)
|
42
|
+
pry-nav (0.2.3)
|
43
|
+
pry (~> 0.9.10)
|
44
|
+
rake (10.2.2)
|
45
|
+
rest-client (1.6.7)
|
46
|
+
mime-types (>= 1.16)
|
30
47
|
rspec (2.14.1)
|
31
48
|
rspec-core (~> 2.14.0)
|
32
49
|
rspec-expectations (~> 2.14.0)
|
33
50
|
rspec-mocks (~> 2.14.0)
|
34
|
-
rspec-core (2.14.
|
35
|
-
rspec-expectations (2.14.
|
51
|
+
rspec-core (2.14.8)
|
52
|
+
rspec-expectations (2.14.5)
|
36
53
|
diff-lcs (>= 1.1.3, < 2.0)
|
37
|
-
rspec-mocks (2.14.
|
38
|
-
|
39
|
-
|
54
|
+
rspec-mocks (2.14.6)
|
55
|
+
simplecov (0.8.2)
|
56
|
+
docile (~> 1.1.0)
|
57
|
+
multi_json
|
58
|
+
simplecov-html (~> 0.8.0)
|
59
|
+
simplecov-html (0.8.0)
|
60
|
+
slop (3.5.0)
|
61
|
+
term-ansicolor (1.3.0)
|
62
|
+
tins (~> 1.0)
|
63
|
+
thor (0.19.1)
|
64
|
+
thread_safe (0.3.3)
|
65
|
+
tins (1.1.0)
|
40
66
|
typhoeus (0.6.6)
|
41
67
|
ethon (~> 0.6.1)
|
42
|
-
tzinfo (
|
68
|
+
tzinfo (1.1.0)
|
69
|
+
thread_safe (~> 0.1)
|
43
70
|
|
44
71
|
PLATFORMS
|
45
72
|
ruby
|
46
73
|
|
47
74
|
DEPENDENCIES
|
48
|
-
|
75
|
+
coveralls
|
49
76
|
factory_girl
|
50
|
-
|
77
|
+
pry
|
78
|
+
pry-nav
|
79
|
+
rake
|
51
80
|
rspec
|
52
|
-
|
81
|
+
simplecov
|
82
|
+
the-city-admin!
|
data/README.rdoc
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
{<img src="https://travis-ci.org/thecity/thecity-admin-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/thecity/thecity-admin-ruby]
|
2
|
+
{<img src="https://coveralls.io/repos/thecity/thecity-admin-ruby/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/thecity/thecity-admin-ruby]
|
3
|
+
|
1
4
|
= The City Admin API
|
2
5
|
|
3
6
|
This Ruby project is an API wrapper for TheCity Admin API (https://api.onthecity.org)
|
@@ -42,7 +45,7 @@ Next you will need to initialize a connection
|
|
42
45
|
|
43
46
|
This project is released under the MIT license (see LICENSE).
|
44
47
|
|
45
|
-
This project is maintained by Wes Hays (https://github.com/weshays).
|
48
|
+
This project is maintained by Wes Hays (https://github.com/weshays) and Jason Hagglund (https://github.com/TheMetalCode).
|
46
49
|
|
47
50
|
|
48
51
|
== Contributors
|
@@ -27,19 +27,42 @@ end
|
|
27
27
|
puts "------------------------------------"
|
28
28
|
|
29
29
|
checkin_list = TheCity::CheckinList.new
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
30
|
+
if checkin_list.empty?
|
31
|
+
puts "No checkins in list"
|
32
|
+
else
|
33
|
+
puts "Checkins: #{checkin_list.count}"
|
34
|
+
end
|
35
|
+
|
36
|
+
checkin_list_by_pager_number = TheCity::CheckinListByPagerNumber.new('111')
|
37
|
+
if checkin_list_by_pager_number.empty?
|
38
|
+
puts "No checkins in list"
|
39
|
+
else
|
40
|
+
puts "Checkins: #{checkin_list.count}"
|
41
|
+
end
|
42
|
+
|
43
|
+
checkin_list_by_callboard_number = TheCity::CheckinListByCallboardNumber.new('12345')
|
44
|
+
if checkin_list_by_callboard_number.empty?
|
45
|
+
puts "No checkins in list"
|
46
|
+
else
|
47
|
+
puts "Checkins: #{checkin_list.count}"
|
48
|
+
end
|
49
|
+
|
50
|
+
checkin = checkin_list[0]
|
51
|
+
|
52
|
+
checkin2 = TheCity::Checkin.load_by_id(checkin.id)
|
53
|
+
if checkin2.nil?
|
54
|
+
puts 'Checkin not found'
|
55
|
+
else
|
56
|
+
puts "Checkin: #{checkin2.barcode}"
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "------------------------------------"
|
60
|
+
|
61
|
+
group_checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => 49861013})
|
62
|
+
if group_checkin_events_list.empty?
|
63
|
+
puts "No checkin events in list"
|
64
|
+
else
|
65
|
+
puts "Group Checkin Events: #{group_checkin_events_list.count}"
|
66
|
+
end
|
44
67
|
|
45
68
|
puts "####################################"
|
data/lib/api/checkin.rb
CHANGED
data/lib/api/checkin_list.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
module TheCity
|
2
|
+
|
3
|
+
class CheckinListByCallboardNumber < ApiList
|
4
|
+
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# Constructor.
|
8
|
+
#
|
9
|
+
# @param callboard_number The callboard number to filter by
|
10
|
+
# @param options A hash of options for loading the list.
|
11
|
+
#
|
12
|
+
# Options:
|
13
|
+
# :page - The page number to get.
|
14
|
+
# :reader - The Reader to use to load the data.
|
15
|
+
#
|
16
|
+
#
|
17
|
+
# Examples:
|
18
|
+
# CheckinListByCallboardNumber.new('12345')
|
19
|
+
#
|
20
|
+
# CheckinListByCallboardNumber.new('12345', {:page => 2})
|
21
|
+
#
|
22
|
+
def initialize(callboard_number, options = {})
|
23
|
+
@options = options
|
24
|
+
@options[:reader] = TheCity::CheckinListByCallboardNumberReader.new(callboard_number, @options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
26
|
+
|
27
|
+
@total_entries = @json_data['total_entries']
|
28
|
+
@total_pages = @json_data['total_pages']
|
29
|
+
@per_page = @json_data['per_page']
|
30
|
+
@current_page = @json_data['current_page']
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get the specified checkin.
|
34
|
+
#
|
35
|
+
# @param index The index of the checkin to get.
|
36
|
+
#
|
37
|
+
# @return [Checkin]
|
38
|
+
def [](index)
|
39
|
+
Checkin.new( @json_data['checkins'][index] ) if @json_data['checkins'][index]
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# This method is needed for Enumerable.
|
44
|
+
def each &block
|
45
|
+
@json_data['checkins'].each{ |checkin| yield( Checkin.new(checkin) )}
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# Alias the count method
|
50
|
+
alias :size :count
|
51
|
+
|
52
|
+
# Checks if the list is empty.
|
53
|
+
#
|
54
|
+
# @return True on empty, false otherwise.
|
55
|
+
def empty?
|
56
|
+
@json_data['checkins'].empty?
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module TheCity
|
2
|
+
|
3
|
+
class CheckinListByPagerNumber < ApiList
|
4
|
+
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# Constructor.
|
8
|
+
#
|
9
|
+
# @param pager_number The pager number to filter by
|
10
|
+
# @param options A hash of options for loading the list.
|
11
|
+
#
|
12
|
+
# Options:
|
13
|
+
# :page - The page number to get.
|
14
|
+
# :reader - The Reader to use to load the data.
|
15
|
+
#
|
16
|
+
#
|
17
|
+
# Examples:
|
18
|
+
# CheckinListByPagerNumber.new('111')
|
19
|
+
#
|
20
|
+
# CheckinListByPagerNumber.new('111', {:page => 2})
|
21
|
+
#
|
22
|
+
def initialize(pager_number, options = {})
|
23
|
+
@options = options
|
24
|
+
@options[:reader] = TheCity::CheckinListByPagerNumberReader.new(pager_number, @options) if @options[:reader].nil?
|
25
|
+
@json_data = @options[:reader].load_feed
|
26
|
+
|
27
|
+
@total_entries = @json_data['total_entries']
|
28
|
+
@total_pages = @json_data['total_pages']
|
29
|
+
@per_page = @json_data['per_page']
|
30
|
+
@current_page = @json_data['current_page']
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get the specified note.
|
34
|
+
#
|
35
|
+
# @param index The index of the checkin to get.
|
36
|
+
#
|
37
|
+
# @return [Checkin]
|
38
|
+
def [](index)
|
39
|
+
Checkin.new( @json_data['checkins'][index] ) if @json_data['checkins'][index]
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# This method is needed for Enumerable.
|
44
|
+
def each &block
|
45
|
+
@json_data['checkins'].each{ |checkin| yield( Checkin.new(checkin) )}
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# Alias the count method
|
50
|
+
alias :size :count
|
51
|
+
|
52
|
+
# Checks if the list is empty.
|
53
|
+
#
|
54
|
+
# @return True on empty, false otherwise.
|
55
|
+
def empty?
|
56
|
+
@json_data['checkins'].empty?
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/api/group_checkin.rb
CHANGED
@@ -21,14 +21,25 @@ module TheCity
|
|
21
21
|
:parent_group_id,
|
22
22
|
:pager_number
|
23
23
|
|
24
|
-
|
25
24
|
# Constructor.
|
26
25
|
#
|
27
26
|
# @param json_data JSON data of the group checkin.
|
28
27
|
def initialize(json_data)
|
29
28
|
initialize_from_json_object(json_data)
|
30
29
|
end
|
31
|
-
|
30
|
+
|
31
|
+
# Loads the group_checkin by the specified ID.
|
32
|
+
#
|
33
|
+
# @param group_id The ID of the group to load.
|
34
|
+
# @param checkin_id The ID of the group_checkin to load.
|
35
|
+
#
|
36
|
+
# Returns a new {GroupCheckin} object.
|
37
|
+
def self.load_by_id(group_id, checkin_id)
|
38
|
+
reader = GroupCheckinReader.new(group_id, checkin_id, 'id')
|
39
|
+
self.new(reader.load_feed)
|
40
|
+
rescue
|
41
|
+
nil
|
42
|
+
end
|
32
43
|
end
|
33
44
|
|
34
45
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module TheCity
|
2
|
+
|
3
|
+
class GroupCheckinEvent < ApiObject
|
4
|
+
|
5
|
+
tc_attr_accessor :ending_at,
|
6
|
+
:group_id,
|
7
|
+
:group_name,
|
8
|
+
:id,
|
9
|
+
:starting_at,
|
10
|
+
:title,
|
11
|
+
:shadow_event_ids
|
12
|
+
|
13
|
+
# Constructor.
|
14
|
+
#
|
15
|
+
# @param json_data JSON data of the group checkin event.
|
16
|
+
def initialize(json_data)
|
17
|
+
initialize_from_json_object(json_data)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|