Skip to content

Commit 83c6ad4

Browse files
committed
Fix collection of strings assuming complex objects. Fixes #30
1 parent a677fc6 commit 83c6ad4

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

lib/drip/collection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def item_class
2424

2525
def parse_items
2626
raw_items.map do |raw_item|
27-
item_class.new(raw_item)
27+
raw_item.is_a?(String) ? raw_item : item_class.new(raw_item)
2828
end
2929
end
3030

test/drip/client/custom_fields_test.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ def setup
88
context "#custom_fields" do
99
setup do
1010
@response_status = 200
11-
@response_body = "{}"
11+
@response_body = <<-JSON
12+
{
13+
"custom_field_identifiers":[
14+
"custom_field_1",
15+
"custom_field_2",
16+
"custom_field_3"
17+
]
18+
}
19+
JSON
1220

1321
stub_request(:get, "https://api.getdrip.com/v2/12345/custom_field_identifiers").
1422
to_return(status: @response_status, body: @response_body, headers: {})

0 commit comments

Comments
 (0)