teamsnap_rb 2.4.0 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +16 -0
  3. data/.github/workflows/ci.yml +25 -0
  4. data/.gitignore +1 -1
  5. data/.teamsnap/service.yml +18 -0
  6. data/CHANGELOG.md +12 -0
  7. data/CODEOWNERS +1 -0
  8. data/Gemfile +0 -2
  9. data/README.md +4 -6
  10. data/Rakefile +0 -5
  11. data/lib/teamsnap/api.rb +2 -1
  12. data/lib/teamsnap/auth_middleware.rb +2 -0
  13. data/lib/teamsnap/response.rb +7 -1
  14. data/lib/teamsnap/structure.rb +1 -1
  15. data/lib/teamsnap/version.rb +1 -1
  16. data/lib/teamsnap.rb +5 -1
  17. data/spec/cassettes/apiv3-init.yml +850 -236
  18. data/spec/cassettes/teamsnap__api/_run/when_creating/when_successful/can_parse_the_json.yml +73 -0
  19. data/spec/cassettes/teamsnap__api/_run/when_deleting/when_successful/handles_empty_response_body.yml +38 -0
  20. data/spec/cassettes/teamsnap__client/_api/Sends_the_proper_information_to_TeamSnap_Api_run.yml +87 -0
  21. 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
  22. data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/passes_them_to_the_faraday_client_using_method_missing.yml +24 -17
  23. data/spec/cassettes/teamsnap__client/when_specifying_a_headers_flag/correctly_sets_the_ghost_header_flag.yml +846 -232
  24. data/spec/cassettes/teamsnap__client/when_specifying_a_headers_flag/won_t_set_feature_headers_without_the_header_variable_present.yml +847 -232
  25. data/spec/cassettes/teamsnap__collection/_items/returns_all_items_for_a_base_collection.yml +68 -63
  26. data/spec/cassettes/teamsnap__collection/adds_find_if_search_is_available.yml +44 -27
  27. data/spec/cassettes/teamsnap__collection/adds_href_to_items.yml +132 -33
  28. data/spec/cassettes/teamsnap__collection/can_follow_plural_links.yml +421 -136
  29. data/spec/cassettes/teamsnap__collection/can_follow_singular_links.yml +175 -59
  30. data/spec/cassettes/teamsnap__collection/can_handle_links_with_no_data.yml +155 -53
  31. data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands.yml +132 -33
  32. data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands_with_multiple_params.yml +75 -35
  33. data/spec/cassettes/teamsnap__collection/handles_fetching_data_via_queries.yml +44 -27
  34. data/spec/cassettes/teamsnap__collection/handles_queries_with_no_data.yml +36 -22
  35. data/spec/cassettes/teamsnap__collection/raises_an_exception_if_find_returns_nothing.yml +36 -22
  36. 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
  37. 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
  38. 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
  39. 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
  40. data/spec/cassettes/teamsnap__structure/_create_collection_class/registers_new_classes_via_introspection_of_the_root_collection.yml +36 -22
  41. data/spec/cassettes/teamsnap__structure/_create_collection_class/sets_the_href_attribute_on_the_new_class.yml +36 -22
  42. data/spec/cassettes/teamsnap__structure/_init/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +24 -17
  43. data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_empty_bulk_load.yml +16 -16
  44. data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_error_with_bulk_load_without_a_team_id.yml +14 -14
  45. data/spec/cassettes/teamsnap_rb/_bulk_load/can_use_bulk_load.yml +291 -103
  46. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/accepts_test_file_arg_when_creating_HMAC.yml +82 -2653
  47. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_DELETE_on_the_given_client.yml +67 -2639
  48. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_GET_on_the_given_client.yml +24 -17
  49. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_PATCH_on_the_given_client.yml +67 -2639
  50. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_POST_on_the_given_client.yml +67 -2639
  51. data/spec/cassettes/teamsnap_rb/_run/processes_the_response.yml +93 -65
  52. data/spec/cassettes/uploading_files/uploads_a_file.yml +130 -31
  53. data/spec/cassettes/uploading_files/uploads_a_tempfile.yml +130 -31
  54. data/spec/features/uploading_files_spec.rb +2 -2
  55. data/spec/spec_helper.rb +0 -13
  56. data/spec/teamsnap/apiv_spec.rb +49 -1
  57. data/spec/teamsnap/client_spec.rb +4 -4
  58. data/spec/teamsnap/collection_spec.rb +5 -5
  59. data/spec/teamsnap/item_spec.rb +1 -1
  60. data/spec/teamsnap/structure_spec.rb +2 -2
  61. data/spec/teamsnap_spec.rb +4 -4
  62. data/teamsnap_rb.gemspec +5 -5
  63. metadata +35 -20
  64. data/.travis.yml +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa6ef11bfccf2b3846e2cb4ab9a57f72d1cc2fb82adc6ea1433fd8264a2d5750
