zendesk / sunshine-conversations-ruby

Smooch API Library for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArgumentError: invalid value for 'platform', must be one of ["ios", "android", "web", "other"].

angelacode opened this issue · comments

I am using the AppUser Update:

https://github.com/smooch/smooch-ruby/blob/master/docs/AppUserUpdate.md

It doesn't require platform nor explain how to add it, but I keep getting this error above, using code same as the documentation and it breaks:

api_instance = SmoochApi::AppUserApi.new
app_user_update_body = SmoochApi::AppUserUpdate.new
app_user_update_body.properties = json
result = api_instance.update_app_user(user_id, app_user_update_body)
ArgumentError: invalid value for 'platform', must be one of ["ios", "android", "web", "other"].

ArgumentError: invalid value for 'platform', must be one of ["ios", "android", "web", "other"].

result = api_instance.update_app_user(user_id, app_user_update_body)
ArgumentError: invalid value for 'platform', must be one of ["ios", "android", "web", "other"].
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/client.rb:154:in `platform='
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/client.rb:198:in `block in build_from_hash'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/client.rb:190:in `each_pair'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/client.rb:190:in `build_from_hash'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/app_user.rb:260:in `_deserialize'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/app_user.rb:212:in `block (2 levels) in build_from_hash'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/app_user.rb:212:in `map'
	from /usr/local/rvm/gems/ruby-2.2.1/gems/smooch-api-1.4.0/lib/smooch-api/models/app_user.rb:212:in `block in build_from_hash'

The payload being sent contains the platform. I have a feeling it's rejecting "messenger":

Let me see if updating the gem helps:

[]("clients": [
{
"lastSeen": "2017-06-10T23:12:57.201Z",
"id": "8ffb7xxxxxxxxxxx248-dcd7-xxxxx-b6d0-xxxxx",
"platform": "messenger",
"avatarUrl": "https://scontent.xx.fbcdn.net/v/t31.0-1/p720x7xxxxxxxxx55_o.jpg?oh=5222658e2b8648a374d05e40165331e6&oe=59A1C28B",
"displayName": "xxxxx",
"info": {
"avatarUrl": "https://scontent.xx.fbcdn.net/v/t31.0-1/p720xxxxxxx367501106153455_o.jpg?oh=5222658e2b8648a374d05e40165331e6&oe=59A1C28B",
"locale": "en_US",
"timezone": -7,
"gender": "male",
"isPaymentEnabled": true
},
"active": true,
"primary": true
}
],)