Skip to content

Commit a71f7da

Browse files
authored
Merge pull request #12 from MortarStone/deb/stringify_response
Stringify response
2 parents 8240863 + 74e49ae commit a71f7da

14 files changed

+147
-125
lines changed

Gemfile.lock

+76-53
Original file line numberDiff line numberDiff line change
@@ -3,112 +3,135 @@ PATH
33
specs:
44
deka (0.0.1)
55
activemodel
6-
activesupport
76
dotenv
8-
faraday (>= 1.0)
7+
faraday (>= 1.0, < 2.0)
98

109
GEM
1110
remote: https://rubygems.org/
1211
specs:
13-
activemodel (7.1.3.4)
14-
activesupport (= 7.1.3.4)
15-
activesupport (7.1.3.4)
12+
activemodel (8.0.1)
13+
activesupport (= 8.0.1)
14+
activesupport (8.0.1)
1615
base64
16+
benchmark (>= 0.3)
1717
bigdecimal
18-
concurrent-ruby (~> 1.0, >= 1.0.2)
18+
concurrent-ruby (~> 1.0, >= 1.3.1)
1919
connection_pool (>= 2.2.5)
2020
drb
2121
i18n (>= 1.6, < 2)
22+
logger (>= 1.4.2)
2223
minitest (>= 5.1)
23-
mutex_m
24-
tzinfo (~> 2.0)
24+
securerandom (>= 0.3)
25+
tzinfo (~> 2.0, >= 2.0.5)
26+
uri (>= 0.13.1)
2527
addressable (2.8.7)
2628
public_suffix (>= 2.0.2, < 7.0)
2729
ast (2.4.2)
2830
base64 (0.2.0)
29-
bigdecimal (3.1.8)
31+
benchmark (0.4.0)
32+
bigdecimal (3.1.9)
3033
coderay (1.1.3)
31-
concurrent-ruby (1.3.3)
32-
connection_pool (2.4.1)
34+
concurrent-ruby (1.3.5)
35+
connection_pool (2.5.0)
3336
crack (1.0.0)
3437
bigdecimal
3538
rexml
36-
diff-lcs (1.5.1)
37-
docile (1.4.0)
38-
dotenv (3.1.2)
39+
diff-lcs (1.6.0)
40+
docile (1.4.1)
41+
dotenv (3.1.7)
3942
drb (2.2.1)
40-
factory_bot (6.4.6)
41-
activesupport (>= 5.0.0)
42-
faraday (2.10.0)
43-
faraday-net_http (>= 2.0, < 3.2)
44-
logger
45-
faraday-net_http (3.1.0)
46-
net-http
43+
factory_bot (6.5.1)
44+
activesupport (>= 6.1.0)
45+
faraday (1.10.4)
46+
faraday-em_http (~> 1.0)
47+
faraday-em_synchrony (~> 1.0)
48+
faraday-excon (~> 1.1)
49+
faraday-httpclient (~> 1.0)
50+
faraday-multipart (~> 1.0)
51+
faraday-net_http (~> 1.0)
52+
faraday-net_http_persistent (~> 1.0)
53+
faraday-patron (~> 1.0)
54+
faraday-rack (~> 1.0)
55+
faraday-retry (~> 1.0)
56+
ruby2_keywords (>= 0.0.4)
57+
faraday-em_http (1.0.0)
58+
faraday-em_synchrony (1.0.0)
59+
faraday-excon (1.1.0)
60+
faraday-httpclient (1.0.1)
61+
faraday-multipart (1.1.0)
62+
multipart-post (~> 2.0)
63+
faraday-net_http (1.0.2)
64+
faraday-net_http_persistent (1.2.0)
65+
faraday-patron (1.0.0)
66+
faraday-rack (1.0.0)
67+
faraday-retry (1.0.3)
4768
hashdiff (1.1.2)
48-
i18n (1.14.5)
69+
i18n (1.14.7)
4970
concurrent-ruby (~> 1.0)
50-
json (2.7.2)
51-
language_server-protocol (3.17.0.3)
52-
logger (1.6.0)
71+
json (2.10.1)
72+
language_server-protocol (3.17.0.4)
73+
lint_roller (1.1.0)
74+
logger (1.6.6)
5375
method_source (1.1.0)
54-
minitest (5.24.1)
55-
mutex_m (0.2.0)
56-
net-http (0.4.1)
57-
uri
58-
parallel (1.25.1)
59-
parser (3.3.4.0)
76+
minitest (5.25.4)
77+
multipart-post (2.4.1)
78+
parallel (1.26.3)
79+
parser (3.3.7.1)
6080
ast (~> 2.4.1)
6181
racc
62-
pry (0.14.2)
82+
pry (0.15.2)
6383
coderay (~> 1.1)
6484
method_source (~> 1.0)
6585
public_suffix (6.0.1)
66-
racc (1.8.0)
86+
racc (1.8.1)
6787
rainbow (3.1.1)
6888
rake (13.2.1)
69-
regexp_parser (2.9.2)
70-
rexml (3.3.2)
71-
strscan
89+
regexp_parser (2.10.0)
90+
rexml (3.4.1)
7291
rspec (3.13.0)
7392
rspec-core (~> 3.13.0)
7493
rspec-expectations (~> 3.13.0)
7594
rspec-mocks (~> 3.13.0)
76-
rspec-core (3.13.0)
95+
rspec-core (3.13.3)
7796
rspec-support (~> 3.13.0)
78-
rspec-expectations (3.13.1)
97+
rspec-expectations (3.13.3)
7998
diff-lcs (>= 1.2.0, < 2.0)
8099
rspec-support (~> 3.13.0)
81-
rspec-mocks (3.13.1)
100+
rspec-mocks (3.13.2)
82101
diff-lcs (>= 1.2.0, < 2.0)
83102
rspec-support (~> 3.13.0)
84-
rspec-support (3.13.1)
85-
rubocop (1.65.0)
103+
rspec-support (3.13.2)
104+
rubocop (1.72.2)
86105
json (~> 2.3)
87-
language_server-protocol (>= 3.17.0)
106+
language_server-protocol (~> 3.17.0.2)
107+
lint_roller (~> 1.1.0)
88108
parallel (~> 1.10)
89109
parser (>= 3.3.0.2)
90110
rainbow (>= 2.2.2, < 4.0)
91-
regexp_parser (>= 2.4, < 3.0)
92-
rexml (>= 3.2.5, < 4.0)
93-
rubocop-ast (>= 1.31.1, < 2.0)
111+
regexp_parser (>= 2.9.3, < 3.0)
112+
rubocop-ast (>= 1.38.0, < 2.0)
94113
ruby-progressbar (~> 1.7)
95-
unicode-display_width (>= 2.4.0, < 3.0)
96-
rubocop-ast (1.31.3)
114+
unicode-display_width (>= 2.4.0, < 4.0)
115+
rubocop-ast (1.38.0)
97116
parser (>= 3.3.1.0)
98117
ruby-progressbar (1.13.0)
118+
ruby2_keywords (0.0.5)
119+
securerandom (0.4.1)
99120
simplecov (0.22.0)
100121
docile (~> 1.1)
101122
simplecov-html (~> 0.11)
102123
simplecov_json_formatter (~> 0.1)
103-
simplecov-html (0.12.3)
124+
simplecov-html (0.13.1)
104125
simplecov_json_formatter (0.1.4)
105-
strscan (3.1.0)
106126
tzinfo (2.0.6)
107127
concurrent-ruby (~> 1.0)
108-
unicode-display_width (2.5.0)
109-
uri (0.13.0)
110-
vcr (6.2.0)
111-
webmock (3.24.0)
128+
unicode-display_width (3.1.4)
129+
unicode-emoji (~> 4.0, >= 4.0.4)
130+
unicode-emoji (4.0.4)
131+
uri (1.0.2)
132+
vcr (6.3.1)
133+
base64
134+
webmock (3.25.0)
112135
addressable (>= 2.8.0)
113136
crack (>= 0.3.2)
114137
hashdiff (>= 0.4.0, < 2.0.0)

