teamsnap_rb 2.0.0.beta6 → 2.0.0.beta7

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +1 -0
  4. data/lib/teamsnap/item.rb +9 -2
  5. data/lib/teamsnap/version.rb +1 -1
  6. data/spec/cassettes/apiv3-init.yml +241 -166
  7. data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/does_not_raise_an_error_when_the_HTTP_actions_are_called.yml +12 -10
  8. data/spec/cassettes/teamsnap__client/when_calling_via_s_on_the_client/passes_them_to_the_faraday_client_using_method_missing.yml +12 -10
  9. data/spec/cassettes/teamsnap__collection/adds_find_if_search_is_available.yml +19 -14
  10. data/spec/cassettes/teamsnap__collection/adds_href_to_items.yml +20 -13
  11. data/spec/cassettes/teamsnap__collection/can_follow_plural_links.yml +87 -45
  12. data/spec/cassettes/teamsnap__collection/can_follow_singular_links.yml +39 -27
  13. data/spec/cassettes/teamsnap__collection/can_handle_links_with_no_data.yml +28 -21
  14. data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands.yml +20 -13
  15. data/spec/cassettes/teamsnap__collection/handles_executing_an_action_via_commands_with_multiple_params.yml +19 -11
  16. data/spec/cassettes/teamsnap__collection/handles_fetching_data_via_queries.yml +19 -14
  17. data/spec/cassettes/teamsnap__collection/handles_queries_with_no_data.yml +15 -11
  18. data/spec/cassettes/teamsnap__collection/raises_an_exception_if_find_returns_nothing.yml +15 -11
  19. 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 +26 -24
  20. 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 +22 -20
  21. 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 +25 -22
  22. data/spec/cassettes/teamsnap__collection/supports_relations_with_expected_behaviors/when_a_singular_relation_is_called/responds_with_the_object_if_it_exists.yml +33 -26
  23. data/spec/cassettes/teamsnap__structure/_create_collection_class/registers_new_classes_via_introspection_of_the_root_collection.yml +15 -11
  24. data/spec/cassettes/teamsnap__structure/_create_collection_class/sets_the_href_attribute_on_the_new_class.yml +15 -11
  25. data/spec/cassettes/teamsnap__structure/_init/has_all_classes_in_schema_loaded_except_for_exceptions_list_endpoints.yml +12 -10
  26. data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_empty_bulk_load.yml +8 -8
  27. data/spec/cassettes/teamsnap_rb/_bulk_load/can_handle_an_error_with_bulk_load_without_a_team_id.yml +6 -6
  28. data/spec/cassettes/teamsnap_rb/_bulk_load/can_use_bulk_load.yml +65 -32
  29. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_DELETE_on_the_given_client.yml +242 -85
  30. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_GET_on_the_given_client.yml +12 -10
  31. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_PATCH_on_the_given_client.yml +242 -85
  32. data/spec/cassettes/teamsnap_rb/_client_send/when_sent_a_known_via_/calls_POST_on_the_given_client.yml +242 -85
  33. data/spec/cassettes/teamsnap_rb/_run/processes_the_response.yml +48 -40
  34. data/spec/spec_helper.rb +1 -0
  35. data/spec/teamsnap/item_spec.rb +35 -0
  36. data/spec/teamsnap_spec.rb +1 -1
  37. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f52464e6a2e0dcb607c8cb48f44da22fcb99088c
4
- data.tar.gz: e7a00559a594e50b8e2681cae0ca9f17f37d68fe
3
+ metadata.gz: 6bbbfb0eb985d89e7009bf7956ceaab3147713ea
4
+ data.tar.gz: 05d0073aee1f78775dcd9ec7e4b529edf2f8b460
5
5
  SHA512:
6
- metadata.gz: fdd9bd671fea6da070c628d12d2423b6a9bd88c2990e357755f2e23e87dd2a4a63bddd11c6b309739803505207396a5a2ae4a770dcc2d181a8b9800e1eed49cf
7
- data.tar.gz: 7e1d60b58f8ea299f5a16284ad90f51095c333b3602d9a61ad9a974beeabde7bcb11ce12ed96c1408098c2ca42ebf5fc3f27039d81734ffba3a2900784978971
6
+ metadata.gz: ce2af9e4cea53fdeb17012de5b81c570161276c26b910990ad6096c9b28166dd2bbafbdecc59c6b45524942bbb40e390e83e11a3f6147c4b542d2e8841d97da7
7
+ data.tar.gz: e5fc0b16bb19697e977f2f16f5cfda71bc9059e46db8a81bd62d14762b5821ee4888dfba8ae906945b58850060eb3eff6c9d8efabf74a0801505317cbbda854c
data/CHANGELOG.md CHANGED
@@ -25,3 +25,8 @@ v2.0.0.beta6
25
25
  ------
26
26
 
27
27
  - Handle errors when response body is an empty string
28
+
29
+ v2.0.0.beta7
30
+ ------
31
+
32
+ - Add attibutes to an Item if it's missing them
data/Gemfile CHANGED
@@ -3,5 +3,6 @@ source "https://rubygems.org"
3
3
  gem "simplecov", :require => false
4
4
  gem "coveralls", :require => false
5
5
  gem "pry", :require => false
6
+ gem "awesome_print"
6
7
 
7
8
  gemspec
data/lib/teamsnap/item.rb CHANGED
@@ -42,12 +42,19 @@ module TeamSnap
42
42
 
43
43
  def load_class(type, data)
44
44
  TeamSnap.const_get(Inflecto.camelize(type), false).tap { |cls|
45
- unless cls.include?(Virtus::Model::Core)
45
+ if cls.include?(Virtus::Model::Core)
46
+ cls.class_eval do
47
+ attributes = cls.attribute_set.map(&:name)
48
+ data
49
+ .select { |name, _| !attributes.include?(name.to_sym) }
50
+ .each { |name, value| attribute name, value.class }
51
+ end
52
+ else
46
53
  cls.class_eval do
47
54
  include Virtus.value_object
48
55
 
56
+ attribute :href, String
49
57
  values do
50
- attribute :href, String
51
58
  data.each { |name, value| attribute name, value.class }
52
59
  end
53
60
  end
@@ -1,3 +1,3 @@
1
1
  module TeamSnap
2
- VERSION = "2.0.0.beta6"
2
+ VERSION = "2.0.0.beta7"
3
3
  end