tito_ruby 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12e525061a6eb7a57d6d38ded7e37484ad4bf99cff3bc6dbb3b255667485aa98
4
- data.tar.gz: 52be4e37d656838e821b668ee49344e6e1e9839b0106c89d294eb39dd4c7985c
3
+ metadata.gz: 73cbde370966ff7bd4126f3d3fddd9b9fa4efd3a891b777cbc7374abff3c5c91
4
+ data.tar.gz: 59c29faa752f290d6a24dc7e1b3b84fc83387eb21cf2194078cc5c02505b6e19
5
5
  SHA512:
6
- metadata.gz: bd789d6806949407ec212d36ddf8950a9d53ec9d7ffc5ae995759d0bc905aac16df6ce2a55c0d535c469a552f903527c07a3634a50c74cdc6844c48089d78d8c
7
- data.tar.gz: 304f031d911a74b35e411c1cea57f6abc9496697945f0026cae8ed741f013c8e807bad7c9546f4a8332cd0a715201cf281d85122108553a42f9b77a222598590
6
+ metadata.gz: 9facfcdc3beb4fc65845be8770ef7dc3734dd3d5f946d3da52d8a7ea92a436da0afdd2f45f5f751fb5b38a45dcff2fee58a978b905fc9fb7a9102bf16d553b31
7
+ data.tar.gz: 7cadc85147c5319f7f23a6bc0fe097af3a6ce8a3b08bd46c67852268ddeb770f5d5ec9de61a224d1f9493124de3f75350da5c267d6f002b721c58b759f7f14bf
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0 (Unreleased)
3
+ ## 0.2.0 (Unreleased)
4
+
5
+ - Updated all resource definitions to match actual Tito API v3 responses
6
+ - Fixed Resource to silently drop unknown attributes from API responses instead of crashing
7
+ - Fixed WebhookEndpoint: changed from account-scoped to event-scoped to match API
8
+ - Added VCR integration tests covering list, find, create, and delete for most resources
9
+ - Fixed field types: Event.metadata, Release.metadata, Registration.metadata now `:json`; Question.options now `:json` (array); Ticket.event now `:json` (object)
10
+ - Added many missing fields to Event, Release, Registration, Discount Code, Question, Activity, and Release Invitation resources
11
+ - Removed fields not present in API responses (e.g. Activity.show_to_attendee)
12
+
13
+ ## 0.1.0
4
14
 
5
15
  **WARNING:** This is pre-release, mostly-Claude-code-generated, mostly-untested software. It mostly doesn't work at all. Only the Tickets resource is known even to successfully load data. Use at your own risk.