deka.gemspec

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ Gem::Specification.new do |spec|
3030
spec.require_paths = ["lib"]
3131

3232
spec.add_dependency 'activemodel'
33-
spec.add_dependency 'activesupport'
3433
spec.add_dependency 'dotenv'
35-
spec.add_dependency 'faraday', '>= 1.0'
34+
spec.add_dependency 'faraday', '>= 1.0', '< 2.0'
3635
spec.metadata['rubygems_mfa_required'] = 'true'
3736
end

examples/helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def print_no_access_message
2424
def print_list(object_name, pk_id_name, response)
2525
print_headers(response.headers)
2626

27-
list = response.body[:data]
27+
list = response.body['data']
2828
if list.nil? || list.empty?
2929
puts 'Nothing found'
3030
else
@@ -62,7 +62,7 @@ def print_row(index, item, column_headers)
6262
def print_item(object_name, response)
6363
print_headers(response.headers)
6464

65-
item = response.body[:data]
65+
item = response.body['data']
6666
puts
6767
if item.nil?
6868
puts "Item not found"

examples/helpers/families.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ def print_family(item)
77
end
88

99
def family_columns
10-
[
11-
:id,
12-
:name,
13-
:primary_contact,
14-
:created_at,
15-
:updated_at,
16-
:deleted_at
10+
%w[
11+
id
12+
name
13+
primary_contact
14+
created_at
15+
updated_at
16+
deleted_at
1717
]
1818
end

examples/helpers/organizations.rb

+14-14
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ def print_organization(item)
77
end
88

99
def organization_columns
10-
[
11-
:id,
12-
:uuid,
13-
:org_name,
14-
:email,
15-
:slug,
16-
:phone,
17-
:mobile,
18-
:address,
19-
:city,
20-
:state_province,
21-
:postal,
22-
:created_at,
23-
:updated_at
10+
%w[
11+
id
12+
uuid
13+
org_name
14+
email
15+
slug
16+
phone
17+
mobile
18+
address
19+
city
20+
state_province
21+
postal
22+
created_at
23+
updated_at
2424
]
2525
end

examples/helpers/purposes.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ def print_purpose(item)
77
end
88

99
def purpose_columns
10-
[
11-
:id,
12-
:name,
13-
:active,
14-
:created_at,
15-
:updated_at,
16-
:deleted_at
10+
%w[
11+
id
12+
name
13+
active
14+
created_at
15+
updated_at
16+
deleted_at
1717
]
1818
end

examples/helpers/transactions.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ def print_transaction(item)
77
end
88

99
def transaction_columns
10-
[
11-
:id,
12-
:payment_type,
13-
:purpose_id,
14-
:status,
15-
:amount,
16-
:user_id,
17-
:date,
18-
:created_at,
19-
:updated_at,
20-
:deleted_at
10+
%w[
11+
id
12+
payment_type
13+
purpose_id
14+
status
15+
amount
16+
user_id
17+
date
18+
created_at
19+
updated_at
20+
deleted_at
2121
]
2222
end

examples/helpers/users.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ def print_user(item)
77
end
88

99
def user_columns
10-
[
11-
:id,
12-
:family_id,
13-
:first_name,
14-
:last_name,
15-
:created_at,
16-
:updated_at,
17-
:deleted_at
10+
%w[
11+
id
12+
family_id
13+
first_name
14+
last_name
15+
created_at
16+
updated_at
17+
deleted_at
1818
]
1919
end

lib/deka/response.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def self.from_http_response(http_response)
2424
def self.parse_body(response_body)
2525
return if response_body.empty?
2626

27-
JSON.parse(response_body, symbolize_names: true) rescue response_body
27+
JSON.parse(response_body) rescue response_body
2828
end
2929

3030
def error_message

spec/deka/endpoints/families_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
end
99

1010
it 'returns an array' do
11-
expect(@families[:data]).to be_an(Array)
11+
expect(@families['data']).to be_an(Array)
1212
end
1313

1414
it 'returns family objects' do
15-
expect(@families[:data].first).to be_a(Hash)
16-
expect(@families[:data].first[:id]).to_not be_nil
15+
expect(@families['data'].first).to be_a(Hash)
16+
expect(@families['data'].first['id']).to_not be_nil
1717
end
1818
end
1919

@@ -24,8 +24,8 @@
2424
end
2525

2626
it 'returns a user_family object' do
27-
expect(@user_family[:data]).to be_a(Hash)
28-
expect(@user_family[:data][:id]).to eq(610)
27+
expect(@user_family['data']).to be_a(Hash)
28+
expect(@user_family['data']['id']).to eq(610)
2929
end
3030
end
3131
end

spec/deka/endpoints/organizations_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
end
1111

1212
it 'returns a organization object' do
13-
expect(@organization[:data]).to be_a(Hash)
14-
expect(@organization[:data][:id]).to eq(118)
13+
expect(@organization['data']).to be_a(Hash)
14+
expect(@organization['data']['id']).to eq(118)
1515
end
1616
end
1717
end

0 commit comments

Comments
 (0)