Top Level Namespace

Defined Under Namespace

Modules: Colrapi, Configuration, Faraday Classes: Hash

Instance Method Summary collapse

Instance Method Details

#field_query_handler(x) ⇒ Object



16
17
18
19
# File 'lib/colrapi/utils.rb', line 16

def field_query_handler(x)
  tmp = x.keep_if { |z| z.match(/query_/) }
  rename_query_filters(tmp)
end

#make_user_agentObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/colrapi/utils.rb', line 5

def make_user_agent
  requa = "Faraday/v" + Faraday::VERSION
  habua = "Colrapi/v" + Colrapi::VERSION
  ua = requa + " " + habua
  if Colrapi.mailto
    ua += " (mailto:%s)" % Colrapi.mailto
  end
  # ua += format(' (mailto:%s)', Colrapi.mailto) if Colrapi.mailto
  ua
end

#rename_query_filters(foo) ⇒ Object



21
22
23
24
25
# File 'lib/colrapi/utils.rb', line 21

def rename_query_filters(foo)
  foo = foo.tostrings
  foo = foo.map { |x, y| [x.to_s.sub("container_title", "container-title"), y] }.to_h
  foo.map { |x, y| [x.to_s.sub("query_", "query."), y] }.to_h
end