4
- data.tar.gz: 122ae6174ae38b9bffefc02df3851ca44138de3b086f18cfbb444a0c4fe506c4
3
+ metadata.gz: 65fa1fab57e2094874e75372f76d61c6109e3635374c248527392a1c26fa6bc7
4
+ data.tar.gz: '05280c4fb4a5c68271108348fdebbe0819268197008c7de4e69998f97060426d'
5
5
  SHA512:
6
- metadata.gz: 13b9cc1026d33b11a770a4ea94ad9943681c7c13d745ec16715092dd0343afc52e7c5978d1475a0a3d5c0b433178cfd8dce42bf509971f3c201676b5a9c04a74
7
- data.tar.gz: 2f4523e62d26aecbf65aa9ea8b18cc88f05ffc50b393290f7d85f44218eea3d3a3ee92ba8dba4152eab62b9b7ce9f563fdedbaaa0d2c45529d0a1532e0fd1ebd
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
@@ -11,7 +11,6 @@ capybara-*.html
11
11
  /tmp/*
12
12
  /db/*.sqlite3
13
13
  /public/system/*
14
- /coverage/
15
14
  /spec/tmp/*
16
15
  **.orig
17
16
  rerun.txt
@@ -25,3 +24,4 @@ config/*.yml
25
24
  /bin/stubs
26
25
  /bin
27
26
  /pkg
27
+ .DS_Store
@@ -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
@@ -1,7 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "simplecov", "0.14.1", :require => false
4
- gem "coveralls", "0.8.21", :require => false
5
3
  gem "pry", :require => false
6
4
  gem "rack-test", "0.7.0", :require => false
7
5
  gem "rack", ">= 1.6.11", :require => false
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # teamsnap_rb
2
2
 
3
- [![Quality](http://img.shields.io/codeclimate/github/teamsnap/teamsnap_rb.svg)](https://codeclimate.com/github/teamsnap/teamsnap_rb)
4
- [![Coverage](http://img.shields.io/coveralls/teamsnap/teamsnap_rb.svg)](https://coveralls.io/r/teamsnap/teamsnap_rb)
5
- [![Build](http://img.shields.io/travis-ci/teamsnap/teamsnap_rb.svg)](https://travis-ci.org/teamsnap/teamsnap_rb)
6
- [![Version](http://img.shields.io/gem/v/teamsnap_rb.svg)](https://rubygems.org/gems/teamsnap_rb)
7
- [![License](http://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
3
+ ![CI](https://github.com/teamsnap/teamsnap_rb/workflows/CI/badge.svg)
4
+ [![Gem Version](https://badge.fury.io/rb/teamsnap_rb.svg)](https://badge.fury.io/rb/teamsnap_rb)
5
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](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/documentation/apiv3/)_
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 [Fixnum, String].include?(args.class)
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)}"
@@ -1,3 +1,5 @@
1
+ require 'openssl'
2
+
1
3
  module TeamSnap
2
4
  class AuthMiddleware < Faraday::Middleware
3
5
  def initialize(app, options)
@@ -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 = JSON.parse(@resp.body, :symbolize_names => true) || {}
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)
@@ -10,7 +10,7 @@ module TeamSnap
10
10
  .find { |link| link[:rel] == "schemas" } || {}
11
11
 
12
12
  if schema[:href]
13
- resp = client.get(schema[:href])
13
+ resp = client.get(schema[:href].gsub("/v3",""))
14
14
  classes = setup_model_classes(collection, resp)
15
15
  else
16
16
  client.in_parallel do
@@ -1,3 +1,3 @@
1
1
  module TeamSnap
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.2"
3
3
  end
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)