attio-ruby 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30aee8e467a33e359480e61fbf740b7351fd63ebf985f32aa64108f4f5637617
4
- data.tar.gz: 3c2ef27394c6d153233e43305ea1a2b714d8986194a966bd59fe755b1174321f
3
+ metadata.gz: a7db71c5e1400d37a29bd1aa5f4c0a6dd9cfebc915582f0da146f194cbcbc115
4
+ data.tar.gz: 003ac5ec55828dd32d31ba572d1f6d0f319f8a993e70cc27d04c39b11c5a65d0
5
5
  SHA512:
6
- metadata.gz: bfb3bc04b4af46085f49a4852a049df7f61cb30c69d8689eed8d9e41f860650350eeb64409673be1c316c8131fefc54ee9ae00e48ef81c8481bce67f53e450d5
7
- data.tar.gz: 2cac10e8790c90c75dac806f1e8575bc782c2c490acc185c51d31ff17bbaa055f6bf43faf1d3415b4d75bdf470de125d12b039dd03107d7702868b10391254ff
6
+ metadata.gz: 308220d81893653de1e4f4df002b0f8b1df18b3f76a46731b701a12a3c8d1a229727196e731de81305db9d1cadce0f84496dd344dc4849587068fde4353a93ec
7
+ data.tar.gz: aa3362f8f41b37fc1a3d38f95f6d6dcadf47ca176d566bc95a158efcb4f56b361bc09988e95b9ded4005210a4359f5a3ef2ecd92720de8e4081f1fba7b9d042c
data/CHANGELOG.md CHANGED
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.2] - 2025-08-07
9
+
10
+ ### Added
11
+ - Deal status configuration system for customizing won/lost/open statuses
12
+ - `Deal.in_stage` method to query deals by multiple stage names
13
+ - Convenience class methods: `Deal.won`, `Deal.lost`, `Deal.open_deals`
14
+ - Instance methods for deals: `current_status`, `status_changed_at`, `won_at`, `closed_at`
15
+ - Improved `won?`, `lost?`, and `open?` methods that use configuration
16
+
17
+ ### Fixed
18
+ - WorkspaceMember.active and WorkspaceMember.admins methods argument passing issue
19
+ - Configuration arrays are now properly duplicated to avoid frozen array issues
20
+
21
+ ## [0.1.1] - 2025-08-07
22
+
23
+ ### Fixed
24
+ - Minor bug fixes and improvements
25
+
8
26
  ## [0.1.0] - 2025-07-27
9
27
 
