samplify_api_client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +221 -0
- data/Rakefile +8 -0
- data/docs/AppError.md +10 -0
- data/docs/ApplicationItemData.md +11 -0
- data/docs/AttributeData.md +16 -0
- data/docs/AttributeOption.md +10 -0
- data/docs/Attributes.md +10 -0
- data/docs/AttributesApi.md +78 -0
- data/docs/AuthApi.md +191 -0
- data/docs/AuthError.md +9 -0
- data/docs/Author.md +10 -0
- data/docs/BuyProject.md +10 -0
- data/docs/BuyProjectItem.md +12 -0
- data/docs/BuyProjectResponse.md +9 -0
- data/docs/BuyProjectsPayload.md +7 -0
- data/docs/Categories.md +10 -0
- data/docs/CategoriesApi.md +72 -0
- data/docs/CategoryData.md +9 -0
- data/docs/CodePayload.md +11 -0
- data/docs/Countries.md +10 -0
- data/docs/CountriesApi.md +72 -0
- data/docs/CountryData.md +11 -0
- data/docs/CreateLineItem.md +10 -0
- data/docs/DefaultApi.md +88 -0
- data/docs/EndLinks.md +13 -0
- data/docs/ErrorType.md +9 -0
- data/docs/Event.md +10 -0
- data/docs/EventData.md +15 -0
- data/docs/EventListData.md +15 -0
- data/docs/Events.md +10 -0
- data/docs/EventsApi.md +287 -0
- data/docs/ExclusionData.md +9 -0
- data/docs/Feasibility.md +10 -0
- data/docs/FeasibilityApi.md +61 -0
- data/docs/FeasibilityData.md +14 -0
- data/docs/FeasibilityResponseData.md +9 -0
- data/docs/LineItemActionResponse.md +14 -0
- data/docs/LineItemData.md +22 -0
- data/docs/LineItemItemData.md +17 -0
- data/docs/LineItemReportData.md +25 -0
- data/docs/LineItemResponseData.md +27 -0
- data/docs/LineItems.md +10 -0
- data/docs/LineItemsApi.md +420 -0
- data/docs/Links.md +12 -0
- data/docs/LogoutPayload.md +10 -0
- data/docs/Meta.md +10 -0
- data/docs/Project.md +14 -0
- data/docs/ProjectAction.md +10 -0
- data/docs/ProjectActionResponse.md +13 -0
- data/docs/ProjectCategoryData.md +8 -0
- data/docs/ProjectItemData.md +14 -0
- data/docs/ProjectReport.md +10 -0
- data/docs/ProjectReportData.md +21 -0
- data/docs/ProjectReports.md +10 -0
- data/docs/ProjectResponse.md +10 -0
- data/docs/ProjectResponseData.md +19 -0
- data/docs/ProjectSurveyEndLinks.md +10 -0
- data/docs/ProjectSurveyEndLinksData.md +12 -0
- data/docs/Projects.md +10 -0
- data/docs/ProjectsApi.md +620 -0
- data/docs/QuotaCell.md +10 -0
- data/docs/QuotaCellFeasibility.md +9 -0
- data/docs/QuotaGroupData.md +9 -0
- data/docs/QuotaGroupFeasibility.md +8 -0
- data/docs/QuotaPlanData.md +9 -0
- data/docs/Reconcile.md +10 -0
- data/docs/ReconcileData.md +7 -0
- data/docs/RefreshTokenPayload.md +10 -0
- data/docs/Reprice.md +10 -0
- data/docs/RepriceData.md +22 -0
- data/docs/RepricePayload.md +20 -0
- data/docs/RespondentApi.md +86 -0
- data/docs/Status.md +9 -0
- data/docs/SupportedLanguage.md +10 -0
- data/docs/SurveyEndLinks.md +10 -0
- data/docs/SurveyTestId.md +10 -0
- data/docs/SurveyTestLink.md +9 -0
- data/docs/Target.md +11 -0
- data/docs/TargetingAttribute.md +10 -0
- data/docs/TokenMedia.md +11 -0
- data/docs/TokenPayload.md +11 -0
- data/docs/URLParam.md +9 -0
- data/docs/UpdateLineItem.md +21 -0
- data/docs/UpdateProjectData.md +13 -0
- data/docs/UpdateProjectLineItem.md +22 -0
- data/docs/UserInfo.md +10 -0
- data/docs/UserInfoResponseData.md +10 -0
- data/docs/UsersApi.md +68 -0
- data/examples/auth.rb +18 -0
- data/git_push.sh +55 -0
- data/lib/samplify_api_client/api/attributes_api.rb +111 -0
- data/lib/samplify_api_client/api/auth_api.rb +230 -0
- data/lib/samplify_api_client/api/categories_api.rb +99 -0
- data/lib/samplify_api_client/api/countries_api.rb +99 -0
- data/lib/samplify_api_client/api/default_api.rb +115 -0
- data/lib/samplify_api_client/api/events_api.rb +317 -0
- data/lib/samplify_api_client/api/feasibility_api.rb +75 -0
- data/lib/samplify_api_client/api/line_items_api.rb +468 -0
- data/lib/samplify_api_client/api/projects_api.rb +660 -0
- data/lib/samplify_api_client/api/respondent_api.rb +113 -0
- data/lib/samplify_api_client/api/users_api.rb +81 -0
- data/lib/samplify_api_client/api_client.rb +389 -0
- data/lib/samplify_api_client/api_error.rb +38 -0
- data/lib/samplify_api_client/configuration.rb +209 -0
- data/lib/samplify_api_client/models/app_error.rb +218 -0
- data/lib/samplify_api_client/models/application_item_data.rb +234 -0
- data/lib/samplify_api_client/models/attribute_data.rb +334 -0
- data/lib/samplify_api_client/models/attribute_option.rb +219 -0
- data/lib/samplify_api_client/models/attributes.rb +219 -0
- data/lib/samplify_api_client/models/auth_error.rb +205 -0
- data/lib/samplify_api_client/models/author.rb +253 -0
- data/lib/samplify_api_client/models/buy_project.rb +219 -0
- data/lib/samplify_api_client/models/buy_project_item.rb +243 -0
- data/lib/samplify_api_client/models/buy_project_response.rb +194 -0
- data/lib/samplify_api_client/models/buy_projects_payload.rb +174 -0
- data/lib/samplify_api_client/models/categories.rb +219 -0
- data/lib/samplify_api_client/models/category_data.rb +204 -0
- data/lib/samplify_api_client/models/code_payload.rb +229 -0
- data/lib/samplify_api_client/models/countries.rb +219 -0
- data/lib/samplify_api_client/models/country_data.rb +230 -0
- data/lib/samplify_api_client/models/create_line_item.rb +217 -0
- data/lib/samplify_api_client/models/end_links.rb +288 -0
- data/lib/samplify_api_client/models/error_type.rb +204 -0
- data/lib/samplify_api_client/models/event.rb +217 -0
- data/lib/samplify_api_client/models/event_data.rb +289 -0
- data/lib/samplify_api_client/models/event_list_data.rb +289 -0
- data/lib/samplify_api_client/models/events.rb +219 -0
- data/lib/samplify_api_client/models/exclusion_data.rb +206 -0
- data/lib/samplify_api_client/models/feasibility.rb +219 -0
- data/lib/samplify_api_client/models/feasibility_data.rb +255 -0
- data/lib/samplify_api_client/models/feasibility_response_data.rb +193 -0
- data/lib/samplify_api_client/models/line_item_action_response.rb +244 -0
- data/lib/samplify_api_client/models/line_item_data.rb +398 -0
- data/lib/samplify_api_client/models/line_item_item_data.rb +358 -0
- data/lib/samplify_api_client/models/line_item_report_data.rb +478 -0
- data/lib/samplify_api_client/models/line_item_response_data.rb +408 -0
- data/lib/samplify_api_client/models/line_items.rb +219 -0
- data/lib/samplify_api_client/models/links.rb +219 -0
- data/lib/samplify_api_client/models/logout_payload.rb +219 -0
- data/lib/samplify_api_client/models/meta.rb +203 -0
- data/lib/samplify_api_client/models/project.rb +273 -0
- data/lib/samplify_api_client/models/project_action.rb +217 -0
- data/lib/samplify_api_client/models/project_action_response.rb +236 -0
- data/lib/samplify_api_client/models/project_category_data.rb +191 -0
- data/lib/samplify_api_client/models/project_item_data.rb +307 -0
- data/lib/samplify_api_client/models/project_report.rb +217 -0
- data/lib/samplify_api_client/models/project_report_data.rb +414 -0
- data/lib/samplify_api_client/models/project_reports.rb +219 -0
- data/lib/samplify_api_client/models/project_response.rb +217 -0
- data/lib/samplify_api_client/models/project_response_data.rb +347 -0
- data/lib/samplify_api_client/models/project_survey_end_links.rb +217 -0
- data/lib/samplify_api_client/models/project_survey_end_links_data.rb +272 -0
- data/lib/samplify_api_client/models/projects.rb +219 -0
- data/lib/samplify_api_client/models/quota_cell.rb +206 -0
- data/lib/samplify_api_client/models/quota_cell_feasibility.rb +204 -0
- data/lib/samplify_api_client/models/quota_group_data.rb +201 -0
- data/lib/samplify_api_client/models/quota_group_feasibility.rb +185 -0
- data/lib/samplify_api_client/models/quota_plan_data.rb +198 -0
- data/lib/samplify_api_client/models/reconcile.rb +217 -0
- data/lib/samplify_api_client/models/reconcile_data.rb +174 -0
- data/lib/samplify_api_client/models/refresh_token_payload.rb +214 -0
- data/lib/samplify_api_client/models/reprice.rb +217 -0
- data/lib/samplify_api_client/models/reprice_data.rb +399 -0
- data/lib/samplify_api_client/models/reprice_payload.rb +369 -0
- data/lib/samplify_api_client/models/status.rb +206 -0
- data/lib/samplify_api_client/models/supported_language.rb +219 -0
- data/lib/samplify_api_client/models/survey_end_links.rb +216 -0
- data/lib/samplify_api_client/models/survey_test_id.rb +219 -0
- data/lib/samplify_api_client/models/survey_test_link.rb +206 -0
- data/lib/samplify_api_client/models/target.rb +258 -0
- data/lib/samplify_api_client/models/targeting_attribute.rb +216 -0
- data/lib/samplify_api_client/models/token_media.rb +235 -0
- data/lib/samplify_api_client/models/token_payload.rb +229 -0
- data/lib/samplify_api_client/models/update_line_item.rb +353 -0
- data/lib/samplify_api_client/models/update_project_data.rb +238 -0
- data/lib/samplify_api_client/models/update_project_line_item.rb +368 -0
- data/lib/samplify_api_client/models/url_param.rb +204 -0
- data/lib/samplify_api_client/models/user_info.rb +217 -0
- data/lib/samplify_api_client/models/user_info_response_data.rb +221 -0
- data/lib/samplify_api_client/version.rb +15 -0
- data/lib/samplify_api_client.rb +125 -0
- data/samplify_api_client.gemspec +45 -0
- data/spec/api/attributes_api_spec.rb +53 -0
- data/spec/api/auth_api_spec.rb +79 -0
- data/spec/api/categories_api_spec.rb +51 -0
- data/spec/api/countries_api_spec.rb +51 -0
- data/spec/api/default_api_spec.rb +55 -0
- data/spec/api/events_api_spec.rb +100 -0
- data/spec/api/feasibility_api_spec.rb +46 -0
- data/spec/api/line_items_api_spec.rb +128 -0
- data/spec/api/projects_api_spec.rb +168 -0
- data/spec/api/respondent_api_spec.rb +55 -0
- data/spec/api/users_api_spec.rb +49 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/app_error_spec.rb +53 -0
- data/spec/models/application_item_data_spec.rb +59 -0
- data/spec/models/attribute_data_spec.rb +93 -0
- data/spec/models/attribute_option_spec.rb +53 -0
- data/spec/models/attributes_spec.rb +53 -0
- data/spec/models/auth_error_spec.rb +47 -0
- data/spec/models/author_spec.rb +57 -0
- data/spec/models/buy_project_item_spec.rb +65 -0
- data/spec/models/buy_project_response_spec.rb +47 -0
- data/spec/models/buy_project_spec.rb +53 -0
- data/spec/models/buy_projects_payload_spec.rb +35 -0
- data/spec/models/categories_spec.rb +53 -0
- data/spec/models/category_data_spec.rb +47 -0
- data/spec/models/code_payload_spec.rb +59 -0
- data/spec/models/countries_spec.rb +53 -0
- data/spec/models/country_data_spec.rb +59 -0
- data/spec/models/create_line_item_spec.rb +53 -0
- data/spec/models/end_links_spec.rb +75 -0
- data/spec/models/error_type_spec.rb +47 -0
- data/spec/models/event_data_spec.rb +83 -0
- data/spec/models/event_list_data_spec.rb +83 -0
- data/spec/models/event_spec.rb +53 -0
- data/spec/models/events_spec.rb +53 -0
- data/spec/models/exclusion_data_spec.rb +47 -0
- data/spec/models/feasibility_data_spec.rb +77 -0
- data/spec/models/feasibility_response_data_spec.rb +47 -0
- data/spec/models/feasibility_spec.rb +53 -0
- data/spec/models/line_item_action_response_spec.rb +77 -0
- data/spec/models/line_item_data_spec.rb +129 -0
- data/spec/models/line_item_item_data_spec.rb +99 -0
- data/spec/models/line_item_report_data_spec.rb +147 -0
- data/spec/models/line_item_response_data_spec.rb +159 -0
- data/spec/models/line_items_spec.rb +53 -0
- data/spec/models/links_spec.rb +65 -0
- data/spec/models/logout_payload_spec.rb +53 -0
- data/spec/models/meta_spec.rb +53 -0
- data/spec/models/project_action_response_spec.rb +71 -0
- data/spec/models/project_action_spec.rb +53 -0
- data/spec/models/project_category_data_spec.rb +41 -0
- data/spec/models/project_item_data_spec.rb +81 -0
- data/spec/models/project_report_data_spec.rb +123 -0
- data/spec/models/project_report_spec.rb +53 -0
- data/spec/models/project_reports_spec.rb +53 -0
- data/spec/models/project_response_data_spec.rb +107 -0
- data/spec/models/project_response_spec.rb +53 -0
- data/spec/models/project_spec.rb +77 -0
- data/spec/models/project_survey_end_links_data_spec.rb +69 -0
- data/spec/models/project_survey_end_links_spec.rb +53 -0
- data/spec/models/projects_spec.rb +53 -0
- data/spec/models/quota_cell_feasibility_spec.rb +47 -0
- data/spec/models/quota_cell_spec.rb +53 -0
- data/spec/models/quota_group_data_spec.rb +47 -0
- data/spec/models/quota_group_feasibility_spec.rb +41 -0
- data/spec/models/quota_plan_data_spec.rb +47 -0
- data/spec/models/reconcile_data_spec.rb +35 -0
- data/spec/models/reconcile_spec.rb +53 -0
- data/spec/models/refresh_token_payload_spec.rb +53 -0
- data/spec/models/reprice_data_spec.rb +125 -0
- data/spec/models/reprice_payload_spec.rb +113 -0
- data/spec/models/reprice_spec.rb +53 -0
- data/spec/models/status_spec.rb +47 -0
- data/spec/models/supported_language_spec.rb +53 -0
- data/spec/models/survey_end_links_spec.rb +53 -0
- data/spec/models/survey_test_id_spec.rb +53 -0
- data/spec/models/survey_test_link_spec.rb +47 -0
- data/spec/models/target_spec.rb +63 -0
- data/spec/models/targeting_attribute_spec.rb +53 -0
- data/spec/models/token_media_spec.rb +59 -0
- data/spec/models/token_payload_spec.rb +59 -0
- data/spec/models/update_line_item_spec.rb +123 -0
- data/spec/models/update_project_data_spec.rb +71 -0
- data/spec/models/update_project_line_item_spec.rb +129 -0
- data/spec/models/url_param_spec.rb +47 -0
- data/spec/models/user_info_response_data_spec.rb +53 -0
- data/spec/models/user_info_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- metadata +585 -0
@@ -0,0 +1,234 @@
|
|
1
|
+
=begin
|
2
|
+
#Samplify API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SamplifyAPIClient
|
16
|
+
class ApplicationItemData
|
17
|
+
# A unique identifier for your application
|
18
|
+
attr_accessor :app_id
|
19
|
+
|
20
|
+
# Is this the current application for the user
|
21
|
+
attr_accessor :current
|
22
|
+
|
23
|
+
# Is this the default application for the user
|
24
|
+
attr_accessor :default
|
25
|
+
|
26
|
+
# Application name
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'app_id' => :'appId',
|
33
|
+
:'current' => :'current',
|
34
|
+
:'default' => :'default',
|
35
|
+
:'name' => :'name'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'app_id' => :'Integer',
|
43
|
+
:'current' => :'BOOLEAN',
|
44
|
+
:'default' => :'BOOLEAN',
|
45
|
+
:'name' => :'String'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
return unless attributes.is_a?(Hash)
|
53
|
+
|
54
|
+
# convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
56
|
+
|
57
|
+
if attributes.has_key?(:'appId')
|
58
|
+
self.app_id = attributes[:'appId']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'current')
|
62
|
+
self.current = attributes[:'current']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'default')
|
66
|
+
self.default = attributes[:'default']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'name')
|
70
|
+
self.name = attributes[:'name']
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
+
# @return Array for valid properties with the reasons
|
76
|
+
def list_invalid_properties
|
77
|
+
invalid_properties = Array.new
|
78
|
+
if @app_id.nil?
|
79
|
+
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
80
|
+
end
|
81
|
+
|
82
|
+
if @current.nil?
|
83
|
+
invalid_properties.push('invalid value for "current", current cannot be nil.')
|
84
|
+
end
|
85
|
+
|
86
|
+
if @default.nil?
|
87
|
+
invalid_properties.push('invalid value for "default", default cannot be nil.')
|
88
|
+
end
|
89
|
+
|
90
|
+
if @name.nil?
|
91
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
92
|
+
end
|
93
|
+
|
94
|
+
invalid_properties
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check to see if the all the properties in the model are valid
|
98
|
+
# @return true if the model is valid
|
99
|
+
def valid?
|
100
|
+
return false if @app_id.nil?
|
101
|
+
return false if @current.nil?
|
102
|
+
return false if @default.nil?
|
103
|
+
return false if @name.nil?
|
104
|
+
true
|
105
|
+
end
|
106
|
+
|
107
|
+
# Checks equality by comparing each attribute.
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def ==(o)
|
110
|
+
return true if self.equal?(o)
|
111
|
+
self.class == o.class &&
|
112
|
+
app_id == o.app_id &&
|
113
|
+
current == o.current &&
|
114
|
+
default == o.default &&
|
115
|
+
name == o.name
|
116
|
+
end
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] Object to be compared
|
120
|
+
def eql?(o)
|
121
|
+
self == o
|
122
|
+
end
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Fixnum] Hash code
|
126
|
+
def hash
|
127
|
+
[app_id, current, default, name].hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# Builds the object from hash
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
132
|
+
# @return [Object] Returns the model itself
|
133
|
+
def build_from_hash(attributes)
|
134
|
+
return nil unless attributes.is_a?(Hash)
|
135
|
+
self.class.swagger_types.each_pair do |key, type|
|
136
|
+
if type =~ /\AArray<(.*)>/i
|
137
|
+
# check to ensure the input is an array given that the the attribute
|
138
|
+
# is documented as an array but the input is not
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
141
|
+
end
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
144
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :DateTime
|
157
|
+
DateTime.parse(value)
|
158
|
+
when :Date
|
159
|
+
Date.parse(value)
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :BOOLEAN
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else # model
|
187
|
+
temp_model = SamplifyAPIClient.const_get(type).new
|
188
|
+
temp_model.build_from_hash(value)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the string representation of the object
|
193
|
+
# @return [String] String presentation of the object
|
194
|
+
def to_s
|
195
|
+
to_hash.to_s
|
196
|
+
end
|
197
|
+
|
198
|
+
# to_body is an alias to to_hash (backward compatibility)
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_body
|
201
|
+
to_hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the object in the form of hash
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_hash
|
207
|
+
hash = {}
|
208
|
+
self.class.attribute_map.each_pair do |attr, param|
|
209
|
+
value = self.send(attr)
|
210
|
+
next if value.nil?
|
211
|
+
hash[param] = _to_hash(value)
|
212
|
+
end
|
213
|
+
hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Outputs non-array value in the form of hash
|
217
|
+
# For object, use to_hash. Otherwise, just return the value
|
218
|
+
# @param [Object] value Any valid value
|
219
|
+
# @return [Hash] Returns the value in the form of hash
|
220
|
+
def _to_hash(value)
|
221
|
+
if value.is_a?(Array)
|
222
|
+
value.compact.map { |v| _to_hash(v) }
|
223
|
+
elsif value.is_a?(Hash)
|
224
|
+
{}.tap do |hash|
|
225
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
226
|
+
end
|
227
|
+
elsif value.respond_to? :to_hash
|
228
|
+
value.to_hash
|
229
|
+
else
|
230
|
+
value
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -0,0 +1,334 @@
|
|
1
|
+
=begin
|
2
|
+
#Samplify API
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SamplifyAPIClient
|
16
|
+
class AttributeData
|
17
|
+
# Regex for validation
|
18
|
+
attr_accessor :format
|
19
|
+
|
20
|
+
# Unique attribute ID
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
# Is allowed in filters
|
24
|
+
attr_accessor :is_allowed_in_filters
|
25
|
+
|
26
|
+
# Is allowed in quotas
|
27
|
+
attr_accessor :is_allowed_in_quotas
|
28
|
+
|
29
|
+
# Localized attribute text
|
30
|
+
attr_accessor :localized_text
|
31
|
+
|
32
|
+
# Attribute name
|
33
|
+
attr_accessor :name
|
34
|
+
|
35
|
+
attr_accessor :options
|
36
|
+
|
37
|
+
# Attribute text
|
38
|
+
attr_accessor :text
|
39
|
+
|
40
|
+
# Attribute type
|
41
|
+
attr_accessor :type
|
42
|
+
|
43
|
+
class EnumAttributeValidator
|
44
|
+
attr_reader :datatype
|
45
|
+
attr_reader :allowable_values
|
46
|
+
|
47
|
+
def initialize(datatype, allowable_values)
|
48
|
+
@allowable_values = allowable_values.map do |value|
|
49
|
+
case datatype.to_s
|
50
|
+
when /Integer/i
|
51
|
+
value.to_i
|
52
|
+
when /Float/i
|
53
|
+
value.to_f
|
54
|
+
else
|
55
|
+
value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def valid?(value)
|
61
|
+
!value || allowable_values.include?(value)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
66
|
+
def self.attribute_map
|
67
|
+
{
|
68
|
+
:'format' => :'format',
|
69
|
+
:'id' => :'id',
|
70
|
+
:'is_allowed_in_filters' => :'isAllowedInFilters',
|
71
|
+
:'is_allowed_in_quotas' => :'isAllowedInQuotas',
|
72
|
+
:'localized_text' => :'localizedText',
|
73
|
+
:'name' => :'name',
|
74
|
+
:'options' => :'options',
|
75
|
+
:'text' => :'text',
|
76
|
+
:'type' => :'type'
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute type mapping.
|
81
|
+
def self.swagger_types
|
82
|
+
{
|
83
|
+
:'format' => :'String',
|
84
|
+
:'id' => :'String',
|
85
|
+
:'is_allowed_in_filters' => :'BOOLEAN',
|
86
|
+
:'is_allowed_in_quotas' => :'BOOLEAN',
|
87
|
+
:'localized_text' => :'String',
|
88
|
+
:'name' => :'String',
|
89
|
+
:'options' => :'Array<AttributeOption>',
|
90
|
+
:'text' => :'String',
|
91
|
+
:'type' => :'String'
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
return unless attributes.is_a?(Hash)
|
99
|
+
|
100
|
+
# convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
102
|
+
|
103
|
+
if attributes.has_key?(:'format')
|
104
|
+
self.format = attributes[:'format']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'id')
|
108
|
+
self.id = attributes[:'id']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'isAllowedInFilters')
|
112
|
+
self.is_allowed_in_filters = attributes[:'isAllowedInFilters']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'isAllowedInQuotas')
|
116
|
+
self.is_allowed_in_quotas = attributes[:'isAllowedInQuotas']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'localizedText')
|
120
|
+
self.localized_text = attributes[:'localizedText']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'name')
|
124
|
+
self.name = attributes[:'name']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'options')
|
128
|
+
if (value = attributes[:'options']).is_a?(Array)
|
129
|
+
self.options = value
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'text')
|
134
|
+
self.text = attributes[:'text']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'type')
|
138
|
+
self.type = attributes[:'type']
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
143
|
+
# @return Array for valid properties with the reasons
|
144
|
+
def list_invalid_properties
|
145
|
+
invalid_properties = Array.new
|
146
|
+
if @id.nil?
|
147
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @is_allowed_in_filters.nil?
|
151
|
+
invalid_properties.push('invalid value for "is_allowed_in_filters", is_allowed_in_filters cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @is_allowed_in_quotas.nil?
|
155
|
+
invalid_properties.push('invalid value for "is_allowed_in_quotas", is_allowed_in_quotas cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @localized_text.nil?
|
159
|
+
invalid_properties.push('invalid value for "localized_text", localized_text cannot be nil.')
|
160
|
+
end
|
161
|
+
|
162
|
+
if @name.nil?
|
163
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if @text.nil?
|
167
|
+
invalid_properties.push('invalid value for "text", text cannot be nil.')
|
168
|
+
end
|
169
|
+
|
170
|
+
if @type.nil?
|
171
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
172
|
+
end
|
173
|
+
|
174
|
+
invalid_properties
|
175
|
+
end
|
176
|
+
|
177
|
+
# Check to see if the all the properties in the model are valid
|
178
|
+
# @return true if the model is valid
|
179
|
+
def valid?
|
180
|
+
return false if @id.nil?
|
181
|
+
return false if @is_allowed_in_filters.nil?
|
182
|
+
return false if @is_allowed_in_quotas.nil?
|
183
|
+
return false if @localized_text.nil?
|
184
|
+
return false if @name.nil?
|
185
|
+
return false if @text.nil?
|
186
|
+
return false if @type.nil?
|
187
|
+
type_validator = EnumAttributeValidator.new('String', ['LIST', 'INTEGER', 'STRING', 'INTEGER_RANGE'])
|
188
|
+
return false unless type_validator.valid?(@type)
|
189
|
+
true
|
190
|
+
end
|
191
|
+
|
192
|
+
# Custom attribute writer method checking allowed values (enum).
|
193
|
+
# @param [Object] type Object to be assigned
|
194
|
+
def type=(type)
|
195
|
+
validator = EnumAttributeValidator.new('String', ['LIST', 'INTEGER', 'STRING', 'INTEGER_RANGE'])
|
196
|
+
unless validator.valid?(type)
|
197
|
+
fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
|
198
|
+
end
|
199
|
+
@type = type
|
200
|
+
end
|
201
|
+
|
202
|
+
# Checks equality by comparing each attribute.
|
203
|
+
# @param [Object] Object to be compared
|
204
|
+
def ==(o)
|
205
|
+
return true if self.equal?(o)
|
206
|
+
self.class == o.class &&
|
207
|
+
format == o.format &&
|
208
|
+
id == o.id &&
|
209
|
+
is_allowed_in_filters == o.is_allowed_in_filters &&
|
210
|
+
is_allowed_in_quotas == o.is_allowed_in_quotas &&
|
211
|
+
localized_text == o.localized_text &&
|
212
|
+
name == o.name &&
|
213
|
+
options == o.options &&
|
214
|
+
text == o.text &&
|
215
|
+
type == o.type
|
216
|
+
end
|
217
|
+
|
218
|
+
# @see the `==` method
|
219
|
+
# @param [Object] Object to be compared
|
220
|
+
def eql?(o)
|
221
|
+
self == o
|
222
|
+
end
|
223
|
+
|
224
|
+
# Calculates hash code according to all attributes.
|
225
|
+
# @return [Fixnum] Hash code
|
226
|
+
def hash
|
227
|
+
[format, id, is_allowed_in_filters, is_allowed_in_quotas, localized_text, name, options, text, type].hash
|
228
|
+
end
|
229
|
+
|
230
|
+
# Builds the object from hash
|
231
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
232
|
+
# @return [Object] Returns the model itself
|
233
|
+
def build_from_hash(attributes)
|
234
|
+
return nil unless attributes.is_a?(Hash)
|
235
|
+
self.class.swagger_types.each_pair do |key, type|
|
236
|
+
if type =~ /\AArray<(.*)>/i
|
237
|
+
# check to ensure the input is an array given that the the attribute
|
238
|
+
# is documented as an array but the input is not
|
239
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
240
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
241
|
+
end
|
242
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
243
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
244
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
245
|
+
end
|
246
|
+
|
247
|
+
self
|
248
|
+
end
|
249
|
+
|
250
|
+
# Deserializes the data based on type
|
251
|
+
# @param string type Data type
|
252
|
+
# @param string value Value to be deserialized
|
253
|
+
# @return [Object] Deserialized data
|
254
|
+
def _deserialize(type, value)
|
255
|
+
case type.to_sym
|
256
|
+
when :DateTime
|
257
|
+
DateTime.parse(value)
|
258
|
+
when :Date
|
259
|
+
Date.parse(value)
|
260
|
+
when :String
|
261
|
+
value.to_s
|
262
|
+
when :Integer
|
263
|
+
value.to_i
|
264
|
+
when :Float
|
265
|
+
value.to_f
|
266
|
+
when :BOOLEAN
|
267
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
268
|
+
true
|
269
|
+
else
|
270
|
+
false
|
271
|
+
end
|
272
|
+
when :Object
|
273
|
+
# generic object (usually a Hash), return directly
|
274
|
+
value
|
275
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
276
|
+
inner_type = Regexp.last_match[:inner_type]
|
277
|
+
value.map { |v| _deserialize(inner_type, v) }
|
278
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
279
|
+
k_type = Regexp.last_match[:k_type]
|
280
|
+
v_type = Regexp.last_match[:v_type]
|
281
|
+
{}.tap do |hash|
|
282
|
+
value.each do |k, v|
|
283
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
else # model
|
287
|
+
temp_model = SamplifyAPIClient.const_get(type).new
|
288
|
+
temp_model.build_from_hash(value)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
# Returns the string representation of the object
|
293
|
+
# @return [String] String presentation of the object
|
294
|
+
def to_s
|
295
|
+
to_hash.to_s
|
296
|
+
end
|
297
|
+
|
298
|
+
# to_body is an alias to to_hash (backward compatibility)
|
299
|
+
# @return [Hash] Returns the object in the form of hash
|
300
|
+
def to_body
|
301
|
+
to_hash
|
302
|
+
end
|
303
|
+
|
304
|
+
# Returns the object in the form of hash
|
305
|
+
# @return [Hash] Returns the object in the form of hash
|
306
|
+
def to_hash
|
307
|
+
hash = {}
|
308
|
+
self.class.attribute_map.each_pair do |attr, param|
|
309
|
+
value = self.send(attr)
|
310
|
+
next if value.nil?
|
311
|
+
hash[param] = _to_hash(value)
|
312
|
+
end
|
313
|
+
hash
|
314
|
+
end
|
315
|
+
|
316
|
+
# Outputs non-array value in the form of hash
|
317
|
+
# For object, use to_hash. Otherwise, just return the value
|
318
|
+
# @param [Object] value Any valid value
|
319
|
+
# @return [Hash] Returns the value in the form of hash
|
320
|
+
def _to_hash(value)
|
321
|
+
if value.is_a?(Array)
|
322
|
+
value.compact.map { |v| _to_hash(v) }
|
323
|
+
elsif value.is_a?(Hash)
|
324
|
+
{}.tap do |hash|
|
325
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
326
|
+
end
|
327
|
+
elsif value.respond_to? :to_hash
|
328
|
+
value.to_hash
|
329
|
+
else
|
330
|
+
value
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|