teamsnap_rb 2.4.0 → 2.4.2
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/.github/stale.yml +16 -0
- data/.github/workflows/ci.yml +25 -0
- data/.gitignore +1 -1
- data/.teamsnap/service.yml +18 -0
- data/CHANGELOG.md +12 -0
- data/CODEOWNERS +1 -0
- data/Gemfile +0 -2
- data/README.md +4 -6
- data/Rakefile +0 -5
- data/lib/teamsnap/api.rb +2 -1
- data/lib/teamsnap/auth_middleware.rb +2 -0
- data/lib/teamsnap/response.rb +7 -1
- data/lib/teamsnap/structure.rb +1 -1
- data/lib/teamsnap/version.rb +1 -1
- data/lib/teamsnap.rb +5 -1
- data/spec/cassettes/apiv3-init.yml +850 -236
- data/spec/cassettes/teamsnap__api/_run/when_creating/when_successful/can_parse_the_json.yml +73 -0
- data/spec/cassettes/teamsnap__api/_run/when_deleting/when_successful/handles_empty_response_body.yml +38 -0
- data/spec/cassettes/teamsnap__client/_api/Sends_the_proper_information_to_TeamSnap_Api_run.yml +87 -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 +24 -17
- data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/passes_them_to_the_faraday_client_using_method_missing.yml +24 -17
- data/spec/cassettes/teamsnap__client/when_specifying_a_headers_flag/correctly_sets_the_ghost_header_flag.yml +846 -232
- data/spec/cassettes/teamsnap__client/when_specifying_a_headers_flag/won_t_set_feature_headers_without_the_header_variable_present.yml +847 -232
- data/spec/cassettes/teamsnap__collection/_items/returns_all_items_for_a_base_collection.yml +68 -63
- data/spec/cassettes/teamsnap__collection/adds_find_if_search_is_available.yml +44 -27
- data/spec/cassettes/teamsnap__collection/adds_href_to_items.yml +132 -33
- data/spec/cassettes/teamsnap__collection/can_follow_plural_links.yml +421 -136
- data/spec/cassettes/teamsnap__collection/can_follow_singular_links.yml +175 -59
- data/spec/cassettes/teamsnap__collection/can_handle_links_with_no_data.yml +155 -53
- data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands.yml +132 -33
- data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands_with_multiple_params.yml +75 -35
- data/spec/cassettes/teamsnap__collection/handles_fetching_data_via_queries.yml +44 -27
- data/spec/cassettes/teamsnap__collection/handles_queries_with_no_data.yml +36 -22
- data/spec/cassettes/teamsnap__collection/raises_an_exception_if_find_returns_nothing.yml +36 -22
- 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 +63 -51
- 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 +57 -47
- 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 +49 -42
- data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_the_object_if_it_exists.yml +77 -53
- data/spec/cassettes/teamsnap__structure/_create_collection_class/registers_new_classes_via_introspection_of_the_root_collection.yml +36 -22
- data/spec/cassettes/teamsnap__structure/_create_collection_class/sets_the_href_attribute_on_the_new_class.yml +36 -22
- data/spec/cassettes/teamsnap__structure/_init/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +24 -17
- data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_empty_bulk_load.yml +16 -16
- data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_error_with_bulk_load_without_a_team_id.yml +14 -14
- data/spec/cassettes/teamsnap_rb/_bulk_load/can_use_bulk_load.yml +291 -103
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/accepts_test_file_arg_when_creating_HMAC.yml +82 -2653
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_DELETE_on_the_given_client.yml +67 -2639
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_GET_on_the_given_client.yml +24 -17
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_PATCH_on_the_given_client.yml +67 -2639
- data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_POST_on_the_given_client.yml +67 -2639
- data/spec/cassettes/teamsnap_rb/_run/processes_the_response.yml +93 -65
- data/spec/cassettes/uploading_files/uploads_a_file.yml +130 -31
- data/spec/cassettes/uploading_files/uploads_a_tempfile.yml +130 -31
- data/spec/features/uploading_files_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -13
- data/spec/teamsnap/apiv_spec.rb +49 -1
- data/spec/teamsnap/client_spec.rb +4 -4
- data/spec/teamsnap/collection_spec.rb +5 -5
- data/spec/teamsnap/item_spec.rb +1 -1
- data/spec/teamsnap/structure_spec.rb +2 -2
- data/spec/teamsnap_spec.rb +4 -4
- data/teamsnap_rb.gemspec +5 -5
- metadata +35 -20
- data/.travis.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65fa1fab57e2094874e75372f76d61c6109e3635374c248527392a1c26fa6bc7
|
4
|
+
data.tar.gz: '05280c4fb4a5c68271108348fdebbe0819268197008c7de4e69998f97060426d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 112f4bb7fbd681c699968b2f9b40a1bfa51851845e65cab71763c5ee8ba5091165b0cbe750b943197bab1ee457db5f045e5de7a23abc9c832c124fc70b3e9b7c
|
7
|
+
data.tar.gz: a370d7f17ed435193bea2867a679e18117cb25802ac208e89261d3f5a2a0a96baaa62853665227e68279c2a00c2b655480c100fa7e51888756438cdba7eecfc4
|
data/.github/stale.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
2
|
+
daysUntilStale: 30
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
4
|
+
daysUntilClose: 3
|
5
|
+
# Issues with these labels will never be considered stale
|
6
|
+
exemptLabels:
|
7
|
+
- security
|
8
|
+
# Label to use when marking an issue as stale
|
9
|
+
staleLabel: wontfix
|
10
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
11
|
+
markComment: >
|
12
|
+
This issue has been automatically marked as stale because it has not had
|
13
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
14
|
+
for your contributions.
|
15
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
16
|
+
closeComment: false
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby: [ '2.3.8', '2.4.10', '2.5.8', '2.6.6' ]
|
16
|
+
max-parallel: 1
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
25
|
+
- run: bundle exec rspec
|
data/.gitignore
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
classification: lib
|
3
|
+
production:
|
4
|
+
tier: 1
|
5
|
+
url:
|
6
|
+
hosting_platform:
|
7
|
+
performance_monitoring: []
|
8
|
+
error_monitoring: []
|
9
|
+
continuous_integration:
|
10
|
+
- name: github_actions
|
11
|
+
reference_id: ci.yml
|
12
|
+
bug_tracking: []
|
13
|
+
documentation: []
|
14
|
+
deployment: []
|
15
|
+
languages:
|
16
|
+
- name: Ruby
|
17
|
+
version: 2.5.8
|
18
|
+
frameworks: []
|
data/CHANGELOG.md
CHANGED
@@ -105,3 +105,15 @@ v2.0.0
|
|
105
105
|
|
106
106
|
- Remove Oj gem dependency
|
107
107
|
- Update faraday dependency to allow version 0.17
|
108
|
+
|
109
|
+
[v2.4.1](https://github.com/teamsnap/teamsnap_rb/pull/118)
|
110
|
+
------
|
111
|
+
|
112
|
+
- Fix bug with json gem not parsing empty resopnse body
|
113
|
+
- Fix bug with OpenSSL on Ruby 2.5+
|
114
|
+
- Fix deprecation on ::Fixnum constant
|
115
|
+
|
116
|
+
[v2.4.2](https://github.com/teamsnap/teamsnap_rb/pull/118)
|
117
|
+
------
|
118
|
+
|
119
|
+
- fix: strip /v3 prefix for compatibility for k8s internal ingress
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @teamsnap/ruby
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# teamsnap_rb
|
2
2
|
|
3
|
-
|
4
|
-
[](https://rubygems.org/gems/teamsnap_rb)
|
7
|
-
[](http://opensource.org/licenses/MIT)
|
3
|
+

|
4
|
+
[](https://badge.fury.io/rb/teamsnap_rb)
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
8
6
|
|
9
7
|
## Usage
|
10
8
|
|
11
9
|
_Note: You'll need an OAuth2 Token from TeamSnap. Checkout our API docs
|
12
|
-
[here](http://developer.teamsnap.com/
|
10
|
+
[here](http://developer.teamsnap.com/apiv3/)_
|
13
11
|
|
14
12
|
λ gem install teamsnap_rb
|
15
13
|
λ irb
|
data/Rakefile
CHANGED
@@ -2,17 +2,12 @@ require "rubygems"
|
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rake/clean"
|
4
4
|
require "rspec/core/rake_task"
|
5
|
-
require "coveralls/rake/task"
|
6
|
-
|
7
|
-
CLOBBER.include("coverage")
|
8
5
|
|
9
6
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
10
7
|
t.fail_on_error = false
|
11
8
|
end
|
12
9
|
task :default => :spec
|
13
10
|
|
14
|
-
Coveralls::RakeTask.new
|
15
|
-
|
16
11
|
desc "start an IRB session with teamsnap loaded"
|
17
12
|
task :console do
|
18
13
|
require "pry"
|
data/lib/teamsnap/api.rb
CHANGED
@@ -3,6 +3,7 @@ module TeamSnap
|
|
3
3
|
|
4
4
|
CRUD_METHODS = [:find, :create, :update, :delete]
|
5
5
|
CRUD_VIAS = [:get, :post, :patch, :delete]
|
6
|
+
INTEGER_CLASS = 1.class # To handle Fixnum on Ruby 2.3 and Integer on 2.4+
|
6
7
|
|
7
8
|
def self.run(client, method, klass, args = {}, template_args = false)
|
8
9
|
klass = klass.class == Symbol ? get_class(klass) : klass
|
@@ -40,7 +41,7 @@ module TeamSnap
|
|
40
41
|
def self.href(base_href, method, args = {})
|
41
42
|
case method
|
42
43
|
when :find, :delete
|
43
|
-
if [
|
44
|
+
if [INTEGER_CLASS, String].include?(args.class)
|
44
45
|
base_href + "/#{args}"
|
45
46
|
elsif args.class == Hash
|
46
47
|
base_href + "/#{args.fetch(:id)}"
|
data/lib/teamsnap/response.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module TeamSnap
|
2
4
|
class Response
|
3
5
|
|
@@ -76,7 +78,11 @@ module TeamSnap
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def process_action
|
79
|
-
body =
|
81
|
+
body = if @resp.body.nil? || @resp.body.empty?
|
82
|
+
{}
|
83
|
+
else
|
84
|
+
JSON.parse(@resp.body, :symbolize_names => true) || {}
|
85
|
+
end
|
80
86
|
@collection = body.fetch(:collection) { {} }
|
81
87
|
@message = "`#{@via}` call was successful"
|
82
88
|
@objects = TeamSnap::Item.load_items(@client, @collection)
|
data/lib/teamsnap/structure.rb
CHANGED
data/lib/teamsnap/version.rb
CHANGED
data/lib/teamsnap.rb
CHANGED
@@ -11,7 +11,11 @@
|
|
11
11
|
|
12
12
|
module TeamSnap
|
13
13
|
EXCLUDED_RELS = %w(me apiv2_root root self dude sweet random xyzzy schemas
|
14
|
-
authorization plans_all tsl_photos
|
14
|
+
authorization authorization_root plans_all tsl_photos
|
15
|
+
authorization_magic_links authorization_password_resets
|
16
|
+
authorization_tokens authorization_user_registrations
|
17
|
+
authorization_user_registration_initializations
|
18
|
+
authorization_users card_feed)
|
15
19
|
DEFAULT_URL = "https://apiv3.teamsnap.com"
|
16
20
|
Error = Class.new(StandardError)
|
17
21
|
NotFound = Class.new(TeamSnap::Error)
|