simplyrets 0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +46 -13
- data/README.org +6 -6
- data/example.rb +9 -9
- data/lib/simplyrets.rb +33 -56
- data/lib/simplyrets/#listing.rb# +199 -0
- data/lib/simplyrets/api/default_api.rb +154 -0
- data/lib/simplyrets/listing.rb~ +199 -0
- data/lib/simplyrets/models/agent.rb +61 -0
- data/lib/simplyrets/models/base_object.rb +87 -0
- data/lib/simplyrets/models/broker.rb +37 -0
- data/lib/simplyrets/models/contact_information.rb +53 -0
- data/lib/simplyrets/models/error.rb +45 -0
- data/lib/simplyrets/models/geographic_data.rb +69 -0
- data/lib/simplyrets/models/listing.rb +199 -0
- data/lib/simplyrets/models/listing.rb~ +199 -0
- data/lib/simplyrets/models/mls_information.rb +69 -0
- data/lib/simplyrets/models/office.rb +61 -0
- data/lib/simplyrets/models/open_house.rb +37 -0
- data/lib/simplyrets/models/parking.rb +53 -0
- data/lib/simplyrets/models/property.rb +277 -0
- data/lib/simplyrets/models/sales.rb +69 -0
- data/lib/simplyrets/models/school.rb +61 -0
- data/lib/simplyrets/models/street_address.rb +85 -0
- data/lib/simplyrets/models/tax.rb +53 -0
- data/lib/simplyrets/simplyrets.rb +76 -0
- data/lib/simplyrets/simplyrets/api_error.rb +26 -0
- data/lib/simplyrets/simplyrets/configuration.rb +101 -0
- data/lib/simplyrets/simplyrets/request.rb +213 -0
- data/lib/simplyrets/simplyrets/response.rb +156 -0
- data/lib/simplyrets/simplyrets/version.rb +5 -0
- data/simplyrets.gemspec +16 -9
- metadata +153 -36
- data/#example.rb# +0 -29
- data/lib/monkey.rb +0 -90
- data/lib/properties_api.rb +0 -75
- data/lib/simplyrets.rb~ +0 -85
- data/lib/simplyrets/configuration.rb +0 -25
- data/lib/simplyrets/request.rb +0 -205
- data/lib/simplyrets/response.rb +0 -70
- data/lib/simplyrets/version.rb +0 -4
- data/models/agent.rb +0 -39
- data/models/contactinformation.rb +0 -36
- data/models/geographicdata.rb +0 -43
- data/models/listing.rb +0 -95
- data/models/mlsinformation.rb +0 -35
- data/models/office.rb +0 -39
- data/models/property.rb +0 -84
- data/models/school.rb +0 -27
- data/models/streetaddress.rb +0 -47
- data/models/tax.rb +0 -28
- data/pkg/simplyrets-0.1.gem +0 -0
data/#example.rb#
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
%w(rubygems simplyrets).each {|lib| require lib}
|
4
|
-
%w(rubygems simplyrets).each {|models| require models}
|
5
|
-
|
6
|
-
require "simplyrets"
|
7
|
-
require "properties_api"
|
8
|
-
require "listing"
|
9
|
-
|
10
|
-
p "SimplyRETS Ruby SDK"
|
11
|
-
|
12
|
-
SimplyRets.configure do |config|
|
13
|
-
config.username = 'simplyrets'
|
14
|
-
config.password = 'simplyrets'
|
15
|
-
end
|
16
|
-
|
17
|
-
# Properties
|
18
|
-
listings = Properties_api.properties({:minbeds => 2,:brokers => [ "COLD09" ]})
|
19
|
-
listings.each do |l|
|
20
|
-
p l.property['bedrooms']
|
21
|
-
p l.office['brokerid']
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
# Single Properties
|
26
|
-
# Single Listing
|
27
|
-
p = Properties_api.property(47638976)
|
28
|
-
Agentlist 47638976
|
29
|
-
p "#{p.geo['lat']}, #{p.geo['lng']}"
|
data/lib/monkey.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# module SimplyRets
|
2
|
-
class Object
|
3
|
-
|
4
|
-
unless Object.method_defined? :blank?
|
5
|
-
def blank?
|
6
|
-
respond_to?(:empty?) ? empty? : !self
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
unless Object.method_defined? :present?
|
11
|
-
def present?
|
12
|
-
!blank?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
class String
|
19
|
-
|
20
|
-
unless String.method_defined? :underscore
|
21
|
-
def underscore
|
22
|
-
self.gsub(/::/, '/').
|
23
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
24
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
25
|
-
tr("-", "_").
|
26
|
-
downcase
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
unless String.method_defined? :camelize
|
31
|
-
def camelize(first_letter_in_uppercase = true)
|
32
|
-
if first_letter_in_uppercase != :lower
|
33
|
-
self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
34
|
-
else
|
35
|
-
self.to_s[0].chr.downcase + camelize(self)[1..-1]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
class Hash
|
43
|
-
|
44
|
-
unless Hash.method_defined? :stringify_keys
|
45
|
-
def stringify_keys
|
46
|
-
inject({}) do |options, (key, value)|
|
47
|
-
options[key.to_s] = value
|
48
|
-
options
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
unless Hash.method_defined? :stringify_keys!
|
54
|
-
def stringify_keys!
|
55
|
-
self.replace(self.stringify_keys)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
unless Hash.method_defined? :symbolize_keys
|
60
|
-
def symbolize_keys
|
61
|
-
inject({}) do |options, (key, value)|
|
62
|
-
options[(key.to_sym rescue key) || key] = value
|
63
|
-
options
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
unless Hash.method_defined? :symbolize_keys!
|
69
|
-
def symbolize_keys!
|
70
|
-
self.replace(self.symbolize_keys)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
unless Hash.method_defined? :symbolize_and_underscore_keys
|
75
|
-
def symbolize_and_underscore_keys
|
76
|
-
inject({}) do |options, (key, value)|
|
77
|
-
options[(key.to_s.underscore.to_sym rescue key) || key] = value
|
78
|
-
options
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
unless Hash.method_defined? :symbolize_and_underscore_keys!
|
84
|
-
def symbolize_and_underscore_keys!
|
85
|
-
self.replace(self.symbolize_and_underscore_keys)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
# end
|
data/lib/properties_api.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require "uri"
|
2
|
-
|
3
|
-
class Properties_api
|
4
|
-
basePath = "https://api.simplyrets.com"
|
5
|
-
|
6
|
-
def self.escapeString(string)
|
7
|
-
URI.encode(string.to_s)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.properties (opts={})
|
11
|
-
query_param_keys = [:brokers,:features,:amenities,:agent,:maxarea,
|
12
|
-
:minarea,:minprice,:minbaths,:maxbeds,:minbeds,
|
13
|
-
:neighborhoods,:points,:counties,:status,:type,:q]
|
14
|
-
|
15
|
-
# set default values and merge with input
|
16
|
-
options = {
|
17
|
-
:brokers => nil ,
|
18
|
-
:features => nil ,
|
19
|
-
:amenities => nil ,
|
20
|
-
:agent => nil ,
|
21
|
-
:maxarea => nil ,
|
22
|
-
:minarea => nil ,
|
23
|
-
:minprice => nil ,
|
24
|
-
:minbaths => nil ,
|
25
|
-
:maxbeds => nil ,
|
26
|
-
:minbeds => nil ,
|
27
|
-
:neighborhoods => nil ,
|
28
|
-
:points => nil ,
|
29
|
-
:counties => nil ,
|
30
|
-
:status => nil ,
|
31
|
-
:type => nil ,
|
32
|
-
:q => nil }.merge(opts)
|
33
|
-
|
34
|
-
#resource path
|
35
|
-
path = "/properties".sub('{format}','json')
|
36
|
-
|
37
|
-
# pull querystring keys from options
|
38
|
-
queryopts = options.select do |key,value|
|
39
|
-
query_param_keys.include? key
|
40
|
-
end
|
41
|
-
|
42
|
-
headers = nil
|
43
|
-
post_body = nil
|
44
|
-
response = SimplyRets::Request.new(:GET, path,{:params=>queryopts, :headers=>headers, :body=>post_body }).make.body
|
45
|
-
response.map {|response|Listing.new(response)}
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.property (mls_id=nil,opts={})
|
50
|
-
query_param_keys = []
|
51
|
-
|
52
|
-
# verify existence of params
|
53
|
-
raise "mls_id is required" if mls_id.nil?
|
54
|
-
|
55
|
-
# set default values and merge with input
|
56
|
-
options = {
|
57
|
-
:mls_id => nil
|
58
|
-
}.merge(opts)
|
59
|
-
|
60
|
-
#resource path
|
61
|
-
path = "/properties/{mlsId}".sub('{format}','json').sub('{' + 'mlsId' + '}', escapeString(mls_id))
|
62
|
-
|
63
|
-
# pull querystring keys from options
|
64
|
-
queryopts = options.select do |key,value|
|
65
|
-
query_param_keys.include? key
|
66
|
-
end
|
67
|
-
|
68
|
-
headers = nil
|
69
|
-
post_body = nil
|
70
|
-
response = SimplyRets::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
71
|
-
Listing.new(response)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
data/lib/simplyrets.rb~
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'monkey'
|
3
|
-
require 'simplyrets/configuration'
|
4
|
-
require 'simplyrets/request'
|
5
|
-
require 'simplyrets/response'
|
6
|
-
require 'simplyrets/version'
|
7
|
-
require 'logger'
|
8
|
-
|
9
|
-
module SimplyRets
|
10
|
-
|
11
|
-
class << self
|
12
|
-
attr_accessor :logger
|
13
|
-
|
14
|
-
# A SimplyRets configuration object. Must act like a hash and return sensible
|
15
|
-
# values for all SimplyRets configuration options. See SimplyRets::Configuration.
|
16
|
-
attr_accessor :configuration
|
17
|
-
|
18
|
-
attr_accessor :resources
|
19
|
-
|
20
|
-
# Call this method to modify defaults in your initializers.
|
21
|
-
#
|
22
|
-
# @example
|
23
|
-
# SimplyRets.configure do |config|
|
24
|
-
# config.api_key = '1234567890abcdef' # required
|
25
|
-
# config.username = 'wordlover' # optional, but needed for user-related functions
|
26
|
-
# config.password = 'i<3words' # optional, but needed for user-related functions
|
27
|
-
# config.format = 'json' # optional, defaults to 'json'
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
def configure
|
31
|
-
self.configuration ||= Configuration.new
|
32
|
-
yield(configuration) if block_given?
|
33
|
-
|
34
|
-
# Configure logger. Default to use Rails
|
35
|
-
self.logger ||= configuration.logger || (defined?(Rails) ? Rails.logger : Logger.new(STDOUT))
|
36
|
-
|
37
|
-
# remove :// from scheme
|
38
|
-
configuration.scheme.sub!(/:\/\//, '')
|
39
|
-
|
40
|
-
# remove http(s):// and anything after a slash
|
41
|
-
configuration.host.sub!(/https?:\/\//, '')
|
42
|
-
configuration.host = configuration.host.split('/').first
|
43
|
-
|
44
|
-
# Add leading and trailing slashes to base_path
|
45
|
-
configuration.base_path = "/#{configuration.base_path}".gsub(/\/+/, '/')
|
46
|
-
configuration.base_path = "" if configuration.base_path == "/"
|
47
|
-
end
|
48
|
-
|
49
|
-
def authenticated?
|
50
|
-
SimplyRets.configuration.auth_token.present?
|
51
|
-
end
|
52
|
-
|
53
|
-
def de_authenticate
|
54
|
-
SimplyRets.configuration.auth_token = nil
|
55
|
-
end
|
56
|
-
|
57
|
-
def authenticate
|
58
|
-
return if SimplyRets.authenticated?
|
59
|
-
|
60
|
-
if SimplyRets.configuration.username.blank? || SimplyRets.configuration.password.blank?
|
61
|
-
raise ClientError, "Username and password are required to authenticate."
|
62
|
-
end
|
63
|
-
|
64
|
-
request = SimplyRets::Request.new(
|
65
|
-
:get,
|
66
|
-
"account/authenticate/{username}",
|
67
|
-
:params => {
|
68
|
-
:username => SimplyRets.configuration.username,
|
69
|
-
:password => SimplyRets.configuration.password
|
70
|
-
}
|
71
|
-
)
|
72
|
-
|
73
|
-
response_body = request.response.body
|
74
|
-
SimplyRets.configuration.auth_token = response_body['token']
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
class ServerError < StandardError
|
82
|
-
end
|
83
|
-
|
84
|
-
class ClientError < StandardError
|
85
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module SimplyRets
|
2
|
-
|
3
|
-
class Configuration
|
4
|
-
require 'simplyrets/version'
|
5
|
-
|
6
|
-
attr_accessor :format, :api_key, :username, :password,
|
7
|
-
:auth_token, :scheme, :host, :base_path,
|
8
|
-
:user_agent, :logger, :inject_format,
|
9
|
-
:force_ending_format, :camelize_params
|
10
|
-
|
11
|
-
# Defaults go in here..
|
12
|
-
def initialize
|
13
|
-
@format = 'json'
|
14
|
-
@scheme = 'https'
|
15
|
-
@host = 'api.simplyrets.com'
|
16
|
-
@base_path = '/'
|
17
|
-
@user_agent = "ruby-#{SimplyRets::VERSION}"
|
18
|
-
@inject_format = false
|
19
|
-
@force_ending_format = false
|
20
|
-
@camelize_params = true
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
data/lib/simplyrets/request.rb
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
module SimplyRets
|
2
|
-
|
3
|
-
class Request
|
4
|
-
require 'uri'
|
5
|
-
require 'addressable/uri'
|
6
|
-
require 'typhoeus'
|
7
|
-
require 'base64'
|
8
|
-
require "simplyrets/version"
|
9
|
-
|
10
|
-
attr_accessor :host, :path, :format, :params, :body, :http_method, :headers
|
11
|
-
|
12
|
-
|
13
|
-
# All requests must have an HTTP method and a path
|
14
|
-
# Optionals parameters are :params, :headers, :body, :format, :host
|
15
|
-
#
|
16
|
-
def initialize(http_method, path, attributes={})
|
17
|
-
attributes[:format] ||= SimplyRets.configuration.format
|
18
|
-
attributes[:params] ||= {}
|
19
|
-
|
20
|
-
# Set default headers
|
21
|
-
default_headers = {
|
22
|
-
'Content-Type' => "application/#{attributes[:format].downcase}",
|
23
|
-
:api_key => SimplyRets.configuration.api_key
|
24
|
-
}
|
25
|
-
|
26
|
-
# api_key from headers hash trumps the default, even if its value is blank
|
27
|
-
if attributes[:headers].present? && attributes[:headers].has_key?(:api_key)
|
28
|
-
default_headers.delete(:api_key)
|
29
|
-
end
|
30
|
-
|
31
|
-
# api_key from params hash trumps all others (headers and default_headers)
|
32
|
-
if attributes[:params].present? && attributes[:params].has_key?(:api_key)
|
33
|
-
default_headers.delete(:api_key)
|
34
|
-
attributes[:headers].delete(:api_key) if attributes[:headers].present?
|
35
|
-
end
|
36
|
-
|
37
|
-
# Merge argument headers into defaults
|
38
|
-
attributes[:headers] = default_headers.merge(attributes[:headers] || {})
|
39
|
-
|
40
|
-
# Stick in the auth header
|
41
|
-
auth = SimplyRets.configuration.username + ":" + SimplyRets.configuration.password
|
42
|
-
attributes[:headers].merge!({"Authorization" =>
|
43
|
-
("Basic " + Base64.encode64(auth))})
|
44
|
-
|
45
|
-
self.http_method = http_method.to_sym
|
46
|
-
self.path = path
|
47
|
-
attributes.each do |name, value|
|
48
|
-
send("#{name.to_s.underscore.to_sym}=", value)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Construct a base URL
|
53
|
-
#
|
54
|
-
def url(options = {})
|
55
|
-
u = Addressable::URI.new(
|
56
|
-
:scheme => SimplyRets.configuration.scheme,
|
57
|
-
:host => SimplyRets.configuration.host,
|
58
|
-
:path => self.interpreted_path,
|
59
|
-
:query => self.query_string.sub(/\?/, '')
|
60
|
-
).to_s
|
61
|
-
|
62
|
-
# Drop trailing question mark, if present
|
63
|
-
u.sub! /\?$/, ''
|
64
|
-
|
65
|
-
u
|
66
|
-
end
|
67
|
-
|
68
|
-
# Iterate over the params hash, injecting any path values into the path string
|
69
|
-
#
|
70
|
-
# NOTE: This is currently not supported in the SimplyRETS API. Content
|
71
|
-
# formatting is handled via the accept header.
|
72
|
-
#
|
73
|
-
# e.g. /properties.{format}/{word}/entries => /word.json/cat/entries
|
74
|
-
def interpreted_path
|
75
|
-
p = self.path.dup
|
76
|
-
|
77
|
-
# Fill in the path params
|
78
|
-
self.params.each_pair do |key, value|
|
79
|
-
p = p.gsub("{#{key}}", value.to_s)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Stick a .{format} placeholder into the path if there isn't
|
83
|
-
# one already or an actual format like json or xml
|
84
|
-
# e.g. /properties/mlsId => /properties.{format}/mlsId
|
85
|
-
if SimplyRets.configuration.inject_format
|
86
|
-
unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s }
|
87
|
-
p = p.sub(/^(\/?\w+)/, "\\1.#{format}")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
# Stick a .{format} placeholder on the end of the path if there
|
92
|
-
# isn't one already or an actual format like json or xml
|
93
|
-
#
|
94
|
-
# NOTE: This is currently not supported in the SimplyRETS
|
95
|
-
# API. Content formatting is handled via the accept header.
|
96
|
-
#
|
97
|
-
# e.g. /properties/blah => /properties/blah.{format}
|
98
|
-
if SimplyRets.configuration.force_ending_format
|
99
|
-
unless ['.json', '.xml', '{format}'].any? {|s| p.downcase.include? s }
|
100
|
-
p = "#{p}.#{format}"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
p = p.sub("{format}", self.format.to_s)
|
105
|
-
|
106
|
-
URI.encode [SimplyRets.configuration.base_path, p].join("/").gsub(/\/+/, '/')
|
107
|
-
end
|
108
|
-
|
109
|
-
# Massage the request body into a state of readiness If body is a
|
110
|
-
# hash, camelize all keys then convert to a json string
|
111
|
-
def body=(value)
|
112
|
-
if value.is_a?(Hash)
|
113
|
-
value = value.inject({}) do |memo, (k,v)|
|
114
|
-
memo[k.to_s.camelize(:lower).to_sym] = v
|
115
|
-
memo
|
116
|
-
end
|
117
|
-
end
|
118
|
-
@body = value
|
119
|
-
end
|
120
|
-
|
121
|
-
# If body is an object, JSONify it before making the actual request.
|
122
|
-
#
|
123
|
-
def outgoing_body
|
124
|
-
body.is_a?(String) ? body : body.to_json
|
125
|
-
end
|
126
|
-
|
127
|
-
# Construct a query string from the query-string-type params
|
128
|
-
def query_string
|
129
|
-
|
130
|
-
# Iterate over all params,
|
131
|
-
# .. removing the ones that are part of the path itself.
|
132
|
-
# .. stringifying values so Addressable doesn't blow up.
|
133
|
-
query_values = {}
|
134
|
-
self.params.each_pair do |key, value|
|
135
|
-
next if self.path.include? "{#{key}}" # skip path params
|
136
|
-
next if value.blank? && value.class != FalseClass # skip empties
|
137
|
-
if SimplyRets.configuration.camelize_params
|
138
|
-
# api_key is not a camelCased param
|
139
|
-
#
|
140
|
-
# NOTE: api_key param is not currently used by SimplyRETS API
|
141
|
-
key = key.to_s.camelize(:lower).to_sym unless key.to_sym == :api_key
|
142
|
-
end
|
143
|
-
query_values[key] = value
|
144
|
-
end
|
145
|
-
|
146
|
-
# We don't want to end up with '?' as our query string
|
147
|
-
# if there aren't really any params
|
148
|
-
return "" if query_values.blank?
|
149
|
-
|
150
|
-
# Addressable requires query_values to be set after initialization..
|
151
|
-
qs = Addressable::URI.new
|
152
|
-
qs.query_values = query_values
|
153
|
-
qs.to_s
|
154
|
-
end
|
155
|
-
|
156
|
-
def make
|
157
|
-
logger = Logger.new STDOUT
|
158
|
-
logger.debug self.url
|
159
|
-
response = case self.http_method.to_sym
|
160
|
-
when :get,:GET
|
161
|
-
Typhoeus::Request.get(
|
162
|
-
self.url,
|
163
|
-
:headers => self.headers.stringify_keys,
|
164
|
-
)
|
165
|
-
|
166
|
-
when :post,:POST
|
167
|
-
Typhoeus::Request.post(
|
168
|
-
self.url,
|
169
|
-
:body => self.outgoing_body,
|
170
|
-
:headers => self.headers.stringify_keys,
|
171
|
-
)
|
172
|
-
|
173
|
-
when :put,:PUT
|
174
|
-
Typhoeus::Request.put(
|
175
|
-
self.url,
|
176
|
-
:body => self.outgoing_body,
|
177
|
-
:headers => self.headers.stringify_keys,
|
178
|
-
)
|
179
|
-
|
180
|
-
when :delete,:DELETE
|
181
|
-
Typhoeus::Request.delete(
|
182
|
-
self.url,
|
183
|
-
:body => self.outgoing_body,
|
184
|
-
:headers => self.headers.stringify_keys,
|
185
|
-
)
|
186
|
-
end
|
187
|
-
Response.new(response)
|
188
|
-
end
|
189
|
-
|
190
|
-
def response
|
191
|
-
self.make
|
192
|
-
end
|
193
|
-
|
194
|
-
def response_code_pretty
|
195
|
-
return unless @response.present?
|
196
|
-
@response.code.to_s
|
197
|
-
end
|
198
|
-
|
199
|
-
def response_headers_pretty
|
200
|
-
return unless @response.present?
|
201
|
-
@response.headers.gsub(/\n/, '<br/>') # <- This is for Typhoeus
|
202
|
-
end
|
203
|
-
|
204
|
-
end
|
205
|
-
end
|