lib/osm/member.rb in osm-1.2.18.dev.1 vs lib/osm/member.rb in osm-1.2.18.dev.2
- old
+ new
@@ -156,11 +156,11 @@
structure = (api_response['meta'] || {})['structure'] || []
structure = Hash[ structure.map{ |i| [i['group_id'].to_i, i ] } ] # Make a hash of identifier to group data hash
custom_labels = {}
structure.each do |gid, group|
- columns = group['columns']
+ columns = group['columns'] || []
columns.map!{ |c| [c['column_id'].to_i, c['label']] }
columns.select!{ |a| (gid == GID_CUSTOM) || (a[0] > CORE_FIELD_IDS_FINISH_AT) }
labels = DirtyHashy[ columns ]
custom_labels[gid.to_i] = labels
end
@@ -204,11 +204,11 @@
receive_phone_1: member_contact[CID_RECIEVE_PHONE_1],
receive_phone_2: member_contact[CID_RECIEVE_PHONE_2],
receive_email_1: member_contact[CID_RECIEVE_EMAIL_1],
receive_email_2: member_contact[CID_RECIEVE_EMAIL_2],
custom: DirtyHashy[ item_data[GID_MEMBER_CONTACT].map{ |k,v| [k.to_i, v] }.select{ |i| i[0] > CORE_FIELD_IDS_FINISH_AT } ],
- custom_labels: custom_labels[GID_MEMBER_CONTACT],
+ custom_labels: custom_labels[GID_MEMBER_CONTACT] || DirtyHashy.new,
),
:primary_contact => PrimaryContact.new(
first_name: primary_contact[CID_FIRST_NAME],
last_name: primary_contact[CID_LAST_NAME],
address_1: primary_contact[CID_ADDRESS_1],
@@ -223,11 +223,11 @@
receive_phone_1: primary_contact[CID_RECIEVE_PHONE_1],
receive_phone_2: primary_contact[CID_RECIEVE_PHONE_2],
receive_email_1: primary_contact[CID_RECIEVE_EMAIL_1],
receive_email_2: primary_contact[CID_RECIEVE_EMAIL_2],
custom: DirtyHashy[ item_data[GID_PRIMARY_CONTACT].map{ |k,v| [k.to_i, v] }.select{ |i| i[0] > CORE_FIELD_IDS_FINISH_AT } ],
- custom_labels: custom_labels[GID_PRIMARY_CONTACT],
+ custom_labels: custom_labels[GID_PRIMARY_CONTACT] || DirtyHashy.new,
),
:secondary_contact => PrimaryContact.new(
first_name: secondary_contact[CID_FIRST_NAME],
last_name: secondary_contact[CID_LAST_NAME],
address_1: secondary_contact[CID_ADDRESS_1],
@@ -242,11 +242,11 @@
receive_phone_1: secondary_contact[CID_RECIEVE_PHONE_1],
receive_phone_2: secondary_contact[CID_RECIEVE_PHONE_2],
receive_email_1: secondary_contact[CID_RECIEVE_EMAIL_1],
receive_email_2: secondary_contact[CID_RECIEVE_EMAIL_2],
custom: DirtyHashy[ item_data[GID_SECONDARY_CONTACT].map{ |k,v| [k.to_i, v] }.select{ |i| i[0] > CORE_FIELD_IDS_FINISH_AT } ],
- custom_labels: custom_labels[GID_SECONDARY_CONTACT],
+ custom_labels: custom_labels[GID_SECONDARY_CONTACT] || DirtyHashy.new,
),
:emergency_contact => EmergencyContact.new(
first_name: emergency_contact[CID_FIRST_NAME],
last_name: emergency_contact[CID_LAST_NAME],
address_1: emergency_contact[CID_ADDRESS_1],
@@ -257,11 +257,11 @@
phone_1: emergency_contact[CID_PHONE_1],
phone_2: emergency_contact[CID_PHONE_2],
email_1: emergency_contact[CID_EMAIL_1],
email_2: emergency_contact[CID_EMAIL_2],
custom: DirtyHashy[ item_data[GID_EMERGENCY_CONTACT].map{ |k,v| [k.to_i, v] }.select{ |i| i[0] > CORE_FIELD_IDS_FINISH_AT } ],
- custom_labels: custom_labels[GID_EMERGENCY_CONTACT],
+ custom_labels: custom_labels[GID_EMERGENCY_CONTACT] || DirtyHashy.new,
),
:doctor => DoctorContact.new(
first_name: doctor_contact[CID_FIRST_NAME],
last_name: doctor_contact[CID_LAST_NAME],
surgery: doctor_contact[CID_SURGERY],
@@ -271,13 +271,13 @@
address_4: doctor_contact[CID_ADDRESS_4],
postcode: doctor_contact[CID_POSTCODE],
phone_1: doctor_contact[CID_PHONE_1],
phone_2: doctor_contact[CID_PHONE_2],
custom: DirtyHashy[ item_data[GID_DOCTOR_CONTACT].map{ |k,v| [k.to_i, v] }.select{ |i| i[0] > CORE_FIELD_IDS_FINISH_AT } ],
- custom_labels: custom_labels[GID_DOCTOR_CONTACT],
+ custom_labels: custom_labels[GID_DOCTOR_CONTACT] || DirtyHashy.new,
),
custom: DirtyHashy[ item_data[GID_CUSTOM].map{ |k,v| [k.to_i, v] } ],
- custom_labels: custom_labels[GID_CUSTOM],
+ custom_labels: custom_labels[GID_CUSTOM] || DirtyHashy.new,
)
end
cache_write(api, cache_key, result)
return result