Class: Resizing::MockClient

Inherits:
Object
  • Object
show all
Defined in:
lib/resizing/mock_client.rb

Instance Method Summary collapse

Instance Method Details

#delete(name) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/resizing/mock_client.rb', line 20

def delete(name)
  r = load_yaml('test/vcr/client/delete.yml')
  result = JSON.parse(r['string'])
  # replace name and public_id by name argument
  result['id'] = name
  result['public_id'].gsub!(/28c49144-c00d-4cb5-8619-98ce95977b9c/, name)
  result
end

#metadata(name) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/resizing/mock_client.rb', line 29

def (name)
  r = load_yaml('test/vcr/client/metadata.yml')
  result = JSON.parse(r['string'])
  # replace name and public_id by name argument
  result['id'] = name
  result['public_id'].gsub!(/bfdaf2b3-7ec5-41f4-9caa-d53247dd9666/, name)
  result
end

#post(file_or_binary, options = {}) ⇒ Object



5
6
7
8
# File 'lib/resizing/mock_client.rb', line 5

def post(file_or_binary, options = {})
  r = load_yaml('test/vcr/client/post.yml')
  JSON.parse(r['string'])
end

#put(name, file_or_binary, options) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/resizing/mock_client.rb', line 10

def put(name, file_or_binary, options)
  r = load_yaml('test/vcr/client/put.yml')
  result = JSON.parse(r['string'])
  # replace name, public_id and version by name argument
  result['id'] = name
  result['public_id'].gsub!(/AWEaewfAreaweFAFASfwe/, name)
  result['public_id'].gsub!(/v6Ew3HmDAYfb3NMRdLxR45i_gXMbLlGyi/, "v#{Time.now.to_f}")
  result
end