Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customer website_url field #150

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/chartmogul/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Customer < APIResource
writeable_attr :free_trial_started_at, type: :time
writeable_attr :owner
writeable_attr :primary_contact
writeable_attr :website_url

include API::Actions::Create
include API::Actions::Custom
Expand Down
20 changes: 14 additions & 6 deletions spec/chartmogul/customer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
lead_created_at: Time.utc(2016, 10, 1).to_s,
free_trial_started_at: Time.utc(2016, 10, 2).to_s,
owner: 'owner@chartmogul.com',
custom: { Toggle: false }
custom: { Toggle: false },
website_url: 'example.com'
}
end
let(:customer_uuid) { 'cus_23e01538-2c7e-11ee-b2ce-fb986e96e21b' }
Expand Down Expand Up @@ -50,7 +51,8 @@
lead_created_at: Time.utc(2016, 10, 1).to_s,
free_trial_started_at: Time.utc(2016, 10, 2).to_s,
owner: 'owner@chartmogul.com',
status: nil
status: nil,
website_url: 'example.com'
)
end
end
Expand All @@ -73,7 +75,8 @@
lead_created_at: Time.utc(2016, 10, 1),
free_trial_started_at: Time.utc(2016, 10, 2),
owner: 'owner@chartmogul.com',
status: 'Active'
status: 'Active',
website_url: 'example.com'
)
end
end
Expand Down Expand Up @@ -101,7 +104,8 @@
uuid: customer_uuid,
data_source_uuid: data_source_uuid,
email: 'customer@example.com',
external_id: 'cus_004'
external_id: 'cus_004',
website_url: 'https://chartmogul.com'
)
end

Expand All @@ -112,7 +116,8 @@
name: 'New Customer',
email: 'new_customer@example.com',
owner: 'bruno+chartmogultest@chartmogul.com',
city: 'Berlin'
city: 'Berlin',
website_url: 'https://chartmogul.com'
}
customer = described_class.create!(**attributes)
expect(customer).to have_attributes(
Expand All @@ -132,6 +137,7 @@
customer.city = 'Berlin'
customer.lead_created_at = Time.utc(2016, 1, 1, 14, 30)
customer.free_trial_started_at = Time.utc(2016, 2, 2, 22, 40)
customer.website_url = 'https://chartmogul.com'
customer.attributes = {}.tap do |att|
att[:tags] = [:wurst]
att[:custom] = { Toggle: true }
Expand All @@ -156,13 +162,15 @@
email: 'customer_test@example.com',
company: 'Curry 42',
attributes: { custom: { Toggle: true } },
name: 'Test Customer'
name: 'Test Customer',
website_url: 'https://example.co'
})

expect(updated_customer).to have_attributes(
email: 'customer_test@example.com',
company: 'Curry 42',
name: 'Test Customer',
website_url: 'https://example.co',
attributes: {
custom: { Toggle: true }, clearbit: {},
tags: ["wurst"], stripe: {}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading