Class: Assemble::Client::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/assemble/client.rb

Overview

Real

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dataObject



89
90
91
92
93
94
95
# File 'lib/assemble/client.rb', line 89

def self.data
  @data ||= begin
              {
                :tags => {},
              }
            end
end

Instance Method Details

#response(options = {}) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/assemble/client.rb', line 97

def response(options={})
  url     = options[:url] || File.join(@url.to_s, options[:path] || "/")
  method  = (options[:method] || :get).to_s.to_sym
  status  = options[:status] || 200
  body    = options[:body]
  headers = {
    "Content-Type" => "application/json; charset=utf-8"
  }.merge(options[:headers] || {})

  Assemble::Response.new(
    :status  => status,
    :headers => headers,
    :body    => body,
    :request => {
      :method => method,
      :url    => url,
    }
  ).raise!
end

#url_for(path) ⇒ Object



117
118
119
# File 'lib/assemble/client.rb', line 117

def url_for(path)
  File.join(@url, path)
end