Skip to content

Commit 6771252

Browse files
authored
Merge pull request #52 from DripEmail/fix-string-lists
Fix collection of strings assuming complex objects
2 parents a677fc6 + 5fe922d commit 6771252

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
[master]: https://github.com/DripEmail/drip-ruby/compare/v3.1.1...HEAD
1010

1111
- Allow `#create_or_update_subscriber` to work with Drip id. Fixes [#50](https://github.com/DripEmail/drip-ruby/issues/50)
12+
- [#52](https://github.com/DripEmail/drip-ruby/pull/52): Fix `#custom_fields` to accept the API response without error. Fixes [#30](https://github.com/DripEmail/drip-ruby/issues/30)
1213
- Your contribution here!
1314

1415
## [3.1.1] - 2018-06-06

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)