This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host * | |
UseKeychain yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module StrictDig | |
def strict_dig(*keys, map: false, strict: true, value_key: false) | |
outer_layer = self | |
layers = value_key ? keys.push(value_key) : keys | |
original_keys = layers.dup | |
while layers.any? | |
current_layer = layers.shift | |
fetching_args = strict ? [current_layer] : [current_layer].push(nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HotelBeds | |
class CachedSupplierPropertyContent < ::CachedSupplierPropertyContent | |
VALUE_KEY = 'content'.freeze | |
def clean_data(data) | |
case data | |
when String then data.strip | |
else | |
data | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeClass | |
attr_writer :value_key | |
def value_key | |
@value_key ||= 'content'.freeze | |
end | |
def dig(*keys) | |
keys_with_value_key = keys.push(value_key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dig(data, *keys) | |
while keys.any? | |
outer_data = data[keys.shift] | |
inner_data = outer_data | |
break unless inner_data | |
end | |
inner_data | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Serializers | |
class BookingRequest < Base | |
template(:new_relic) do |booking_request| | |
affiliate_code = booking_request.affiliate_code | |
property = @availability_config.try(:property) | |
@itinerary = booking_request.booked_itinerary | |
@availability_config = booking_request.availability_config | |
transaction = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Serializers | |
class Reservation < Base | |
template(:default) do |reservation| | |
{ | |
adults: reservation.adults.count, | |
booked_datetime: reservation.booked_at.to_s, | |
cancellation_policy: reservation.room_rate.cancellation_policy, | |
cancelled_datetime: reservation.cancelled_at.to_s, | |
check_in: reservation.check_in, | |
check_out: reservation.check_out, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Serializers | |
class BookingRequest < Base | |
template(:new_relic) do |booking_request| | |
itinerary = booking_request.booked_itinerary | |
{ | |
agent_code: itinerary.agent_code | |
} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
module Serializers | |
describe 'BookingRequest' do | |
let(:itinerary) { build :itinerary } | |
let(:booking_request) { build :booking_request } | |
subject(:serialized_booking_request) do | |
Serializers::BookingRequest.new | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns price-sheet.jac-travel | |
(:require [clj-time.core :as time] | |
[clj-time.format :as format] | |
[clojure.core.match :as ccm] | |
[clojure.data.xml :as xml] | |
[clojure.data.zip.xml :as xml-zip] | |
[clojure.set :as set] | |
[clojure.string :as string] | |
[clojure.zip :as zip] | |
[clojurewerkz.money.amounts :as money] |