teamsnap_rb 1.3.3 → 2.0.0.beta
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +131 -29
- data/lib/config/inflecto.rb +13 -0
- data/lib/config/oj.rb +5 -0
- data/lib/teamsnap.rb +36 -376
- data/lib/teamsnap/api.rb +113 -0
- data/lib/teamsnap/auth_middleware.rb +62 -0
- data/lib/teamsnap/client.rb +51 -0
- data/lib/teamsnap/collection.rb +125 -0
- data/lib/teamsnap/item.rb +100 -0
- data/lib/teamsnap/response.rb +101 -0
- data/lib/teamsnap/structure.rb +80 -0
- data/lib/teamsnap/version.rb +1 -1
- data/spec/cassettes/apiv3-init.yml +756 -124
- data/spec/cassettes/client/when_calling_via_s_on_the_client/does_not_raise_an_error_when_the_HTTP_actions_are_called.yml +56 -0
- data/spec/cassettes/structure/_create_collection_class/registers_new_classes_via_introspection_of_the_root_collection.yml +110 -0
- data/spec/cassettes/structure/_create_collection_class/sets_the_href_attribute_on_the_new_class.yml +57 -0
- data/spec/cassettes/structure/_init/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +56 -0
- data/spec/cassettes/structure/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +56 -0
- data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/does_not_raise_an_error_when_the_HTTP_actions_are_called.yml +69 -0
- data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/passes_them_to_the_faraday_client_using_method_missing.yml +69 -0
- data/spec/cassettes/teamsnap__collection/adds_find_if_search_is_available.yml +61 -0
- data/spec/cassettes/teamsnap__collection/adds_href_to_items.yml +62 -0
- data/spec/cassettes/teamsnap__collection/can_follow_plural_links.yml +179 -0
- data/spec/cassettes/teamsnap__collection/can_follow_singular_links.yml +120 -0
- data/spec/cassettes/teamsnap__collection/can_handle_links_with_no_data.yml +107 -0
- data/spec/cassettes/{teamsnap_rb/can_handle_errors_generated_by_command.yml → teamsnap__collection/can_handle_no_argument_errors_generated_by_command.yml} +10 -16
- data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands.yml +64 -0
- data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands_with_multiple_params.yml +70 -0
- data/spec/cassettes/teamsnap__collection/handles_fetching_data_via_queries.yml +61 -0
- data/spec/cassettes/teamsnap__collection/handles_queries_with_no_data.yml +57 -0
- data/spec/cassettes/teamsnap__collection/raises_an_exception_if_find_returns_nothing.yml +57 -0
- data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_plural_relation_is_called/responds_with_an_array_of_objects_when_successful.yml +117 -0
- data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_plural_relation_is_called/responds_with_an_empty_array_when_no_objects_exist.yml +111 -0
- data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_nil_if_it_does_NOT_exist.yml +111 -0
- data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_the_object_if_it_exists.yml +124 -0
- data/spec/cassettes/teamsnap__structure/_create_collection_class/registers_new_classes_via_introspection_of_the_root_collection.yml +57 -0
- data/spec/cassettes/teamsnap__structure/_create_collection_class/sets_the_href_attribute_on_the_new_class.yml +57 -0
- data/spec/cassettes/teamsnap__structure/_init/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +69 -0
- data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_empty_bulk_load.yml +55 -0
- data/spec/cassettes/teamsnap_rb/{can_handle_an_error_with_bulk_load.yml → _bulk_load/can_handle_an_error_with_bulk_load.yml} +11 -23
- data/spec/cassettes/teamsnap_rb/_bulk_load/can_use_bulk_load.yml +121 -0
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_DELETE_on_the_given_client.yml +2405 -0
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_GET_on_the_given_client.yml +69 -0
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_PATCH_on_the_given_client.yml +2404 -0
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_POST_on_the_given_client.yml +2404 -0
- data/spec/cassettes/teamsnap_rb/_run/processes_the_response.yml +267 -0
- data/spec/cassettes/teamsnap_rb/adds_find_if_search_is_available.yml +27 -30
- data/spec/cassettes/teamsnap_rb/adds_href_to_items.yml +31 -19
- data/spec/cassettes/teamsnap_rb/can_follow_plural_links.yml +118 -67
- data/spec/cassettes/teamsnap_rb/can_follow_singular_links.yml +59 -56
- data/spec/cassettes/teamsnap_rb/can_handle_links_with_no_data.yml +48 -38
- data/spec/cassettes/teamsnap_rb/can_handle_no_argument_errors_generated_by_command.yml +42 -0
- data/spec/cassettes/teamsnap_rb/handles_executing_an_action_via_commands.yml +32 -20
- data/spec/cassettes/teamsnap_rb/handles_executing_an_action_via_commands_with_multiple_params.yml +29 -404
- data/spec/cassettes/teamsnap_rb/handles_fetching_data_via_queries.yml +26 -23
- data/spec/cassettes/teamsnap_rb/handles_queries_with_no_data.yml +24 -28
- data/spec/cassettes/teamsnap_rb/raises_an_exception_if_find_returns_nothing.yml +24 -28
- data/spec/cassettes/teamsnap_rb/supports_relations_with_expected_behaviors/when_a_plural_relation_is_called/responds_with_an_array_of_objects_when_successful.yml +53 -45
- data/spec/cassettes/teamsnap_rb/supports_relations_with_expected_behaviors/when_a_plural_relation_is_called/responds_with_an_empty_array_when_no_objects_exist.yml +50 -54
- data/spec/cassettes/teamsnap_rb/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_nil_if_it_does_NOT_exist.yml +50 -54
- data/spec/cassettes/teamsnap_rb/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_the_object_if_it_exists.yml +59 -58
- data/spec/spec_helper.rb +2 -0
- data/spec/teamsnap/client_spec.rb +75 -0
- data/spec/teamsnap/collection_spec.rb +155 -0
- data/spec/teamsnap/item_spec.rb +155 -0
- data/spec/teamsnap/structure_spec.rb +63 -0
- data/spec/teamsnap_spec.rb +169 -157
- data/teamsnap_rb.gemspec +1 -1
- metadata +92 -15
- data/spec/cassettes/teamsnap_rb/can_handle_an_empty_bulk_load.yml +0 -60
- data/spec/cassettes/teamsnap_rb/can_use_bulk_load.yml +0 -74
@@ -2,15 +2,15 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://localhost:3000/events/search?id=1
|
5
|
+
uri: http://localhost:3000/events/search?id=1&hmac_client_id=classic&hmac_nonce=3bb8a00b-2eea-49af-9e26-b23713722cae&hmac_timestamp=1457726122
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.9.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.9.1
|
12
|
+
X-Teamsnap-Hmac:
|
13
|
+
- 1c8ac9bfbc71dba56aa79357e23dad6fda9444a7a8ae3c46c73a96d7ffdf6b6c
|
14
14
|
response:
|
15
15
|
status:
|
16
16
|
code: 200
|
@@ -19,57 +19,61 @@ http_interactions:
|
|
19
19
|
Content-Type:
|
20
20
|
- application/vnd.collection+json
|
21
21
|
Content-Length:
|
22
|
-
- '
|
23
|
-
Connection:
|
24
|
-
- keep-alive
|
25
|
-
Status:
|
26
|
-
- 200 OK
|
22
|
+
- '7815'
|
27
23
|
X-Content-Type-Options:
|
28
24
|
- nosniff
|
29
|
-
X-RateLimit-Limit:
|
30
|
-
- '5000'
|
31
|
-
X-RateLimit-Remaining:
|
32
|
-
- '4871'
|
33
|
-
X-RateLimit-Reset:
|
34
|
-
- '1444790104'
|
35
25
|
ETag:
|
36
|
-
- '"
|
26
|
+
- '"fecf9a32b9425a2b01bddcb5dd954f7a"'
|
37
27
|
Cache-Control:
|
38
28
|
- max-age=0, private, must-revalidate
|
39
29
|
X-Request-Id:
|
40
|
-
-
|
30
|
+
- c881ef7e-a014-4ca0-abd3-63e61eb9b376
|
41
31
|
X-Runtime:
|
42
|
-
- '0.
|
43
|
-
|
44
|
-
-
|
45
|
-
Date:
|
46
|
-
- Wed, 14 Oct 2015 02:03:40 GMT
|
32
|
+
- '0.053005'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
47
35
|
Server:
|
48
|
-
-
|
36
|
+
- thin
|
49
37
|
body:
|
50
38
|
encoding: UTF-8
|
51
|
-
string: '{"collection":{"version":"3.
|
39
|
+
string: '{"collection":{"version":"3.203.1","href":"http://localhost:3000/events","rel":"events","template":{"data":[{"name":"type","value":"event"},{"name":"additional_location_details","value":null},{"name":"browser_time_zone","value":null},{"name":"division_location_id","value":null},{"name":"doesnt_count_towards_record","value":null},{"name":"duration_in_minutes","value":null},{"name":"game_type_code","value":null},{"name":"icon_color","value":null},{"name":"is_canceled","value":null},{"name":"is_game","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"is_tbd","value":null},{"name":"label","value":null},{"name":"location_id","value":null},{"name":"minutes_to_arrive_early","value":null},{"name":"name","value":null},{"name":"notes","value":null},{"name":"notify_opponent","value":null},{"name":"notify_opponent_contacts_email","value":null},{"name":"notify_opponent_contacts_name","value":null},{"name":"notify_opponent_notes","value":null},{"name":"notify_team","value":null},{"name":"notify_team_as_member_id","value":null},{"name":"opponent_id","value":null},{"name":"points_for_opponent","value":null},{"name":"points_for_team","value":null},{"name":"repeating_include","value":null,"prompt":"When
|
40
|
+
updating a repeating event, this is a required field. Values are: \"all\"
|
41
|
+
- updates all events in this series, \"future\" - updates this event and all
|
42
|
+
that occur after, \"none\" - only updates a single event."},{"name":"repeating_type_code","value":null,"prompt":"A
|
43
|
+
code for the frequency of the repeated event, this is required with the \"repeating_include\"
|
44
|
+
attribute when creating a repeating event. Valid values are: \"1\" - repeat
|
45
|
+
an event daily, \"2\" - repeat an event weekly."},{"name":"repeating_until","value":null,"prompt":"A
|
46
|
+
date when the repeating event should end, this is inclusive so an event will
|
47
|
+
be created on this day if it falls before the next event specified by \"repeating_type_code\".
|
48
|
+
This attribute is required with \"repeating_type_code\" when creating a repeating
|
49
|
+
event."},{"name":"results","value":null},{"name":"results_url","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"start_date","value":null},{"name":"team_id","value":null},{"name":"time_zone","value":null},{"name":"tracks_availability","value":null},{"name":"uniform","value":null}]},"links":[{"rel":"assignments","href":"http://localhost:3000/assignments"},{"rel":"availabilities","href":"http://localhost:3000/availabilities"},{"rel":"division_location","href":"http://localhost:3000/division_locations"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics"},{"rel":"location","href":"http://localhost:3000/locations"},{"rel":"opponent","href":"http://localhost:3000/opponents"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data"},{"rel":"team","href":"http://localhost:3000/teams"},{"rel":"root","href":"http://localhost:3000/"},{"rel":"self","href":"http://localhost:3000/events/search?id=1"}],"queries":[{"rel":"search","href":"http://localhost:3000/events/search","data":[{"name":"team_id","value":null},{"name":"location_id","value":null},{"name":"opponent_id","value":null},{"name":"started_after","value":null},{"name":"started_before","value":null},{"name":"id","value":null},{"name":"page_size","value":null,"prompt":"The
|
50
|
+
number of items to return for each page. Sending this parameter with the query
|
51
|
+
will enable paging for the returned collection."},{"name":"page_number","value":null,"prompt":"The
|
52
|
+
number of the page to be returned. This requires that paging be turned on
|
53
|
+
by also providing the page_size parameter."}]},{"rel":"search_games","href":"http://localhost:3000/events/search_games","data":[{"name":"team_id","value":null}]},{"rel":"overview","href":"http://localhost:3000/events/overview","data":[{"name":"team_id","value":null}]}],"commands":[{"rel":"send_availability_reminders","href":"http://localhost:3000/events/send_availability_reminders","prompt":"members_to_notify
|
52
54
|
= [member_id, member_id]","data":[{"name":"id","value":null},{"name":"members_to_notify","value":null},{"name":"notify_team_as_member_id","value":null}]},{"rel":"update_final_score","href":"http://localhost:3000/events/update_final_score","prompt":"Update
|
53
|
-
the final score for an event","data":[{"name":"id","value":null},{"name":"points_for_team","value":null},{"name":"points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"results","value":null},{"name":"results_url","value":null}]}
|
55
|
+
the final score for an event","data":[{"name":"id","value":null},{"name":"points_for_team","value":null},{"name":"points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"results","value":null},{"name":"results_url","value":null}]},{"rel":"bulk_create","href":"http://localhost:3000/events/bulk_create","prompt":"event_ids
|
56
|
+
= [event_id, event_id]","data":[{"name":"templates","value":null},{"name":"team_id","value":null},{"name":"notify_team_as_member_id","value":null},{"name":"notify_team","value":null}]}],"items":[{"href":"http://localhost:3000/events/1","data":[{"name":"id","value":1},{"name":"type","value":"event"},{"name":"additional_location_details","value":"Court
|
57
|
+
#1"},{"name":"arrival_date","value":"2015-01-01T00:00:00Z","type":"DateTime"},{"name":"division_location_id","value":null},{"name":"doesnt_count_towards_record","value":false},{"name":"duration_in_minutes","value":120},{"name":"end_date","value":"2015-01-01T02:00:00Z","type":"DateTime"},{"name":"formatted_results","value":null},{"name":"game_type","value":"Not
|
54
58
|
Specified"},{"name":"game_type_code","value":null},{"name":"icon_color","value":"blue"},{"name":"is_canceled","value":false},{"name":"is_game","value":false},{"name":"is_overtime","value":false},{"name":"is_shootout","value":false},{"name":"is_tbd","value":false},{"name":"label","value":null},{"name":"location_id","value":1},{"name":"minutes_to_arrive_early","value":null},{"name":"name","value":"March
|
55
59
|
Madness Game 1"},{"name":"notes","value":null},{"name":"opponent_id","value":1},{"name":"points_for_opponent","value":null},{"name":"points_for_team","value":null},{"name":"repeating_type","value":null},{"name":"repeating_type_code","value":null},{"name":"repeating_uuid","value":null},{"name":"results","value":null},{"name":"results_url","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"start_date","value":"2015-01-01T00:00:00Z","type":"DateTime"},{"name":"team_id","value":1},{"name":"time_zone","value":"Mountain
|
56
60
|
Time (US & Canada)"},{"name":"time_zone_description","value":"Mountain Time
|
57
|
-
(US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"source_time_zone_iana_name","value":"America/Denver"},{"name":"tracks_availability","value":true},{"name":"uniform","value":null},{"name":"is_league_controlled","value":false},{"name":"created_at","value":"
|
61
|
+
(US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"source_time_zone_iana_name","value":"America/Denver"},{"name":"tracks_availability","value":true},{"name":"uniform","value":null},{"name":"is_league_controlled","value":false},{"name":"created_at","value":"2016-02-08T20:04:07Z","type":"DateTime"},{"name":"updated_at","value":"2016-02-08T20:04:07Z","type":"DateTime"}],"links":[{"rel":"assignments","href":"http://localhost:3000/assignments/search?event_id=1"},{"rel":"availabilities","href":"http://localhost:3000/availabilities/search?event_id=1"},{"rel":"calendar_single_event","href":"http://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/event/1.ics"},{"rel":"division_location","href":"http://localhost:3000/division_locations/"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics/search?event_id=1"},{"rel":"location","href":"http://localhost:3000/locations/1"},{"rel":"opponent","href":"http://localhost:3000/opponents/1"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data/search?event_id=1"},{"rel":"team","href":"http://localhost:3000/teams/1"}],"rel":"event-1"}]}}'
|
58
62
|
http_version: '1.1'
|
59
63
|
adapter_metadata:
|
60
|
-
effective_url: http://localhost:3000/events/search?id=1
|
61
|
-
recorded_at:
|
64
|
+
effective_url: http://localhost:3000/events/search?id=1&hmac_client_id=classic&hmac_nonce=3bb8a00b-2eea-49af-9e26-b23713722cae&hmac_timestamp=1457726122
|
65
|
+
recorded_at: Fri, 11 Mar 2016 19:55:22 GMT
|
62
66
|
- request:
|
63
67
|
method: get
|
64
|
-
uri: http://localhost:3000/division_locations
|
68
|
+
uri: http://localhost:3000/division_locations/?hmac_client_id=classic&hmac_nonce=d38cf5e6-65a9-4131-b608-acb485c21a22&hmac_timestamp=1457726122
|
65
69
|
body:
|
66
70
|
encoding: US-ASCII
|
67
71
|
string: ''
|
68
72
|
headers:
|
69
73
|
User-Agent:
|
70
|
-
- Faraday v0.9.
|
71
|
-
|
72
|
-
-
|
74
|
+
- Faraday v0.9.1
|
75
|
+
X-Teamsnap-Hmac:
|
76
|
+
- 83a53c42da55cfcaa6d2ccef938cc2b3d90152b4efbdb4cd9fbcd9499818eade
|
73
77
|
response:
|
74
78
|
status:
|
75
79
|
code: 200
|
@@ -78,38 +82,30 @@ http_interactions:
|
|
78
82
|
Content-Type:
|
79
83
|
- application/vnd.collection+json
|
80
84
|
Content-Length:
|
81
|
-
- '
|
82
|
-
Connection:
|
83
|
-
- keep-alive
|
84
|
-
Status:
|
85
|
-
- 200 OK
|
85
|
+
- '824'
|
86
86
|
X-Content-Type-Options:
|
87
87
|
- nosniff
|
88
|
-
X-RateLimit-Limit:
|
89
|
-
- '5000'
|
90
|
-
X-RateLimit-Remaining:
|
91
|
-
- '4870'
|
92
|
-
X-RateLimit-Reset:
|
93
|
-
- '1444790105'
|
94
88
|
ETag:
|
95
|
-
- '"
|
89
|
+
- '"a79e0c591a2d27fe376b346e06edcd8c"'
|
96
90
|
Cache-Control:
|
97
91
|
- max-age=0, private, must-revalidate
|
98
92
|
X-Request-Id:
|
99
|
-
-
|
93
|
+
- 8b6b8342-0a83-4a7d-afb7-6b7b7a51b67b
|
100
94
|
X-Runtime:
|
101
|
-
- '0.
|
102
|
-
|
103
|
-
-
|
104
|
-
Date:
|
105
|
-
- Wed, 14 Oct 2015 02:03:41 GMT
|
95
|
+
- '0.059802'
|
96
|
+
Connection:
|
97
|
+
- keep-alive
|
106
98
|
Server:
|
107
|
-
-
|
99
|
+
- thin
|
108
100
|
body:
|
109
101
|
encoding: UTF-8
|
110
|
-
string: '{"collection":{"version":"3.
|
102
|
+
string: '{"collection":{"version":"3.203.1","href":"http://localhost:3000/division_locations","rel":"division_locations","links":[{"rel":"events","href":"http://localhost:3000/events"},{"rel":"root","href":"http://localhost:3000/"},{"rel":"self","href":"http://localhost:3000/division_locations"}],"queries":[{"rel":"search","href":"http://localhost:3000/division_locations/search","data":[{"name":"division_id","value":null},{"name":"team_id","value":null},{"name":"id","value":null},{"name":"page_size","value":null,"prompt":"The
|
103
|
+
number of items to return for each page. Sending this parameter with the query
|
104
|
+
will enable paging for the returned collection."},{"name":"page_number","value":null,"prompt":"The
|
105
|
+
number of the page to be returned. This requires that paging be turned on
|
106
|
+
by also providing the page_size parameter."}]}]}}'
|
111
107
|
http_version: '1.1'
|
112
108
|
adapter_metadata:
|
113
|
-
effective_url: http://localhost:3000/division_locations
|
114
|
-
recorded_at:
|
109
|
+
effective_url: http://localhost:3000/division_locations/?hmac_client_id=classic&hmac_nonce=d38cf5e6-65a9-4131-b608-acb485c21a22&hmac_timestamp=1457726122
|
110
|
+
recorded_at: Fri, 11 Mar 2016 19:55:22 GMT
|
115
111
|
recorded_with: VCR 2.9.3
|
@@ -2,15 +2,15 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://localhost:3000/events/search?id=1
|
5
|
+
uri: http://localhost:3000/events/search?id=1&hmac_client_id=classic&hmac_nonce=591224d4-b5c2-45e4-af71-a710a5fb4fda&hmac_timestamp=1457726122
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday v0.9.
|
12
|
-
|
13
|
-
-
|
11
|
+
- Faraday v0.9.1
|
12
|
+
X-Teamsnap-Hmac:
|
13
|
+
- 9771be0d0f0c3b12096262148fe4948f238f2bbc876811527c67e46b9adcb95b
|
14
14
|
response:
|
15
15
|
status:
|
16
16
|
code: 200
|
@@ -19,57 +19,61 @@ http_interactions:
|
|
19
19
|
Content-Type:
|
20
20
|
- application/vnd.collection+json
|
21
21
|
Content-Length:
|
22
|
-
- '
|
23
|
-
Connection:
|
24
|
-
- keep-alive
|
25
|
-
Status:
|
26
|
-
- 200 OK
|
22
|
+
- '7815'
|
27
23
|
X-Content-Type-Options:
|
28
24
|
- nosniff
|
29
|
-
X-RateLimit-Limit:
|
30
|
-
- '5000'
|
31
|
-
X-RateLimit-Remaining:
|
32
|
-
- '4869'
|
33
|
-
X-RateLimit-Reset:
|
34
|
-
- '1444790105'
|
35
25
|
ETag:
|
36
|
-
- '"
|
26
|
+
- '"fecf9a32b9425a2b01bddcb5dd954f7a"'
|
37
27
|
Cache-Control:
|
38
28
|
- max-age=0, private, must-revalidate
|
39
29
|
X-Request-Id:
|
40
|
-
-
|
30
|
+
- 3cc9fa48-b914-4251-8f3e-66482ea20b81
|
41
31
|
X-Runtime:
|
42
|
-
- '0.
|
43
|
-
|
44
|
-
-
|
45
|
-
Date:
|
46
|
-
- Wed, 14 Oct 2015 02:03:41 GMT
|
32
|
+
- '0.120254'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
47
35
|
Server:
|
48
|
-
-
|
36
|
+
- thin
|
49
37
|
body:
|
50
38
|
encoding: UTF-8
|
51
|
-
string: '{"collection":{"version":"3.
|
39
|
+
string: '{"collection":{"version":"3.203.1","href":"http://localhost:3000/events","rel":"events","template":{"data":[{"name":"type","value":"event"},{"name":"additional_location_details","value":null},{"name":"browser_time_zone","value":null},{"name":"division_location_id","value":null},{"name":"doesnt_count_towards_record","value":null},{"name":"duration_in_minutes","value":null},{"name":"game_type_code","value":null},{"name":"icon_color","value":null},{"name":"is_canceled","value":null},{"name":"is_game","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"is_tbd","value":null},{"name":"label","value":null},{"name":"location_id","value":null},{"name":"minutes_to_arrive_early","value":null},{"name":"name","value":null},{"name":"notes","value":null},{"name":"notify_opponent","value":null},{"name":"notify_opponent_contacts_email","value":null},{"name":"notify_opponent_contacts_name","value":null},{"name":"notify_opponent_notes","value":null},{"name":"notify_team","value":null},{"name":"notify_team_as_member_id","value":null},{"name":"opponent_id","value":null},{"name":"points_for_opponent","value":null},{"name":"points_for_team","value":null},{"name":"repeating_include","value":null,"prompt":"When
|
40
|
+
updating a repeating event, this is a required field. Values are: \"all\"
|
41
|
+
- updates all events in this series, \"future\" - updates this event and all
|
42
|
+
that occur after, \"none\" - only updates a single event."},{"name":"repeating_type_code","value":null,"prompt":"A
|
43
|
+
code for the frequency of the repeated event, this is required with the \"repeating_include\"
|
44
|
+
attribute when creating a repeating event. Valid values are: \"1\" - repeat
|
45
|
+
an event daily, \"2\" - repeat an event weekly."},{"name":"repeating_until","value":null,"prompt":"A
|
46
|
+
date when the repeating event should end, this is inclusive so an event will
|
47
|
+
be created on this day if it falls before the next event specified by \"repeating_type_code\".
|
48
|
+
This attribute is required with \"repeating_type_code\" when creating a repeating
|
49
|
+
event."},{"name":"results","value":null},{"name":"results_url","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"start_date","value":null},{"name":"team_id","value":null},{"name":"time_zone","value":null},{"name":"tracks_availability","value":null},{"name":"uniform","value":null}]},"links":[{"rel":"assignments","href":"http://localhost:3000/assignments"},{"rel":"availabilities","href":"http://localhost:3000/availabilities"},{"rel":"division_location","href":"http://localhost:3000/division_locations"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics"},{"rel":"location","href":"http://localhost:3000/locations"},{"rel":"opponent","href":"http://localhost:3000/opponents"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data"},{"rel":"team","href":"http://localhost:3000/teams"},{"rel":"root","href":"http://localhost:3000/"},{"rel":"self","href":"http://localhost:3000/events/search?id=1"}],"queries":[{"rel":"search","href":"http://localhost:3000/events/search","data":[{"name":"team_id","value":null},{"name":"location_id","value":null},{"name":"opponent_id","value":null},{"name":"started_after","value":null},{"name":"started_before","value":null},{"name":"id","value":null},{"name":"page_size","value":null,"prompt":"The
|
50
|
+
number of items to return for each page. Sending this parameter with the query
|
51
|
+
will enable paging for the returned collection."},{"name":"page_number","value":null,"prompt":"The
|
52
|
+
number of the page to be returned. This requires that paging be turned on
|
53
|
+
by also providing the page_size parameter."}]},{"rel":"search_games","href":"http://localhost:3000/events/search_games","data":[{"name":"team_id","value":null}]},{"rel":"overview","href":"http://localhost:3000/events/overview","data":[{"name":"team_id","value":null}]}],"commands":[{"rel":"send_availability_reminders","href":"http://localhost:3000/events/send_availability_reminders","prompt":"members_to_notify
|
52
54
|
= [member_id, member_id]","data":[{"name":"id","value":null},{"name":"members_to_notify","value":null},{"name":"notify_team_as_member_id","value":null}]},{"rel":"update_final_score","href":"http://localhost:3000/events/update_final_score","prompt":"Update
|
53
|
-
the final score for an event","data":[{"name":"id","value":null},{"name":"points_for_team","value":null},{"name":"points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"results","value":null},{"name":"results_url","value":null}]}
|
55
|
+
the final score for an event","data":[{"name":"id","value":null},{"name":"points_for_team","value":null},{"name":"points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"is_overtime","value":null},{"name":"is_shootout","value":null},{"name":"results","value":null},{"name":"results_url","value":null}]},{"rel":"bulk_create","href":"http://localhost:3000/events/bulk_create","prompt":"event_ids
|
56
|
+
= [event_id, event_id]","data":[{"name":"templates","value":null},{"name":"team_id","value":null},{"name":"notify_team_as_member_id","value":null},{"name":"notify_team","value":null}]}],"items":[{"href":"http://localhost:3000/events/1","data":[{"name":"id","value":1},{"name":"type","value":"event"},{"name":"additional_location_details","value":"Court
|
57
|
+
#1"},{"name":"arrival_date","value":"2015-01-01T00:00:00Z","type":"DateTime"},{"name":"division_location_id","value":null},{"name":"doesnt_count_towards_record","value":false},{"name":"duration_in_minutes","value":120},{"name":"end_date","value":"2015-01-01T02:00:00Z","type":"DateTime"},{"name":"formatted_results","value":null},{"name":"game_type","value":"Not
|
54
58
|
Specified"},{"name":"game_type_code","value":null},{"name":"icon_color","value":"blue"},{"name":"is_canceled","value":false},{"name":"is_game","value":false},{"name":"is_overtime","value":false},{"name":"is_shootout","value":false},{"name":"is_tbd","value":false},{"name":"label","value":null},{"name":"location_id","value":1},{"name":"minutes_to_arrive_early","value":null},{"name":"name","value":"March
|
55
59
|
Madness Game 1"},{"name":"notes","value":null},{"name":"opponent_id","value":1},{"name":"points_for_opponent","value":null},{"name":"points_for_team","value":null},{"name":"repeating_type","value":null},{"name":"repeating_type_code","value":null},{"name":"repeating_uuid","value":null},{"name":"results","value":null},{"name":"results_url","value":null},{"name":"shootout_points_for_opponent","value":null},{"name":"shootout_points_for_team","value":null},{"name":"start_date","value":"2015-01-01T00:00:00Z","type":"DateTime"},{"name":"team_id","value":1},{"name":"time_zone","value":"Mountain
|
56
60
|
Time (US & Canada)"},{"name":"time_zone_description","value":"Mountain Time
|
57
|
-
(US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"source_time_zone_iana_name","value":"America/Denver"},{"name":"tracks_availability","value":true},{"name":"uniform","value":null},{"name":"is_league_controlled","value":false},{"name":"created_at","value":"
|
61
|
+
(US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"source_time_zone_iana_name","value":"America/Denver"},{"name":"tracks_availability","value":true},{"name":"uniform","value":null},{"name":"is_league_controlled","value":false},{"name":"created_at","value":"2016-02-08T20:04:07Z","type":"DateTime"},{"name":"updated_at","value":"2016-02-08T20:04:07Z","type":"DateTime"}],"links":[{"rel":"assignments","href":"http://localhost:3000/assignments/search?event_id=1"},{"rel":"availabilities","href":"http://localhost:3000/availabilities/search?event_id=1"},{"rel":"calendar_single_event","href":"http://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/event/1.ics"},{"rel":"division_location","href":"http://localhost:3000/division_locations/"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics/search?event_id=1"},{"rel":"location","href":"http://localhost:3000/locations/1"},{"rel":"opponent","href":"http://localhost:3000/opponents/1"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data/search?event_id=1"},{"rel":"team","href":"http://localhost:3000/teams/1"}],"rel":"event-1"}]}}'
|
58
62
|
http_version: '1.1'
|
59
63
|
adapter_metadata:
|
60
|
-
effective_url: http://localhost:3000/events/search?id=1
|
61
|
-
recorded_at:
|
64
|
+
effective_url: http://localhost:3000/events/search?id=1&hmac_client_id=classic&hmac_nonce=591224d4-b5c2-45e4-af71-a710a5fb4fda&hmac_timestamp=1457726122
|
65
|
+
recorded_at: Fri, 11 Mar 2016 19:55:23 GMT
|
62
66
|
- request:
|
63
67
|
method: get
|
64
|
-
uri: http://localhost:3000/teams/1
|
68
|
+
uri: http://localhost:3000/teams/1?hmac_client_id=classic&hmac_nonce=e4262cf8-af0a-455b-b17b-702e4b531f51&hmac_timestamp=1457726123
|
65
69
|
body:
|
66
70
|
encoding: US-ASCII
|
67
71
|
string: ''
|
68
72
|
headers:
|
69
73
|
User-Agent:
|
70
|
-
- Faraday v0.9.
|
71
|
-
|
72
|
-
-
|
74
|
+
- Faraday v0.9.1
|
75
|
+
X-Teamsnap-Hmac:
|
76
|
+
- ce7c56adbbd2eb10b71b8eaec92def278edb70f1411d29472646149fa830322f
|
73
77
|
response:
|
74
78
|
status:
|
75
79
|
code: 200
|
@@ -78,46 +82,43 @@ http_interactions:
|
|
78
82
|
Content-Type:
|
79
83
|
- application/vnd.collection+json
|
80
84
|
Content-Length:
|
81
|
-
- '
|
82
|
-
Connection:
|
83
|
-
- keep-alive
|
84
|
-
Status:
|
85
|
-
- 200 OK
|
85
|
+
- '15314'
|
86
86
|
X-Content-Type-Options:
|
87
87
|
- nosniff
|
88
|
-
X-RateLimit-Limit:
|
89
|
-
- '5000'
|
90
|
-
X-RateLimit-Remaining:
|
91
|
-
- '4868'
|
92
|
-
X-RateLimit-Reset:
|
93
|
-
- '1444790105'
|
94
88
|
ETag:
|
95
|
-
- '"
|
89
|
+
- '"8af5d468ef2cda25cc919a1b5b65ac25"'
|
96
90
|
Cache-Control:
|
97
91
|
- max-age=0, private, must-revalidate
|
98
92
|
X-Request-Id:
|
99
|
-
-
|
93
|
+
- bcec16a6-a7dc-47d4-91f0-2c5132195a88
|
100
94
|
X-Runtime:
|
101
|
-
- '0.
|
102
|
-
|
103
|
-
-
|
104
|
-
Date:
|
105
|
-
- Wed, 14 Oct 2015 02:03:41 GMT
|
95
|
+
- '0.105043'
|
96
|
+
Connection:
|
97
|
+
- keep-alive
|
106
98
|
Server:
|
107
|
-
-
|
99
|
+
- thin
|
108
100
|
body:
|
109
101
|
encoding: UTF-8
|
110
|
-
string: '{"collection":{"version":"3.
|
102
|
+
string: '{"collection":{"version":"3.203.1","href":"http://localhost:3000/teams","rel":"teams","template":{"data":[{"name":"name","value":null},{"name":"location_country","value":null},{"name":"location_postal_code","value":null},{"name":"time_zone","value":null,"prompt":"The
|
103
|
+
time_zone parameter is required when creating a team, but for changing a team''s
|
104
|
+
time_zone, use the update_time_zone command"},{"name":"sport_id","value":null},{"name":"division_name","value":null},{"name":"season_name","value":null},{"name":"league_name","value":null},{"name":"league_url","value":null},{"name":"type","value":"team"}]},"links":[{"rel":"active_season_team","href":"http://localhost:3000/teams"},{"rel":"assignments","href":"http://localhost:3000/assignments"},{"rel":"availabilities","href":"http://localhost:3000/availabilities"},{"rel":"broadcast_email_attachments","href":"http://localhost:3000/broadcast_email_attachments"},{"rel":"broadcast_emails","href":"http://localhost:3000/broadcast_emails"},{"rel":"broadcast_alerts","href":"http://localhost:3000/broadcast_alerts"},{"rel":"contact_email_addresses","href":"http://localhost:3000/contact_email_addresses"},{"rel":"contact_phone_numbers","href":"http://localhost:3000/contact_phone_numbers"},{"rel":"contacts","href":"http://localhost:3000/contacts"},{"rel":"custom_data","href":"http://localhost:3000/custom_data"},{"rel":"custom_fields","href":"http://localhost:3000/custom_fields"},{"rel":"division_contact_email_addresses","href":"http://localhost:3000/division_contact_email_addresses"},{"rel":"division_contact_phone_numbers","href":"http://localhost:3000/division_contact_phone_numbers"},{"rel":"division_contacts","href":"http://localhost:3000/division_contacts"},{"rel":"division_locations","href":"http://localhost:3000/division_locations"},{"rel":"division_member_email_addresses","href":"http://localhost:3000/division_member_email_addresses"},{"rel":"division_member_phone_numbers","href":"http://localhost:3000/division_member_phone_numbers"},{"rel":"division_members","href":"http://localhost:3000/division_members"},{"rel":"division_members_preferences","href":"http://localhost:3000/division_members_preferences"},{"rel":"division_team_standings","href":"http://localhost:3000/division_team_standings"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics"},{"rel":"events","href":"http://localhost:3000/events"},{"rel":"events_overview","href":"http://localhost:3000/events/overview"},{"rel":"forum_posts","href":"http://localhost:3000/forum_posts"},{"rel":"forum_subscriptions","href":"http://localhost:3000/forum_subscriptions"},{"rel":"forum_topics","href":"http://localhost:3000/forum_topics"},{"rel":"league_custom_data","href":"http://localhost:3000/league_custom_data"},{"rel":"league_custom_fields","href":"http://localhost:3000/league_custom_fields"},{"rel":"league_registrant_documents","href":"http://localhost:3000/league_registrant_documents"},{"rel":"locations","href":"http://localhost:3000/locations"},{"rel":"managers","href":"http://localhost:3000/members"},{"rel":"member_balances","href":"http://localhost:3000/member_balances"},{"rel":"member_email_addresses","href":"http://localhost:3000/member_email_addresses"},{"rel":"member_files","href":"http://localhost:3000/member_files"},{"rel":"member_links","href":"http://localhost:3000/member_links"},{"rel":"member_payments","href":"http://localhost:3000/member_payments"},{"rel":"member_phone_numbers","href":"http://localhost:3000/member_phone_numbers"},{"rel":"member_statistics","href":"http://localhost:3000/member_statistics"},{"rel":"members","href":"http://localhost:3000/members"},{"rel":"members_preferences","href":"http://localhost:3000/members_preferences"},{"rel":"opponents","href":"http://localhost:3000/opponents"},{"rel":"opponents_results","href":"http://localhost:3000/opponents_results"},{"rel":"owner","href":"http://localhost:3000/members"},{"rel":"payment_notes","href":"http://localhost:3000/payment_notes"},{"rel":"paypal_currency","href":"http://localhost:3000/paypal_currencies"},{"rel":"plan","href":"http://localhost:3000/plans"},{"rel":"sponsors","href":"http://localhost:3000/sponsors"},{"rel":"sport","href":"http://localhost:3000/sports"},{"rel":"statistic","href":"http://localhost:3000/statistics"},{"rel":"statistic_aggregates","href":"http://localhost:3000/statistic_aggregates"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data"},{"rel":"statistic_group","href":"http://localhost:3000/statistic_groups"},{"rel":"team_fees","href":"http://localhost:3000/team_fees"},{"rel":"team_media","href":"http://localhost:3000/team_media"},{"rel":"team_medium_comments","href":"http://localhost:3000/team_medium_comments"},{"rel":"team_media_groups","href":"http://localhost:3000/team_media_groups"},{"rel":"team_paypal_preferences","href":"http://localhost:3000/teams_paypal_preferences"},{"rel":"team_preferences","href":"http://localhost:3000/teams_preferences"},{"rel":"team_public_site","href":"http://localhost:3000/team_public_sites"},{"rel":"team_results","href":"http://localhost:3000/teams_results"},{"rel":"team_statistics","href":"http://localhost:3000/team_statistics"},{"rel":"tracked_item_statuses","href":"http://localhost:3000/tracked_item_statuses"},{"rel":"tracked_items","href":"http://localhost:3000/tracked_items"},{"rel":"root","href":"http://localhost:3000/"},{"rel":"self","href":"http://localhost:3000/teams/1"}],"queries":[{"rel":"search","href":"http://localhost:3000/teams/search","data":[{"name":"id","value":null},{"name":"team_id","value":null},{"name":"user_id","value":null},{"name":"division_id","value":null},{"name":"page_size","value":null,"prompt":"The
|
105
|
+
number of items to return for each page. Sending this parameter with the query
|
106
|
+
will enable paging for the returned collection."},{"name":"page_number","value":null,"prompt":"The
|
107
|
+
number of the page to be returned. This requires that paging be turned on
|
108
|
+
by also providing the page_size parameter."}]},{"rel":"available_for_statistic_import","href":"http://localhost:3000/teams/available_for_statistic_import","prompt":"Finds
|
111
109
|
all teams accessible to current user that have the provided sport_id and have
|
112
|
-
at least one statistic to import","data":[{"name":"sport_id","value":null}]}
|
110
|
+
at least one statistic to import","data":[{"name":"sport_id","value":null}]},{"rel":"active_teams","href":"http://localhost:3000/teams/active","prompt":"Finds
|
111
|
+
all active teams for a given user. Excludes archived seasons and retired teams.","data":[{"name":"user_id","value":null}]}],"commands":[{"rel":"invite","href":"http://localhost:3000/teams/invite","prompt":"invite
|
113
112
|
team members or contacts to join TeamSnap.","data":[{"name":"team_id","value":null},{"name":"contact_id","value":null},{"name":"member_id","value":null},{"name":"introduction","value":null},{"name":"notify_as_member_id","value":null}]},{"rel":"update_time_zone","href":"http://localhost:3000/teams/update_time_zone","prompt":"Update
|
114
|
-
team''s time zone.
|
115
|
-
|
113
|
+
team''s time zone. This is currently the only method of updating a team''s
|
114
|
+
time zone.","data":[{"name":"team_id","value":null},{"name":"time_zone","value":null},{"name":"offset_team_times","value":null}]},{"rel":"reset_statistics","href":"http://localhost:3000/teams/reset_statistics","prompt":"Deletes
|
115
|
+
all data, categories and groups for a given team_id","data":[{"name":"team_id","value":null}]}],"items":[{"href":"http://localhost:3000/teams/1","data":[{"name":"id","value":1},{"name":"type","value":"team"},{"name":"division_name","value":null},{"name":"division_id","value":null},{"name":"is_archived_season","value":false},{"name":"is_retired","value":false},{"name":"league_name","value":null},{"name":"league_url","value":null},{"name":"is_in_league","value":false},{"name":"location_country","value":"United
|
116
116
|
States"},{"name":"location_postal_code","value":"80951"},{"name":"location_latitude","value":null},{"name":"location_longitude","value":null},{"name":"name","value":"Base
|
117
117
|
Team"},{"name":"plan_id","value":14},{"name":"season_name","value":null},{"name":"sport_id","value":1},{"name":"time_zone_description","value":"Mountain
|
118
|
-
Time (US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"updated_at","value":"
|
118
|
+
Time (US & Canada)"},{"name":"time_zone_iana_name","value":"America/Denver"},{"name":"time_zone_offset","value":"-07:00"},{"name":"updated_at","value":"2016-02-08T20:04:08Z","type":"DateTime"},{"name":"created_at","value":"2016-02-08T20:04:06Z","type":"DateTime"},{"name":"has_reached_roster_limit","value":false},{"name":"roster_limit","value":30},{"name":"has_exportable_media","value":false},{"name":"can_export_media","value":false},{"name":"last_accessed_at","value":null,"type":"DateTime"},{"name":"media_storage_used","value":0},{"name":"humanized_media_storage_used","value":"0
|
119
|
+
B"}],"links":[{"rel":"assignments","href":"http://localhost:3000/assignments/search?team_id=1"},{"rel":"availabilities","href":"http://localhost:3000/availabilities/search?team_id=1"},{"rel":"broadcast_email_attachments","href":"http://localhost:3000/broadcast_email_attachments/search?team_id=1"},{"rel":"broadcast_emails","href":"http://localhost:3000/broadcast_emails/search?team_id=1"},{"rel":"broadcast_alerts","href":"http://localhost:3000/broadcast_alerts/search?team_id=1"},{"rel":"calendar_http","href":"http://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/08104750-b0cd-0133-8582-000c297f8dfc.ics"},{"rel":"calendar_http_games_only","href":"http://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/filter/games/08104750-b0cd-0133-8582-000c297f8dfc.ics"},{"rel":"calendar_webcal","href":"webcal://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/08104750-b0cd-0133-8582-000c297f8dfc.ics"},{"rel":"calendar_webcal_games_only","href":"webcal://86ed2e8eefaaee16c4b7-16391cffaf9272bff70e93998d553c16.r2.cf1.rackcdn.com/team_schedule/filter/games/08104750-b0cd-0133-8582-000c297f8dfc.ics"},{"rel":"contact_email_addresses","href":"http://localhost:3000/contact_email_addresses/search?team_id=1"},{"rel":"contact_phone_numbers","href":"http://localhost:3000/contact_phone_numbers/search?team_id=1"},{"rel":"contacts","href":"http://localhost:3000/contacts/search?team_id=1"},{"rel":"custom_data","href":"http://localhost:3000/custom_data/search?team_id=1"},{"rel":"custom_fields","href":"http://localhost:3000/custom_fields/search?team_id=1"},{"rel":"division_contact_email_addresses","href":"http://localhost:3000/division_contact_email_addresses/search?team_id=1"},{"rel":"division_contact_phone_numbers","href":"http://localhost:3000/division_contact_phone_numbers/search?team_id=1"},{"rel":"division_contacts","href":"http://localhost:3000/division_contacts/search?team_id=1"},{"rel":"division_locations","href":"http://localhost:3000/division_locations/search?team_id=1"},{"rel":"division_member_email_addresses","href":"http://localhost:3000/division_member_email_addresses/search?team_id=1"},{"rel":"division_member_phone_numbers","href":"http://localhost:3000/division_member_phone_numbers/search?team_id=1"},{"rel":"division_members","href":"http://localhost:3000/division_members/search?team_id=1"},{"rel":"division_members_preferences","href":"http://localhost:3000/division_members_preferences/search?team_id=1"},{"rel":"division_team_standings","href":"http://localhost:3000/division_team_standings/search?team_id=1"},{"rel":"forum_posts","href":"http://localhost:3000/forum_posts/search?team_id=1"},{"rel":"forum_subscriptions","href":"http://localhost:3000/forum_subscriptions/search?team_id=1"},{"rel":"forum_topics","href":"http://localhost:3000/forum_topics/search?team_id=1"},{"rel":"event_statistics","href":"http://localhost:3000/event_statistics/search?team_id=1"},{"rel":"events","href":"http://localhost:3000/events/search?team_id=1"},{"rel":"events_csv_export","href":"http://localhost:3000/exports/events_csv?hs=YszGJFFtdkxT%252Ba08BS5xyp1dHMOjVVvQPmlGdCebDpafs9qC6iM2Wgap55%252FDtoxV"},{"rel":"events_overview","href":"http://localhost:3000/events/overview?team_id=1"},{"rel":"league_custom_data","href":"http://localhost:3000/league_custom_data/search?team_id=1"},{"rel":"league_custom_fields","href":"http://localhost:3000/league_custom_fields/search?team_id=1"},{"rel":"league_registrant_documents","href":"http://localhost:3000/league_registrant_documents/search?member_id=1"},{"rel":"locations","href":"http://localhost:3000/locations/search?team_id=1"},{"rel":"managers","href":"http://localhost:3000/members/managers?team_id=1"},{"rel":"member_balances","href":"http://localhost:3000/member_balances/search?team_id=1"},{"rel":"member_email_addresses","href":"http://localhost:3000/member_email_addresses/search?team_id=1"},{"rel":"member_files","href":"http://localhost:3000/member_files/search?team_id=1"},{"rel":"member_links","href":"http://localhost:3000/member_links/search?team_id=1"},{"rel":"member_payments","href":"http://localhost:3000/member_payments/search?team_id=1"},{"rel":"member_phone_numbers","href":"http://localhost:3000/member_phone_numbers/search?team_id=1"},{"rel":"member_statistics","href":"http://localhost:3000/member_statistics/search?team_id=1"},{"rel":"members","href":"http://localhost:3000/members/search?team_id=1"},{"rel":"members_csv_export","href":"http://localhost:3000/exports/members_csv?hs=YszGJFFtdkxT%252Ba08BS5xyp1dHMOjVVvQPmlGdCebDpafs9qC6iM2Wgap55%252FDtoxV"},{"rel":"members_preferences","href":"http://localhost:3000/members_preferences/search?team_id=1"},{"rel":"opponents","href":"http://localhost:3000/opponents/search?team_id=1"},{"rel":"opponents_results","href":"http://localhost:3000/opponents_results/search?team_id=1"},{"rel":"owner","href":"http://localhost:3000/members/owner?team_id=1"},{"rel":"payment_notes","href":"http://localhost:3000/payment_notes/search?team_id=1"},{"rel":"paypal_currency","href":"http://localhost:3000/paypal_currencies/search?team_id=1"},{"rel":"plan","href":"http://localhost:3000/plans/14"},{"rel":"sponsors","href":"http://localhost:3000/sponsors/search?team_id=1"},{"rel":"sport","href":"http://localhost:3000/sports/1"},{"rel":"statistics","href":"http://localhost:3000/statistics/search?team_id=1"},{"rel":"statistic_aggregates","href":"http://localhost:3000/statistic_aggregates/search?team_id=1"},{"rel":"statistic_data","href":"http://localhost:3000/statistic_data/search?team_id=1"},{"rel":"statistic_groups","href":"http://localhost:3000/statistic_groups/search?team_id=1"},{"rel":"team_fees","href":"http://localhost:3000/team_fees/search?team_id=1"},{"rel":"team_media","href":"http://localhost:3000/team_media/search?team_id=1"},{"rel":"team_medium_comments","href":"http://localhost:3000/team_medium_comments/search?team_id=1"},{"rel":"team_media_groups","href":"http://localhost:3000/team_media_groups/search?team_id=1"},{"rel":"team_paypal_preferences","href":"http://localhost:3000/teams_paypal_preferences/1"},{"rel":"team_preferences","href":"http://localhost:3000/teams_preferences/1"},{"rel":"team_public_site","href":"http://localhost:3000/team_public_sites/1"},{"rel":"team_results","href":"http://localhost:3000/teams_results/1"},{"rel":"team_statistics","href":"http://localhost:3000/team_statistics/search?team_id=1"},{"rel":"tracked_item_statuses","href":"http://localhost:3000/tracked_item_statuses/search?team_id=1"},{"rel":"tracked_items","href":"http://localhost:3000/tracked_items/search?team_id=1"}],"rel":"team-1"}]}}'
|
119
120
|
http_version: '1.1'
|
120
121
|
adapter_metadata:
|
121
|
-
effective_url: http://localhost:3000/teams/1
|
122
|
-
recorded_at:
|
122
|
+
effective_url: http://localhost:3000/teams/1?hmac_client_id=classic&hmac_nonce=e4262cf8-af0a-455b-b17b-702e4b531f51&hmac_timestamp=1457726123
|
123
|
+
recorded_at: Fri, 11 Mar 2016 19:55:23 GMT
|
123
124
|
recorded_with: VCR 2.9.3
|
data/spec/spec_helper.rb
CHANGED
@@ -10,6 +10,7 @@ SimpleCov.start do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
require "vcr"
|
13
|
+
require "pry"
|
13
14
|
|
14
15
|
ROOT_TEST_URL = "http://localhost:3000"
|
15
16
|
|
@@ -18,6 +19,7 @@ VCR.configure do |c|
|
|
18
19
|
c.hook_into :typhoeus
|
19
20
|
c.configure_rspec_metadata!
|
20
21
|
c.default_cassette_options = {
|
22
|
+
:record => :once,
|
21
23
|
:match_requests_on => [
|
22
24
|
:method,
|
23
25
|
VCR.request_matchers.uri_without_params(
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "teamsnap"
|
3
|
+
|
4
|
+
RSpec.describe "teamsnap__client", :vcr => true do
|
5
|
+
let(:client_id) { "classic" }
|
6
|
+
let(:client_secret) { "dont_tell_the_cops" }
|
7
|
+
|
8
|
+
describe ".set_faraday_client" do
|
9
|
+
it "sets up a new Faraday connection to the api" do
|
10
|
+
expect(Faraday).to receive("new").with(any_args).and_call_original
|
11
|
+
TeamSnap::Client.set_faraday_client(
|
12
|
+
"localhost:3000",
|
13
|
+
nil,
|
14
|
+
"classic",
|
15
|
+
"dont_tell_the_cops"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".initialize" do
|
21
|
+
it "sets the instance attribute 'faraday_client'" do
|
22
|
+
client = TeamSnap::Client.new({
|
23
|
+
:url => ROOT_TEST_URL,
|
24
|
+
:client_id => client_id,
|
25
|
+
:client_secret => client_secret
|
26
|
+
})
|
27
|
+
expect(client.faraday_client).to_not be_nil
|
28
|
+
expect(client.faraday_client.class).to eq(Faraday::Connection)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when calling `via`'s on the client" do
|
33
|
+
let(:client) {
|
34
|
+
TeamSnap::Client.new({
|
35
|
+
:url => ROOT_TEST_URL,
|
36
|
+
:client_id => client_id,
|
37
|
+
:client_secret => client_secret
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
it "does not override any of the HTTP actions" do
|
42
|
+
expect(client.respond_to?(:get)).to be(false)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "does not raise an error when the HTTP actions are called" do
|
46
|
+
expect {
|
47
|
+
client.send(:get)
|
48
|
+
}.to_not raise_error
|
49
|
+
end
|
50
|
+
|
51
|
+
it "passes them to the faraday_client using method_missing" do
|
52
|
+
expect_any_instance_of(
|
53
|
+
TeamSnap::Client
|
54
|
+
).to receive(:method_missing).with(any_args).and_call_original
|
55
|
+
client.send(:get, "/", {})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#api" do
|
60
|
+
before(:all) do
|
61
|
+
VCR.use_cassette("apiv3-init") do
|
62
|
+
TeamSnap.init(
|
63
|
+
:url => ROOT_TEST_URL,
|
64
|
+
:client_id => "classic",
|
65
|
+
:client_secret => "dont_tell_the_cops"
|
66
|
+
)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it "Sends the proper information to TeamSnap::Api.run" do
|
71
|
+
expect(TeamSnap::Api).to receive(:run).with(TeamSnap.root_client, :find, TeamSnap::Team, 1, false)
|
72
|
+
TeamSnap.root_client.api(:find, TeamSnap::Team, 1)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "teamsnap"
|
3
|
+
|
4
|
+
RSpec.describe "teamsnap__collection", :vcr => true do
|
5
|
+
before(:all) do
|
6
|
+
VCR.use_cassette("apiv3-init") do
|
7
|
+
TeamSnap.init(
|
8
|
+
:url => ROOT_TEST_URL,
|
9
|
+
:client_id => "classic",
|
10
|
+
:client_secret => "dont_tell_the_cops"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "handles fetching data via queries" do
|
16
|
+
ts = TeamSnap::Team.search(TeamSnap.root_client, :id => 1)
|
17
|
+
|
18
|
+
expect(ts).to_not be_empty
|
19
|
+
expect(ts[0].id).to eq(1)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "handles queries with no data" do
|
23
|
+
ts = TeamSnap::Team.search(TeamSnap.root_client, :id => 0)
|
24
|
+
|
25
|
+
expect(ts).to be_empty
|
26
|
+
end
|
27
|
+
|
28
|
+
it "raises an exception when a query is invalid" do
|
29
|
+
expect {
|
30
|
+
TeamSnap::Team.search(TeamSnap.root_client, :foo => :bar)
|
31
|
+
}.to raise_error(
|
32
|
+
ArgumentError,
|
33
|
+
"Invalid argument(s). Valid argument(s) are [:id, :team_id, :user_id, :division_id, :page_size, :page_number]"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "handles executing an action via commands" do
|
38
|
+
ms = TeamSnap::Member.disable_member(TeamSnap.root_client, :member_id => 1)
|
39
|
+
|
40
|
+
expect(ms).to_not be_empty
|
41
|
+
expect(ms[0].id).to eq(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "handles executing an action via commands with multiple params" do
|
45
|
+
user_client = TeamSnap::Client.new({:token => "6-classic-dont_tell_the_cops"})
|
46
|
+
|
47
|
+
ms = TeamSnap::Team.invite(
|
48
|
+
user_client,
|
49
|
+
:team_id => 1, :member_id => [9, 11], :notify_as_member_id => 3,
|
50
|
+
:introduction => "Welcome! This is our team\n ...the superstars!"
|
51
|
+
)
|
52
|
+
|
53
|
+
expect(ms.size).to eq(2)
|
54
|
+
expect(ms.map(&:id)).to eq([9, 11])
|
55
|
+
expect(ms.map(&:is_invited)).to eq([true, true])
|
56
|
+
end
|
57
|
+
|
58
|
+
it "raises and exception when a command is invalid" do
|
59
|
+
expect {
|
60
|
+
TeamSnap::Member.disable_member(TeamSnap.root_client, :foo => :bar)
|
61
|
+
}.to raise_error(
|
62
|
+
ArgumentError,
|
63
|
+
"Invalid argument(s). Valid argument(s) are [:member_id]"
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "raises an ArgumentError if no client sent to the command" do
|
68
|
+
expect {
|
69
|
+
TeamSnap::Member.disable_member
|
70
|
+
}.to raise_error(
|
71
|
+
ArgumentError
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "can handle no argument errors generated by command" do
|
76
|
+
expect {
|
77
|
+
TeamSnap::Member.disable_member(TeamSnap.root_client)
|
78
|
+
}.to raise_error(
|
79
|
+
TeamSnap::Error,
|
80
|
+
"You must provide the member_id."
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "adds .find if .search is available" do
|
85
|
+
t = TeamSnap::Team.find(TeamSnap.root_client, 1)
|
86
|
+
|
87
|
+
expect(t.id).to eq(1)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "raises an exception if .find returns nothing" do
|
91
|
+
expect {
|
92
|
+
TeamSnap::Team.find(TeamSnap.root_client, 0)
|
93
|
+
}.to raise_error(
|
94
|
+
TeamSnap::NotFound,
|
95
|
+
"Could not find a TeamSnap::Team with an id of '0'."
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "can follow singular links" do
|
100
|
+
m = TeamSnap::Member.find(TeamSnap.root_client, 3)
|
101
|
+
t = m.team
|
102
|
+
|
103
|
+
expect(t.id).to eq(1)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "can handle links with no data" do
|
107
|
+
m = TeamSnap::Member.find(TeamSnap.root_client, 1)
|
108
|
+
as = m.assignments
|
109
|
+
|
110
|
+
expect(as).to be_empty
|
111
|
+
end
|
112
|
+
|
113
|
+
it "can follow plural links" do
|
114
|
+
t = TeamSnap::Team.find(TeamSnap.root_client, 1)
|
115
|
+
ms = t.members
|
116
|
+
|
117
|
+
expect(ms.size).to eq(17)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "adds href to items" do
|
121
|
+
m = TeamSnap::Member.find(TeamSnap.root_client, 1)
|
122
|
+
|
123
|
+
expect(m.href).to eq("#{ROOT_TEST_URL}/members/1")
|
124
|
+
end
|
125
|
+
|
126
|
+
context "supports relations with expected behaviors" do
|
127
|
+
let(:event) { TeamSnap::Event.find(TeamSnap.root_client, 1) }
|
128
|
+
|
129
|
+
context "when a plural relation is called" do
|
130
|
+
it "responds with an array of objects when successful" do
|
131
|
+
a = event.availabilities
|
132
|
+
expect(a.size).to be > 0
|
133
|
+
expect(a).to be_an(Array)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "responds with an empty array when no objects exist" do
|
137
|
+
a = event.assignments
|
138
|
+
expect(a.size).to eq(0)
|
139
|
+
expect(a).to be_an(Array)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context "when a singular relation is called" do
|
144
|
+
it "responds with the object if it exists" do
|
145
|
+
a = event.team
|
146
|
+
expect(a).to be_a(TeamSnap::Team)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "responds with nil if it does NOT exist" do
|
150
|
+
a = event.division_location
|
151
|
+
expect(a).to be_a(NilClass)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|