agrid-client 0.0.1
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 +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +65 -0
- data/README.md +15 -0
- data/agrid_client.gemspec +32 -0
- data/lib/agrid_client.rb +69 -0
- data/lib/agrid_client/api/cities_api.rb +80 -0
- data/lib/agrid_client/api/companies_api.rb +265 -0
- data/lib/agrid_client/api/filters_api.rb +91 -0
- data/lib/agrid_client/api/leads_api.rb +87 -0
- data/lib/agrid_client/api/quotes_api.rb +162 -0
- data/lib/agrid_client/api/services_api.rb +83 -0
- data/lib/agrid_client/api_client.rb +365 -0
- data/lib/agrid_client/api_error.rb +36 -0
- data/lib/agrid_client/configuration.rb +167 -0
- data/lib/agrid_client/models/address.rb +121 -0
- data/lib/agrid_client/models/category.rb +75 -0
- data/lib/agrid_client/models/city_company.rb +67 -0
- data/lib/agrid_client/models/city_with_full_state.rb +73 -0
- data/lib/agrid_client/models/city_with_state_name.rb +67 -0
- data/lib/agrid_client/models/company.rb +108 -0
- data/lib/agrid_client/models/company_ranking.rb +45 -0
- data/lib/agrid_client/models/concerns/swagger_model.rb +106 -0
- data/lib/agrid_client/models/customer.rb +90 -0
- data/lib/agrid_client/models/customer_input.rb +73 -0
- data/lib/agrid_client/models/data_check.rb +45 -0
- data/lib/agrid_client/models/filter.rb +75 -0
- data/lib/agrid_client/models/filter_category.rb +73 -0
- data/lib/agrid_client/models/image.rb +37 -0
- data/lib/agrid_client/models/inline_response_200.rb +67 -0
- data/lib/agrid_client/models/inline_response_200_1.rb +78 -0
- data/lib/agrid_client/models/item.rb +90 -0
- data/lib/agrid_client/models/lead.rb +77 -0
- data/lib/agrid_client/models/lead_input.rb +90 -0
- data/lib/agrid_client/models/location.rb +66 -0
- data/lib/agrid_client/models/phone.rb +58 -0
- data/lib/agrid_client/models/price_range.rb +73 -0
- data/lib/agrid_client/models/quote.rb +124 -0
- data/lib/agrid_client/models/sale.rb +28 -0
- data/lib/agrid_client/models/service.rb +90 -0
- data/lib/agrid_client/models/state.rb +67 -0
- data/lib/agrid_client/version.rb +3 -0
- data/spec/api/cities_api_spec.rb +49 -0
- data/spec/api/companies_api_spec.rb +69 -0
- data/spec/api/filters_api_spec.rb +54 -0
- data/spec/api/leads_api_spec.rb +52 -0
- data/spec/api/quotes_api_spec.rb +74 -0
- data/spec/api/services_api_spec.rb +52 -0
- data/spec/models/address_spec.rb +116 -0
- data/spec/models/category_spec.rb +66 -0
- data/spec/models/city_with_full_state_spec.rb +66 -0
- data/spec/models/city_with_state_name_spec.rb +56 -0
- data/spec/models/company_spec.rb +116 -0
- data/spec/models/customer_input_spec.rb +66 -0
- data/spec/models/customer_spec.rb +86 -0
- data/spec/models/filter_category_spec.rb +66 -0
- data/spec/models/filter_spec.rb +66 -0
- data/spec/models/inline_response_200_1_spec.rb +66 -0
- data/spec/models/inline_response_200_spec.rb +46 -0
- data/spec/models/item_spec.rb +86 -0
- data/spec/models/lead_input_spec.rb +86 -0
- data/spec/models/lead_spec.rb +76 -0
- data/spec/models/location_spec.rb +56 -0
- data/spec/models/phone_spec.rb +46 -0
- data/spec/models/price_range_spec.rb +56 -0
- data/spec/models/quote_spec.rb +116 -0
- data/spec/models/service_spec.rb +76 -0
- data/spec/models/state_spec.rb +56 -0
- data/spec/spec_helper.rb +23 -0
- metadata +319 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
Agrid Quotes API
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module AgridClient
|
14
|
+
class ApiError < StandardError
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
16
|
+
|
17
|
+
# Usage examples:
|
18
|
+
# ApiError.new
|
19
|
+
# ApiError.new("message")
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
22
|
+
def initialize(arg = nil)
|
23
|
+
if arg.is_a? Hash
|
24
|
+
arg.each do |k, v|
|
25
|
+
if k.to_s == 'message'
|
26
|
+
super v
|
27
|
+
else
|
28
|
+
instance_variable_set "@#{k}", v
|
29
|
+
end
|
30
|
+
end
|
31
|
+
else
|
32
|
+
super arg
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module AgridClient
|
4
|
+
class Configuration
|
5
|
+
# Defines url scheme
|
6
|
+
attr_accessor :scheme
|
7
|
+
|
8
|
+
# Defines url host
|
9
|
+
attr_accessor :host
|
10
|
+
|
11
|
+
# Defines url base path
|
12
|
+
attr_accessor :base_path
|
13
|
+
|
14
|
+
# Defines API keys used with API Key authentications.
|
15
|
+
#
|
16
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
17
|
+
#
|
18
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
19
|
+
# config.api_key['api_key'] = 'xxx'
|
20
|
+
attr_accessor :api_key
|
21
|
+
|
22
|
+
# Defines API key prefixes used with API Key authentications.
|
23
|
+
#
|
24
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
25
|
+
#
|
26
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
27
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
28
|
+
attr_accessor :api_key_prefix
|
29
|
+
|
30
|
+
# Defines the username used with HTTP basic authentication.
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :username
|
34
|
+
|
35
|
+
# Defines the password used with HTTP basic authentication.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :password
|
39
|
+
|
40
|
+
# Defines the access token (Bearer) used with OAuth2.
|
41
|
+
attr_accessor :access_token
|
42
|
+
|
43
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
44
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
45
|
+
# Default to false.
|
46
|
+
#
|
47
|
+
# @return [true, false]
|
48
|
+
attr_accessor :debugging
|
49
|
+
|
50
|
+
# Defines the logger used for debugging.
|
51
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
52
|
+
#
|
53
|
+
# @return [#debug]
|
54
|
+
attr_accessor :logger
|
55
|
+
|
56
|
+
# Defines the temporary folder to store downloaded files
|
57
|
+
# (for API endpoints that have file response).
|
58
|
+
# Default to use `Tempfile`.
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :temp_folder_path
|
62
|
+
|
63
|
+
# The time limit for HTTP request in seconds.
|
64
|
+
# Default to 0 (never times out).
|
65
|
+
attr_accessor :timeout
|
66
|
+
|
67
|
+
### TLS/SSL
|
68
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
69
|
+
# Default to true.
|
70
|
+
#
|
71
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
72
|
+
#
|
73
|
+
# @return [true, false]
|
74
|
+
attr_accessor :verify_ssl
|
75
|
+
|
76
|
+
# Set this to customize the certificate file to verify the peer.
|
77
|
+
#
|
78
|
+
# @return [String] the path to the certificate file
|
79
|
+
#
|
80
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
81
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
82
|
+
attr_accessor :ssl_ca_cert
|
83
|
+
|
84
|
+
# Client certificate file (for client certificate)
|
85
|
+
attr_accessor :cert_file
|
86
|
+
|
87
|
+
# Client private key file (for client certificate)
|
88
|
+
attr_accessor :key_file
|
89
|
+
|
90
|
+
attr_accessor :inject_format
|
91
|
+
|
92
|
+
attr_accessor :force_ending_format
|
93
|
+
|
94
|
+
#Credentials for API authorization
|
95
|
+
attr_accessor :app_credentials
|
96
|
+
|
97
|
+
def initialize
|
98
|
+
@scheme = 'https'
|
99
|
+
@host = 'api.agridxpto.website'
|
100
|
+
@base_path = '/v1'
|
101
|
+
@api_key = {}
|
102
|
+
@api_key_prefix = {}
|
103
|
+
@timeout = 0
|
104
|
+
@verify_ssl = true
|
105
|
+
@cert_file = nil
|
106
|
+
@key_file = nil
|
107
|
+
@debugging = false
|
108
|
+
@inject_format = false
|
109
|
+
@force_ending_format = false
|
110
|
+
@app_credentials = nil
|
111
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
112
|
+
|
113
|
+
yield(self) if block_given?
|
114
|
+
end
|
115
|
+
|
116
|
+
# The default Configuration object.
|
117
|
+
def self.default
|
118
|
+
@@default ||= Configuration.new
|
119
|
+
end
|
120
|
+
|
121
|
+
def configure
|
122
|
+
yield(self) if block_given?
|
123
|
+
end
|
124
|
+
|
125
|
+
def scheme=(scheme)
|
126
|
+
# remove :// from scheme
|
127
|
+
@scheme = scheme.sub(/:\/\//, '')
|
128
|
+
end
|
129
|
+
|
130
|
+
def host=(host)
|
131
|
+
# remove http(s):// and anything after a slash
|
132
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
133
|
+
end
|
134
|
+
|
135
|
+
def base_path=(base_path)
|
136
|
+
# Add leading and trailing slashes to base_path
|
137
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
138
|
+
@base_path = "" if @base_path == "/"
|
139
|
+
end
|
140
|
+
|
141
|
+
def base_url
|
142
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
143
|
+
URI.encode(url)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Gets API key (with prefix if set).
|
147
|
+
# @param [String] param_name the parameter name of API key auth
|
148
|
+
def api_key_with_prefix(param_name)
|
149
|
+
if @api_key_prefix[param_name]
|
150
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
151
|
+
else
|
152
|
+
@api_key[param_name]
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Gets Basic Auth token string
|
157
|
+
def basic_auth_token
|
158
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns Auth Settings hash for api client.
|
162
|
+
def auth_settings
|
163
|
+
{
|
164
|
+
}
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
=begin
|
2
|
+
Agrid Quotes API
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require_relative 'concerns/swagger_model'
|
15
|
+
|
16
|
+
module AgridClient
|
17
|
+
class Address
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# Street of company address
|
21
|
+
attr_accessor :street
|
22
|
+
|
23
|
+
# Number of company address
|
24
|
+
attr_accessor :number
|
25
|
+
|
26
|
+
# Additional info of company address
|
27
|
+
attr_accessor :complement
|
28
|
+
|
29
|
+
# District of company address
|
30
|
+
attr_accessor :district
|
31
|
+
|
32
|
+
# Zipcode of company address
|
33
|
+
attr_accessor :zipcode
|
34
|
+
|
35
|
+
# City of company address
|
36
|
+
attr_accessor :city
|
37
|
+
|
38
|
+
# State of company address
|
39
|
+
attr_accessor :state
|
40
|
+
|
41
|
+
# Country of company address
|
42
|
+
attr_accessor :country
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'street' => :'street',
|
48
|
+
:'number' => :'number',
|
49
|
+
:'complement' => :'complement',
|
50
|
+
:'district' => :'district',
|
51
|
+
:'zipcode' => :'zipcode',
|
52
|
+
:'city' => :'city',
|
53
|
+
:'state' => :'state',
|
54
|
+
:'country' => :'country'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.swagger_types
|
60
|
+
{
|
61
|
+
:'street' => :'String',
|
62
|
+
:'number' => :'String',
|
63
|
+
:'complement' => :'String',
|
64
|
+
:'district' => :'String',
|
65
|
+
:'zipcode' => :'String',
|
66
|
+
:'city' => :'String',
|
67
|
+
:'state' => :'String',
|
68
|
+
:'country' => :'String'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
return unless attributes.is_a?(Hash)
|
76
|
+
|
77
|
+
# convert string to symbol for hash key
|
78
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
79
|
+
|
80
|
+
if attributes[:'street']
|
81
|
+
self.street = attributes[:'street']
|
82
|
+
end
|
83
|
+
if attributes[:'number']
|
84
|
+
self.number = attributes[:'number']
|
85
|
+
end
|
86
|
+
if attributes[:'complement']
|
87
|
+
self.complement = attributes[:'complement']
|
88
|
+
end
|
89
|
+
if attributes[:'district']
|
90
|
+
self.district = attributes[:'district']
|
91
|
+
end
|
92
|
+
if attributes[:'zipcode']
|
93
|
+
self.zipcode = attributes[:'zipcode']
|
94
|
+
end
|
95
|
+
if attributes[:'city']
|
96
|
+
self.city = attributes[:'city']
|
97
|
+
end
|
98
|
+
if attributes[:'state']
|
99
|
+
self.state = attributes[:'state']
|
100
|
+
end
|
101
|
+
if attributes[:'country']
|
102
|
+
self.country = attributes[:'country']
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(o)
|
109
|
+
return true if self.equal?(o)
|
110
|
+
self.class == o.class &&
|
111
|
+
street == o.street &&
|
112
|
+
number == o.number &&
|
113
|
+
complement == o.complement &&
|
114
|
+
district == o.district &&
|
115
|
+
zipcode == o.zipcode &&
|
116
|
+
city == o.city &&
|
117
|
+
state == o.state &&
|
118
|
+
country == o.country
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
=begin
|
2
|
+
Agrid Quotes API
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require_relative 'concerns/swagger_model'
|
15
|
+
|
16
|
+
module AgridClient
|
17
|
+
class Category
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# Unique Id
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
# Category name
|
24
|
+
attr_accessor :title
|
25
|
+
|
26
|
+
attr_accessor :items
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'id' => :'id',
|
32
|
+
:'title' => :'title',
|
33
|
+
:'items' => :'items'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'id' => :'String',
|
41
|
+
:'title' => :'String',
|
42
|
+
:'items' => :'Array<Item>'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes[:'id']
|
55
|
+
self.id = attributes[:'id']
|
56
|
+
end
|
57
|
+
if attributes[:'title']
|
58
|
+
self.title = attributes[:'title']
|
59
|
+
end
|
60
|
+
if attributes[:'items']
|
61
|
+
if (value = attributes[:'items']).is_a?(Array)
|
62
|
+
self.items = value
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Checks equality by comparing each attribute.
|
68
|
+
# @param [Object] Object to be compared
|
69
|
+
def ==(o)
|
70
|
+
return true if self.equal?(o)
|
71
|
+
self.class == o.class &&
|
72
|
+
id == o.id
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
=begin
|
2
|
+
Agrid Quotes API
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require_relative 'concerns/swagger_model'
|
15
|
+
|
16
|
+
module AgridClient
|
17
|
+
class CityCompany
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# The city
|
21
|
+
attr_accessor :city
|
22
|
+
|
23
|
+
# How much the company charge to attend this city
|
24
|
+
attr_accessor :freight
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'city' => :'city',
|
30
|
+
:'freight' => :'freight'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'city' => :'CityWithFullState',
|
38
|
+
:'freight' => :'Float'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
return unless attributes.is_a?(Hash)
|
46
|
+
|
47
|
+
# convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
49
|
+
|
50
|
+
if attributes[:'city']
|
51
|
+
self.city = attributes[:'city']
|
52
|
+
end
|
53
|
+
if attributes[:'freight']
|
54
|
+
self.freight = attributes[:'freight']
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Checks equality by comparing each attribute.
|
59
|
+
# @param [Object] Object to be compared
|
60
|
+
def ==(o)
|
61
|
+
return true if self.equal?(o)
|
62
|
+
self.class == o.class &&
|
63
|
+
city == o.city &&
|
64
|
+
freight == o.freight
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|