10
28
  ### Added
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Attio Ruby SDK
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/attio-ruby.svg)](https://badge.fury.io/rb/attio-ruby)
4
- [![Build Status](https://github.com/rbeene/attio_ruby/workflows/CI/badge.svg)](https://github.com/rbeene/attio_ruby/actions)
4
+ [![Build Status](https://github.com/rbeene/attio_ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/rbeene/attio_ruby/actions/workflows/ci.yml)
5
5
  [![Documentation](https://img.shields.io/badge/docs-YARD-blue.svg)](https://rubydoc.info/gems/attio-ruby)
6
6
 
7
7
  A Ruby SDK for the [Attio API](https://attio.com/docs). This gem provides a simple and intuitive interface for interacting with Attio's CRM platform.
@@ -65,9 +65,7 @@ person = Attio::Person.create(
65
65
  )
66
66
 
67
67
  # Search for companies
68
- companies = Attio::Company.list(
69
- params: { q: "tech", limit: 10 }
70
- )
68
+ companies = Attio::Company.search("tech")
71
69
  ```
72
70
 
73
71
  ## Configuration
@@ -351,9 +349,11 @@ person.set_name(first: "Jane", last: "Doe")
351
349
  person.add_email("jane.doe@example.com")
352
350
  person.add_phone("+14155551234", country_code: "US")
353
351
 
354
- # Search methods
355
- jane = Attio::Person.find_by_email("jane@example.com")
356
- john = Attio::Person.find_by_name("John Smith")
352
+ # Search methods - Rails-style find_by
353
+ jane = Attio::Person.find_by(email: "jane@example.com")
354
+ john = Attio::Person.find_by(name: "John Smith")
355
+ # Can combine multiple conditions (uses AND logic)
356
+ exec = Attio::Person.find_by(email: "exec@company.com", job_title: "CEO")
357
357
  ```
358
358
 
359
359
  #### Company Methods
@@ -371,10 +371,86 @@ company.name = "New Company Name"
371
371
  company.add_domain("newdomain.com")
372
372
  company.add_team_member(person) # Associate a person with the company
373
373
 
374
+ # Search methods - Rails-style find_by
375
+ acme = Attio::Company.find_by(name: "Acme Corp")
376
+ tech_co = Attio::Company.find_by(domain: "techcompany.com")
377
+ # Can combine multiple conditions
378
+ big_tech = Attio::Company.find_by(domain: "tech.com", employee_count: "100-500")
379
+ ```
380
+
381
+ #### Deal Methods
382
+
383
+ ```ruby
384
+ # Create a deal (requires name, stage, and owner)
385
+ deal = Attio::Deal.create(
386
+ name: "Enterprise Deal",
387
+ value: 50000,
388
+ stage: "In Progress", # Options: "Lead", "In Progress", "Won 🎉", "Lost"
389
+ owner: "sales@company.com" # Must be a workspace member email
390
+ )
391
+
392
+ # Access methods
393
+ deal.name # Returns deal name
394
+ deal.value # Returns currency object with currency_value
395
+ deal.stage # Returns status object with nested title
396
+ deal.status # Alias for stage
397
+ deal.current_status # Returns the current status title as a string
398
+ deal.status_changed_at # Returns when the status was last changed
399
+
400
+ # Update methods
401
+ deal.update_stage("Won 🎉")
402
+ deal.update_value(75000)
403
+
374
404
  # Search methods
375
- acme = Attio::Company.find_by_name("Acme Corp")
376
- tech_co = Attio::Company.find_by_domain("techcompany.com")
377
- large_cos = Attio::Company.find_by_size(min: 100)
405
+ big_deals = Attio::Deal.find_by_value_range(min: 100000)
406
+ mid_deals = Attio::Deal.find_by_value_range(min: 50000, max: 100000)
407
+ won_deals = Attio::Deal.find_by(stage: "Won 🎉")
408
+
409
+ # Query by status using convenience methods
410
+ won_deals = Attio::Deal.won # All deals with "Won 🎉" status
411
+ lost_deals = Attio::Deal.lost # All deals with "Lost" status
412
+ open_deals = Attio::Deal.open_deals # All deals with "Lead" or "In Progress"
413
+
414
+ # Query by custom stages
415
+ custom_deals = Attio::Deal.in_stage(stage_names: ["Won 🎉", "Contract Signed"])
416
+
417
+ # Check deal status (uses configuration)
418
+ deal.open? # true if status is "Lead" or "In Progress"
419
+ deal.won? # true if status is "Won 🎉"
420
+ deal.lost? # true if status is "Lost"
421
+ deal.won_at # timestamp when deal was won (or nil)
422
+ deal.closed_at # timestamp when deal was closed (won or lost)
423
+
424
+ # Associate with companies and people
425
+ deal = Attio::Deal.create(
426
+ name: "Partnership Deal",
427
+ value: 100000,
428
+ stage: "Lead",
429
+ owner: "sales@company.com",
430
+ associated_people: ["contact@partner.com"],
431
+ associated_company: ["partner.com"] # Uses domain
432
+ )
433
+ ```
434
+
435
+ ##### Customizing Deal Statuses
436
+
437
+ The gem uses Attio's default deal statuses ("Lead", "In Progress", "Won 🎉", "Lost") but you can customize these for your workspace:
438
+
439
+ ```ruby
440
+ # In config/initializers/attio.rb
441
+ Attio.configure do |config|
442
+ config.api_key = ENV["ATTIO_API_KEY"]
443
+
444
+ # Customize which statuses are considered won, lost, or open
445
+ config.won_statuses = ["Won 🎉", "Contract Signed", "Customer"]
446
+ config.lost_statuses = ["Lost", "Disqualified", "No Budget"]
447
+ config.open_statuses = ["Lead", "Qualified Lead", "Prospect"]
448
+ config.in_progress_statuses = ["In Progress", "Negotiation", "Proposal Sent"]
449
+ end
450
+
451
+ # Now the convenience methods use your custom statuses
452
+ won_deals = Attio::Deal.won # Finds deals with any of your won_statuses
453
+ deal.won? # Returns true if deal status is in your won_statuses
378
454
  ```
379
455
 
380
456
  #### TypedRecord Methods
@@ -385,8 +461,10 @@ All typed records (Person, Company, and custom objects) support:
385
461
  # Search with query string
386
462
  results = Attio::Person.search("john")
387
463
 
388
- # Find by any attribute
389
- person = Attio::Person.find_by(:job_title, "CEO")
464
+ # Find by any attribute using Rails-style syntax
465
+ person = Attio::Person.find_by(job_title: "CEO")
466
+ # Or find by multiple attributes (AND logic)
467
+ person = Attio::Person.find_by(job_title: "CEO", company: "Acme Corp")
390
468
 
391
469
  # Aliases for common methods
392
470
  Attio::Person.all == Attio::Person.list