agrid-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,73 @@
|
|
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 CityWithFullState
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# Unique Id
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
# City name
|
24
|
+
attr_accessor :title
|
25
|
+
|
26
|
+
attr_accessor :state
|
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
|
+
:'state' => :'state'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'id' => :'String',
|
41
|
+
:'title' => :'String',
|
42
|
+
:'state' => :'State'
|
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[:'state']
|
61
|
+
self.state = attributes[:'state']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Checks equality by comparing each attribute.
|
66
|
+
# @param [Object] Object to be compared
|
67
|
+
def ==(o)
|
68
|
+
return true if self.equal?(o)
|
69
|
+
self.class == o.class &&
|
70
|
+
id == o.id
|
71
|
+
end
|
72
|
+
end
|
73
|
+
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 CityWithStateName
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# City name
|
21
|
+
attr_accessor :title
|
22
|
+
|
23
|
+
# State name
|
24
|
+
attr_accessor :state
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'title' => :'title',
|
30
|
+
:'state' => :'state'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'title' => :'String',
|
38
|
+
:'state' => :'String'
|
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[:'title']
|
51
|
+
self.title = attributes[:'title']
|
52
|
+
end
|
53
|
+
if attributes[:'state']
|
54
|
+
self.state = attributes[:'state']
|
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
|
+
title == o.title &&
|
64
|
+
state == o.state
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,108 @@
|
|
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 Company
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# Unique id
|
21
|
+
attr_accessor :id, :email, :name, :person_in_charge, :website, :location,
|
22
|
+
:addresses, :phones, :logo, :cover, :data_checks, :rankings
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'id' => :'id',
|
28
|
+
:'email' => :'email',
|
29
|
+
:'name' => :'name',
|
30
|
+
:'person_in_charge' => :'person_in_charge',
|
31
|
+
:'website' => :'website',
|
32
|
+
:'location' => :'location',
|
33
|
+
:'addresses' => :'addresses',
|
34
|
+
:'phones' => :'phones',
|
35
|
+
:'logo' => :'logo',
|
36
|
+
:'cover' => :'cover',
|
37
|
+
:'data_checks' => :'data_checks',
|
38
|
+
:'rankings' => :'company_rankings'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.swagger_types
|
44
|
+
{
|
45
|
+
:'id' => :'String',
|
46
|
+
:'email' => :'String',
|
47
|
+
:'name' => :'String',
|
48
|
+
:'person_in_charge' => :'String',
|
49
|
+
:'website' => :'String',
|
50
|
+
:'location' => :'Location',
|
51
|
+
:'addresses' => :'Array<Address>',
|
52
|
+
:'phones' => :'Array<Phone>',
|
53
|
+
:'logo_image' => :'String',
|
54
|
+
:'cover_image' => :'String',
|
55
|
+
:'data_checks' => :'Array<DataCheck>',
|
56
|
+
:'rankings' => :'Array<CompanyRanking>'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
return unless attributes.is_a?(Hash)
|
64
|
+
|
65
|
+
# convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
67
|
+
|
68
|
+
if attributes[:'id']
|
69
|
+
self.id = attributes[:'id']
|
70
|
+
end
|
71
|
+
if attributes[:'email']
|
72
|
+
self.email = attributes[:'email']
|
73
|
+
end
|
74
|
+
if attributes[:'name']
|
75
|
+
self.name = attributes[:'name']
|
76
|
+
end
|
77
|
+
if attributes[:'person_in_charge']
|
78
|
+
self.person_in_charge = attributes[:'person_in_charge']
|
79
|
+
end
|
80
|
+
if attributes[:'website']
|
81
|
+
self.website = attributes[:'website']
|
82
|
+
end
|
83
|
+
if attributes[:'location']
|
84
|
+
self.location = attributes[:'location']
|
85
|
+
end
|
86
|
+
if attributes[:'addresses']
|
87
|
+
self.addresses = attributes[:'addresses']
|
88
|
+
end
|
89
|
+
if attributes[:'phones']
|
90
|
+
self.phones = attributes[:'phones']
|
91
|
+
end
|
92
|
+
if attributes[:'data_checks']
|
93
|
+
self.data_checks = attributes[:'data_checks']
|
94
|
+
end
|
95
|
+
if attributes[:'rankings']
|
96
|
+
self.rankings = attributes[:'rankings']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Checks equality by comparing each attribute.
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def ==(o)
|
103
|
+
return true if self.equal?(o)
|
104
|
+
self.class == o.class &&
|
105
|
+
id == o.id
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'concerns/swagger_model'
|
2
|
+
|
3
|
+
module AgridClient
|
4
|
+
class CompanyRanking
|
5
|
+
include SwaggerModel
|
6
|
+
|
7
|
+
attr_accessor :service, :ranking
|
8
|
+
|
9
|
+
def self.attribute_map
|
10
|
+
{
|
11
|
+
:'service' => :'service',
|
12
|
+
:'ranking' => :'ranking'
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
# Attribute type mapping.
|
17
|
+
def self.swagger_types
|
18
|
+
{
|
19
|
+
:'service' => :'Service',
|
20
|
+
:'ranking' => :'Float'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Initializes the object
|
25
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
26
|
+
def initialize(attributes = {})
|
27
|
+
return unless attributes.is_a?(Hash)
|
28
|
+
|
29
|
+
# convert string to symbol for hash key
|
30
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
31
|
+
|
32
|
+
self.service = attributes[:'service'] if attributes[:'service']
|
33
|
+
self.ranking = attributes[:'ranking'] if attributes[:'ranking']
|
34
|
+
end
|
35
|
+
|
36
|
+
# Checks equality by comparing each attribute.
|
37
|
+
# @param [Object] Object to be compared
|
38
|
+
def ==(o)
|
39
|
+
return true if self.equal?(o)
|
40
|
+
self.class == o.class &&
|
41
|
+
service == o.service &&
|
42
|
+
ranking == o.ranking
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'pry'
|
2
|
+
module SwaggerModel
|
3
|
+
# @see the `==` method
|
4
|
+
# @param [Object] Object to be compared
|
5
|
+
def eql?(o)
|
6
|
+
self == o
|
7
|
+
end
|
8
|
+
|
9
|
+
# Builds the object from hash
|
10
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
11
|
+
# @return [Object] Returns the model itself
|
12
|
+
def build_from_hash(attributes)
|
13
|
+
return nil unless attributes.is_a?(Hash)
|
14
|
+
self.class.swagger_types.each_pair do |key, type|
|
15
|
+
if type =~ /^Array<(.*)>/i
|
16
|
+
# check to ensure the input is an array given that the the attribute
|
17
|
+
# is documented as an array but the input is not
|
18
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
19
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
20
|
+
end
|
21
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
22
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
23
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
24
|
+
end
|
25
|
+
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserializes the data based on type
|
30
|
+
# @param string type Data type
|
31
|
+
# @param string value Value to be deserialized
|
32
|
+
# @return [Object] Deserialized data
|
33
|
+
def _deserialize(type, value)
|
34
|
+
case type.to_sym
|
35
|
+
when :DateTime
|
36
|
+
DateTime.parse(value)
|
37
|
+
when :Date
|
38
|
+
Date.parse(value)
|
39
|
+
when :String
|
40
|
+
value.to_s
|
41
|
+
when :Integer
|
42
|
+
value.to_i
|
43
|
+
when :Float
|
44
|
+
value.to_f
|
45
|
+
when :BOOLEAN
|
46
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
47
|
+
true
|
48
|
+
else
|
49
|
+
false
|
50
|
+
end
|
51
|
+
when :Object
|
52
|
+
# generic object (usually a Hash), return directly
|
53
|
+
value
|
54
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
55
|
+
inner_type = Regexp.last_match[:inner_type]
|
56
|
+
value.map { |v| _deserialize(inner_type, v) }
|
57
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
58
|
+
k_type = Regexp.last_match[:k_type]
|
59
|
+
v_type = Regexp.last_match[:v_type]
|
60
|
+
{}.tap do |hash|
|
61
|
+
value.each do |k, v|
|
62
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
else # model
|
66
|
+
temp_model = AgridClient.const_get(type).new
|
67
|
+
temp_model.build_from_hash(value)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# to_body is an alias to to_hash (backward compatibility)
|
72
|
+
# @return [Hash] Returns the object in the form of hash
|
73
|
+
def to_body
|
74
|
+
to_hash
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns the object in the form of hash
|
78
|
+
# @return [Hash] Returns the object in the form of hash
|
79
|
+
def to_hash
|
80
|
+
hash = {}
|
81
|
+
self.class.attribute_map.each_pair do |attr, param|
|
82
|
+
value = self.send(attr)
|
83
|
+
next if value.nil?
|
84
|
+
hash[param] = _to_hash(value)
|
85
|
+
end
|
86
|
+
hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# Outputs non-array value in the form of hash
|
90
|
+
# For object, use to_hash. Otherwise, just return the value
|
91
|
+
# @param [Object] value Any valid value
|
92
|
+
# @return [Hash] Returns the value in the form of hash
|
93
|
+
def _to_hash(value)
|
94
|
+
if value.is_a?(Array)
|
95
|
+
value.compact.map{ |v| _to_hash(v) }
|
96
|
+
elsif value.is_a?(Hash)
|
97
|
+
{}.tap do |hash|
|
98
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
99
|
+
end
|
100
|
+
elsif value.respond_to? :to_hash
|
101
|
+
value.to_hash
|
102
|
+
else
|
103
|
+
value
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,90 @@
|
|
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 Customer
|
18
|
+
include SwaggerModel
|
19
|
+
|
20
|
+
# Unique Id
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
# URL of customer's avatar image
|
24
|
+
attr_accessor :avatar
|
25
|
+
|
26
|
+
# Customer's name
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
# Email address
|
30
|
+
attr_accessor :email
|
31
|
+
|
32
|
+
# Phone number
|
33
|
+
attr_accessor :phone
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
:'id' => :'id',
|
39
|
+
:'avatar' => :'avatar',
|
40
|
+
:'name' => :'name',
|
41
|
+
:'email' => :'email',
|
42
|
+
:'phone' => :'phone'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.swagger_types
|
48
|
+
{
|
49
|
+
:'id' => :'String',
|
50
|
+
:'avatar' => :'String',
|
51
|
+
:'name' => :'String',
|
52
|
+
:'email' => :'String',
|
53
|
+
:'phone' => :'String'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
return unless attributes.is_a?(Hash)
|
61
|
+
|
62
|
+
# convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
64
|
+
|
65
|
+
if attributes[:'id']
|
66
|
+
self.id = attributes[:'id']
|
67
|
+
end
|
68
|
+
if attributes[:'avatar']
|
69
|
+
self.avatar = attributes[:'avatar']
|
70
|
+
end
|
71
|
+
if attributes[:'name']
|
72
|
+
self.name = attributes[:'name']
|
73
|
+
end
|
74
|
+
if attributes[:'email']
|
75
|
+
self.email = attributes[:'email']
|
76
|
+
end
|
77
|
+
if attributes[:'phone']
|
78
|
+
self.phone = attributes[:'phone']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
id == o.id
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|