6
16
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Ruby client for the [Tito](https://ti.to) Admin API v3.
4
4
 
5
- **WARNING:** This is pre-release, mostly-Claude-code-generated, mostly-untested software. It mostly doesn't work at all. Only the Tickets resource is known even to successfully load data. Use at your own risk.
5
+ **WARNING:** This is a very early release, and I'm only using a small portion of it, so although we have automated tests, most of them are not backed up by real-world experience.
6
6
 
7
7
  ## Installation
8
8
 
@@ -98,14 +98,29 @@ client.tickets
98
98
  .each { |t| puts t.reference }
99
99
  ```
100
100
 
101
- ### Available Resources
102
-
103
- - Events, Releases, Tickets, Registrations
104
- - Activities, Questions, Answers
105
- - Discount Codes, Checkin Lists
106
- - Opt-Ins, Interested Users, RSVP Lists
107
- - Release Invitations, Waitlisted People
108
- - Webhook Endpoints, Refunds, Venues
101
+ ### Resource Status
102
+
103
+ | Resource | List | Find | Create | Update | Delete | Notes |
104
+ |----------|------|------|--------|--------|--------|-------|
105
+ | Events | :white_check_mark: | :white_check_mark: | :grey_question: | :grey_question: | :grey_question: | Account-scoped |
106
+ | Releases | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: | :white_check_mark: | |
107
+ | Tickets | :white_check_mark: | :white_check_mark: | :grey_question: | :grey_question: | N/A | |
108
+ | Registrations | :white_check_mark: | :white_check_mark: | :grey_question: | :grey_question: | N/A | |
109
+ | Questions | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
110
+ | Answers | :grey_question: | :grey_question: | N/A | N/A | N/A | Nested under Questions |
111
+ | Discount Codes | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | |
112
+ | Activities | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | |
113
+ | Checkin Lists | :x: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | List broken by Tito API bug |
114
+ | Opt-Ins | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | |
115
+ | Interested Users | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | |
116
+ | RSVP Lists | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | |
117
+ | Release Invitations | :white_check_mark: | :grey_question: | :grey_question: | :grey_question: | :grey_question: | Nested under RSVP Lists |
118
+ | Webhook Endpoints | :white_check_mark: | :grey_question: | :white_check_mark: | :grey_question: | :white_check_mark: | Event-scoped |
119
+ | Waitlisted People | :white_check_mark: | :grey_question: | :grey_question: | :grey_question: | :grey_question: | |
120
+ | Refunds | :grey_question: | :grey_question: | N/A | N/A | N/A | Nested under Registrations |
121
+ | Venues | :white_check_mark: | :grey_question: | :grey_question: | :grey_question: | :grey_question: | |
122
+
123
+ :white_check_mark: = tested against live API  :grey_question: = implemented but untested  :x: = known broken
109
124
 
110
125
  ## Development
111
126
 
@@ -28,10 +28,6 @@ module Tito
28
28
  collection_for(Resources::Event, path_suffix: "/archived")
29
29
  end
30
30
 
31
- def webhook_endpoints
32
- collection_for(Resources::WebhookEndpoint)
33
- end
34
-
35
31
  # -- Event-scoped resources --
36
32
 
37
33
  def tickets(event: self.event)
@@ -82,6 +78,10 @@ module Tito
82
78
  collection_for(Resources::Venue, event: event)
83
79
  end
84
80
 
81
+ def webhook_endpoints(event: self.event)
82
+ collection_for(Resources::WebhookEndpoint, event: event)
83
+ end
84
+
85
85
  private
86
86
 
87
87
  def collection_for(resource_class, event: nil, path_suffix: nil)
@@ -19,9 +19,8 @@ module Tito
19
19
  attribute :capacity, :integer
20
20
  attribute :allocation_count, :integer
21
21
  attribute :sold_out, :boolean
22
- attribute :show_to_attendee, :boolean
23
- attribute :created_at, :datetime
24
- attribute :updated_at, :datetime
22
+ attribute :kind, :string
23
+ attribute :any_live_chosen_tickets, :boolean
25
24
 
26
25
  expandable :questions, :releases, :upgrades, :venue
27
26
 
@@ -24,12 +24,12 @@ module Tito
24
24
  attribute :share_url, :string
25
25
  attribute :description, :string
26
26
  attribute :description_for_organizer, :string
27
- attribute :show_public_releases, :boolean
28
- attribute :show_secret_releases, :boolean
27
+ attribute :only_show_attached, :boolean
28
+ attribute :reveal_secret, :boolean
29
+ attribute :show_public_releases, :string
30
+ attribute :show_secret_releases, :string
29
31
  attribute :block_registrations_if_not_applicable, :boolean
30
32
  attribute :disable_for_degressive, :boolean
31
- attribute :created_at, :datetime
32
- attribute :updated_at, :datetime
33
33
  end
34
34
  end
35
35
  end
@@ -9,46 +9,134 @@ module Tito
9
9
  collection_name "events"
10
10
  supports :list, :show, :create, :update, :delete
11
11
 
12
+ # Identity
12
13
  attribute :id, :integer
13
14
  attribute :slug, :string
14
15
  attribute :title, :string
16
+ attribute :display_title, :string
17
+ attribute :description, :string
15
18
  attribute :url, :string
19
+ attribute :currency, :string
20
+ attribute :location, :string
21
+
22
+ # Account
16
23
  attribute :account_id, :integer
17
24
  attribute :account_slug, :string
18
- attribute :currency, :string
19
25
  attribute :email_address, :string
20
- attribute :description, :string
26
+ attribute :from_email, :string
27
+ attribute :reply_to_email, :string
28
+
29
+ # Display
30
+ attribute :banner, :json
31
+ attribute :banner_url, :string
32
+ attribute :banner_alt_text, :string
33
+ attribute :logo, :json
34
+ attribute :display_date, :string
35
+ attribute :homepage_url, :string
36
+ attribute :theme, :string
21
37
 
38
+ # Dates
22
39
  attribute :start_date, :string
23
40
  attribute :start_time, :string
24
41
  attribute :end_date, :string
25
42
  attribute :end_time, :string
43
+ attribute :start_at, :datetime
44
+ attribute :end_at, :datetime
26
45
  attribute :timezone, :string
46
+ attribute :date_or_range, :string
47
+ attribute :happening_in, :string
48
+ attribute :day_number, :integer
49
+ attribute :days_until, :integer
50
+ attribute :days_since, :integer
27
51
 
52
+ # Status
28
53
  attribute :live, :boolean
29
54
  attribute :private, :boolean
30
55
  attribute :archived, :boolean
31
56
  attribute :test_mode, :boolean
32
57
  attribute :setup, :boolean
58
+ attribute :any_live_sales, :boolean
59
+ attribute :any_live_tickets, :boolean
60
+ attribute :anonymisation_state, :string
61
+ attribute :deletion_state, :string
33
62
 
63
+ # Counts
34
64
  attribute :tickets_count, :integer
35
65
  attribute :registrations_count, :integer
36
66
  attribute :releases_count, :integer
67
+ attribute :discount_codes_count, :integer
68
+ attribute :users_count, :integer
37
69
 
70
+ # Financial
71
+ attribute :gross_income, :decimal
72
+ attribute :net_income, :decimal
73
+
74
+ # Locale
75
+ attribute :default_locale, :string
76
+ attribute :locales, :string_array
77
+ attribute :allow_browser_locale, :boolean
78
+
79
+ # Display toggles
38
80
  attribute :show_banner, :boolean
39
81
  attribute :show_logo, :boolean
40
82
  attribute :show_title, :boolean
83
+ attribute :show_description, :boolean
84
+ attribute :show_date, :boolean
85
+ attribute :show_location, :boolean
86
+ attribute :show_venue, :boolean
41
87
  attribute :show_prices_ex_tax, :boolean
88
+ attribute :show_discount_code_field, :boolean
89
+ attribute :show_sharing_links, :boolean
90
+ attribute :show_tickets_remaining, :boolean
91
+ attribute :show_tickets_remaining_threshold, :integer
92
+ attribute :show_company_field, :boolean
93
+ attribute :show_job_title_field, :boolean
94
+ attribute :show_phone_number_field, :boolean
95
+ attribute :show_email_address, :boolean
96
+ attribute :show_additional_info, :boolean
97
+ attribute :show_register_interest_form, :boolean
98
+ attribute :show_past_tickets, :boolean
99
+ attribute :show_next_tickets, :boolean
100
+ attribute :show_order_summary, :boolean
42
101
 
43
- attribute :require_billing_address, :boolean
44
- attribute :require_company_name, :boolean
45
- attribute :require_vat_number, :boolean
102
+ # Requirements
103
+ attribute :requires_billing_address, :boolean
104
+ attribute :requires_company_name, :boolean
105
+ attribute :requires_vat_number, :boolean
106
+ attribute :requires_job_title, :boolean
107
+ attribute :requires_country, :boolean
46
108
 
109
+ # Tickets per person/registration
47
110
  attribute :max_tickets_per_person, :integer
48
111
  attribute :min_tickets_per_person, :integer
112
+ attribute :max_tickets_per_registration, :integer
113
+ attribute :min_tickets_per_registration, :integer
114
+
115
+ # Ticket configuration
116
+ attribute :ticket_qr_codes_enabled, :boolean
117
+ attribute :ticket_downloads_enabled, :boolean
118
+ attribute :ticket_wallet_pass_enabled, :boolean
119
+ attribute :ticket_vcards_enabled, :boolean
120
+ attribute :ticket_gifting_disabled, :boolean
121
+ attribute :ticket_cancelling_enabled, :boolean
122
+ attribute :ticket_unique_emails, :boolean
123
+ attribute :ticket_success_message, :string
124
+ attribute :ticket_fail_message, :string
125
+
126
+ # Email settings
127
+ attribute :send_registration_confirmation_email, :boolean
128
+ attribute :send_ticket_gifted_email, :boolean
129
+ attribute :send_ticket_updated_email, :boolean
130
+
131
+ # Payment
132
+ attribute :payment_option_required, :boolean
49
133
 
134
+ # Admin
50
135
  attribute :security_token, :string
51
- attribute :metadata, :string
136
+ attribute :admin_control_token, :string
137
+ attribute :consent, :json
138
+ attribute :chosen_homepage, :string
139
+ attribute :metadata, :json
52
140
 
53
141
  attribute :created_at, :datetime
54
142
  attribute :updated_at, :datetime
@@ -13,11 +13,14 @@ module Tito
13
13
  attribute :title, :string
14
14
  attribute :description, :string
15
15
  attribute :field_type, :string
16
- attribute :options, :string
16
+ attribute :options, :json
17
+ attribute :options_free_text_field, :string
17
18
  attribute :include_free_text_field, :boolean
18
19
  attribute :required, :boolean
19
20
  attribute :answers_count, :integer
20
21
  attribute :tickets_count, :integer
22
+ attribute :deletable, :boolean
23
+ attribute :public_optional_activity_ids, :json
21
24
  attribute :created_at, :datetime
22
25
  attribute :updated_at, :datetime
23
26
 
@@ -8,32 +8,69 @@ module Tito
8
8
  collection_name "registrations"
9
9
  supports :list, :show, :create, :update
10
10
 
11
- attribute :id, :integer
12
- attribute :slug, :string
13
- attribute :reference, :string
14
- attribute :email, :string
15
- attribute :name, :string
16
- attribute :phone_number, :string
17
- attribute :job_title, :string
18
- attribute :company_name, :string
19
- attribute :payment_reference, :string
20
- attribute :total, :decimal
21
- attribute :total_less_tax, :decimal
22
- attribute :paid, :boolean
23
- attribute :payment_complete, :boolean
24
- attribute :payment_incomplete, :boolean
25
- attribute :cancelled, :boolean
26
- attribute :cancelled_at, :datetime
27
- attribute :completed_at, :datetime
28
- attribute :consented_at, :datetime
29
- attribute :locale, :string
30
- attribute :metadata, :string
31
- attribute :discount_code_id, :integer
32
- attribute :imported, :boolean
33
- attribute :manual, :boolean
34
- attribute :test_mode, :boolean
35
- attribute :created_at, :datetime
36
- attribute :updated_at, :datetime
11
+ attribute :id, :integer
12
+ attribute :slug, :string
13
+ attribute :reference, :string
14
+ attribute :email, :string
15
+ attribute :name, :string
16
+ attribute :phone_number, :string
17
+ attribute :job_title, :string
18
+ attribute :company_name, :string
19
+
20
+ # Payment
21
+ attribute :payment_reference, :string
22
+ attribute :payment_option_name, :string
23
+ attribute :payment_option_provider_name, :string
24
+ attribute :purchase_order_number, :string
25
+ attribute :total, :decimal
26
+ attribute :total_less_tax, :decimal
27
+ attribute :paid, :boolean
28
+ attribute :free, :boolean
29
+ attribute :invoice, :boolean
30
+ attribute :payment_complete, :boolean
31
+ attribute :payment_incomplete, :boolean
32
+
33
+ # Receipt
34
+ attribute :receipt_id, :integer
35
+ attribute :receipt_number, :string
36
+ attribute :receipt_paid, :boolean
37
+
38
+ # State
39
+ attribute :state, :string
40
+ attribute :registration_type, :string
41
+ attribute :cancelled, :boolean
42
+ attribute :cancelled_at, :datetime
43
+ attribute :cancelled_by, :string
44
+ attribute :refundable, :boolean
45
+ attribute :refunded, :boolean
46
+ attribute :partially_refunded, :boolean
47
+ attribute :editable_total_and_prices, :boolean
48
+ attribute :completed_at, :datetime
49
+ attribute :consented_at, :datetime
50
+ attribute :expires_at, :string
51
+
52
+ # Metadata
53
+ attribute :locale, :string
54
+ attribute :source, :string
55
+ attribute :ip_address, :string
56
+ attribute :metadata, :json
57
+ attribute :event, :json
58
+ attribute :quantities, :json
59
+
60
+ # Relations
61
+ attribute :discount_code, :string
62
+ attribute :discount_code_id, :integer
63
+ attribute :tickets_count, :integer
64
+ attribute :terms_accepted, :boolean
65
+ attribute :termset_ids, :json
66
+
67
+ # Flags
68
+ attribute :imported, :boolean
69
+ attribute :manual, :boolean
70
+ attribute :test_mode, :boolean
71
+
72
+ attribute :created_at, :datetime
73
+ attribute :updated_at, :datetime
37
74
 
38
75
  expandable :billing_address, :receipts, :refunds, :tickets, :line_items
39
76
 
@@ -8,18 +8,45 @@ module Tito
8
8
  collection_name "releases"
9
9
  supports :list, :show, :create, :update, :delete
10
10
 
11
+ # Identity
11
12
  attribute :id, :integer
12
13
  attribute :slug, :string
13
14
  attribute :title, :string
14
15
  attribute :description, :string
15
16
  attribute :event_id, :integer
17
+
18
+ # Pricing
16
19
  attribute :price, :decimal
17
20
  attribute :price_ex_tax, :decimal
18
- attribute :display_price, :string
21
+ attribute :display_price, :decimal
19
22
  attribute :payment_type, :string
23
+ attribute :pricing_type, :string
24
+ attribute :donation, :boolean
25
+ attribute :suggested_donation, :decimal
26
+ attribute :max_donation, :decimal
27
+ attribute :min_donation, :decimal
28
+ attribute :price_degressive, :json
29
+ attribute :price_degressive_list, :json
30
+ attribute :tax_exclusive, :boolean
31
+ attribute :tax_description, :string
32
+
33
+ # Quantity
20
34
  attribute :quantity, :integer
35
+ attribute :default_quantity, :integer
21
36
  attribute :tickets_count, :integer
22
- attribute :allocatable, :integer
37
+ attribute :allocatable, :boolean
38
+ attribute :position, :integer
39
+
40
+ # Ticket counts
41
+ attribute :full_price_tickets_count, :integer
42
+ attribute :free_tickets_count, :integer
43
+ attribute :discounted_tickets_count, :integer
44
+ attribute :voided_tickets_count, :integer
45
+
46
+ # Financial
47
+ attribute :gross_income, :decimal
48
+
49
+ # State
23
50
  attribute :sold_out, :boolean
24
51
  attribute :archived, :boolean
25
52
  attribute :off_sale, :boolean
@@ -27,28 +54,61 @@ module Tito
27
54
  attribute :expired, :boolean
28
55
  attribute :upcoming, :boolean
29
56
  attribute :secret, :boolean
57
+ attribute :deletable, :boolean
58
+ attribute :changes_locked, :boolean
59
+ attribute :state_name, :string
60
+
61
+ # Options
30
62
  attribute :not_a_ticket, :boolean
31
63
  attribute :lock_changes, :boolean
32
64
  attribute :only_issue_combos, :boolean
33
65
  attribute :card_payments, :boolean
34
66
  attribute :invoice, :boolean
35
- attribute :donation, :boolean
67
+ attribute :enable_super_combo_summary, :boolean
68
+ attribute :has_success_message, :boolean
69
+ attribute :has_fail_message, :boolean
70
+
71
+ # Requirements
36
72
  attribute :require_email, :boolean
37
73
  attribute :require_name, :boolean
38
74
  attribute :require_billing_address, :boolean
39
75
  attribute :require_company_name, :boolean
40
76
  attribute :require_vat_number, :boolean
77
+ attribute :require_job_title, :boolean
78
+ attribute :require_credit_card_for_sold_out_waiting_list, :boolean
79
+
80
+ # Request fields
81
+ attribute :request_company_name, :boolean
82
+ attribute :request_job_title, :boolean
83
+ attribute :request_vat_number, :boolean
84
+
85
+ # Display
41
86
  attribute :show_price, :boolean
42
87
  attribute :show_qr_code, :boolean
43
88
  attribute :show_discount_code_field_here, :boolean
89
+ attribute :show_company_name, :boolean
90
+ attribute :show_job_title, :boolean
91
+ attribute :show_phone_number, :boolean
92
+ attribute :show_vat_number, :boolean
93
+ attribute :share_url, :string
94
+
95
+ # Per-person limits
44
96
  attribute :max_tickets_per_person, :integer
45
97
  attribute :min_tickets_per_person, :integer
98
+
99
+ # Dates
46
100
  attribute :start_at, :datetime
47
101
  attribute :end_at, :datetime
48
- attribute :success_message, :string
49
- attribute :fail_message, :string
50
- attribute :metadata, :string
51
- attribute :tax_exclusive, :boolean
102
+
103
+ # Waiting list
104
+ attribute :waiting_list, :boolean
105
+ attribute :pending_waiting_list, :boolean
106
+ attribute :waiting_list_enabled_during_locked, :boolean
107
+ attribute :waiting_list_enabled_during_sold_out, :boolean
108
+
109
+ # Other
110
+ attribute :metadata, :json
111
+ attribute :warnings, :json
52
112
  attribute :created_at, :datetime
53
113
  attribute :updated_at, :datetime
54
114
 
@@ -21,9 +21,13 @@ module Tito
21
21
  attribute :discount_code, :string
22
22
  attribute :expires_at, :datetime
23
23
  attribute :unique_url, :string
24
- attribute :redirect, :string
25
- attribute :created_at, :datetime
26
- attribute :updated_at, :datetime
24
+ attribute :redirect, :boolean
25
+ attribute :rsvp_list_id, :integer
26
+ attribute :registration_id, :integer
27
+ attribute :importer_id, :integer
28
+ attribute :message_delivery_id, :integer
29
+ attribute :created_at, :datetime
30
+ attribute :updated_at, :datetime
27
31
 
28
32
  expandable :registration
29
33
  end
@@ -42,7 +42,7 @@ module Tito
42
42
  attribute :changes_locked, :boolean
43
43
  attribute :lock_changes, :boolean
44
44
  attribute :tags, :string
45
- attribute :event, :string
45
+ attribute :event, :json
46
46
  attribute :void, :boolean
47
47
  attribute :metadata, :json
48
48
  attribute :consented_at, :datetime
@@ -2,15 +2,17 @@ module Tito
2
2
  module Admin
3
3
  module Resources
4
4
  class WebhookEndpoint < Tito::Resource
5
- account_scoped!
6
- path_template "webhook_endpoints"
5
+ event_scoped!
6
+ path_template "%{account}/%{event}/webhook_endpoints"
7
7
  resource_name "webhook_endpoint"
8
8
  collection_name "webhook_endpoints"
9
9
  supports :list, :show, :create, :update, :delete
10
10
 
11
11
  attribute :id, :integer
12
12
  attribute :url, :string
13
+ attribute :status, :string
13
14
  attribute :included_triggers, :string_array
15
+ attribute :custom_data, :json
14
16
  attribute :deprecated, :boolean
15
17
  attribute :created_at, :datetime
16
18
  attribute :updated_at, :datetime
data/lib/tito/resource.rb CHANGED
@@ -84,6 +84,8 @@ module Tito
84
84
  Tito::Admin::CollectionProxy.new(scope: child_scope)
85
85
  end
86
86
  end
87
+
88
+ def attribute_names_set = @attribute_names_set ||= attribute_names.to_set
87
89
  end
88
90
 
89
91
  attr_reader :_scope
@@ -91,9 +93,10 @@ module Tito
91
93
  def initialize(_scope: nil, **attrs)
92
94
  @_scope = _scope
93
95
  @_persisted = !!(attrs[:id] || attrs[:slug] || attrs["id"] || attrs["slug"])
94
- # Normalize string keys to symbols for ActiveModel
95
- normalized = attrs.transform_keys(&:to_sym).except(:_type)
96
- super(**normalized)
96
+ # Drop unknown attributes
97
+ known = self.class.attribute_names_set
98
+ allowed = attrs.select { |k, _| known.include?(k.to_s) }
99
+ super(**allowed)
97
100
  clear_changes_information if @_persisted
98
101
  end
99
102
 
data/lib/tito/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tito
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tito_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Paine