Coder Social home page Coder Social logo

layer-api's People

Contributors

cakejelly avatar daninfpj avatar mjurin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

layer-api's Issues

please update the dependencies

This gem is incompatible with other gems which require higher version of faraday.
Request you to please update the dependencies to its latest versions.

thanks.

invalid_app_id

Tested the same App Id on layer-ruby gem and it works but somehow it doesn't work with this gem.

Layer::Error: Layer responded with status 403: {"id":"invalid_app_id","code":2,"message":"The referenced App ID is invalid.

Layer identity not working

Hi,

I am using the layer-api gem to load / create conversations on layer. I was trying to update the users identity using the indications from the readme, but as soon as I tried to call the create_identity method on a retrieved user, I received an error saying:

NoMethodError: undefined method `create_identity' for #<Layer::Resources::User:0xcd73618>

Any ideea why is that happening?
I was testing it very simple:

identity = {
  display_name: "Frodo the Dodo",
  avatar_url: "http://sillylordoftheringspictures.com/frodo-riding-a-dodo.png",
  first_name: "Frodo",
  last_name: "Baggins",
  phone_number: "13791379137",
  email_address: "[email protected]",
  metadata: {
    level: "35",
    race: "Dodo"
  }
}
user = @platform.users.find("user_id")
user.create_identity(identity)

The gem version I am using is 0.6.1

bundle show | grep layer
  * layer-api (0.6.1)

Unable to update identity

Here is my code:

def update_layer_identity(user)
    operations = [
      {operation: "set", property: "display_name", value: "Hello Friend"}
    ]
    layer_user = layer_client.users.find(user.uuid)
    layer_user.update(operations)
end

And I get the following error:

Layer responded with status 422: {"url":"https://developer.layer.com/docs/platform","data":{"property":"display_name"},"code":9,"id":"invalid_operation","message":"Patch operation \"set\" on \"display_name\" is not allowed."}

Same thing happens when I try to update first_name, last_name and phone_number. I'm able to PATCH successfully using curl, so it must be an issue with this Library?

Sorting conversations

You should be able to sort the conversations, as such:

conversations = user.conversations.list(sort_by: 'last_message')

However, because of the way the list method was written, that doesn't work. Instead of adding the params to the query parameters, it sends a JSON encoded string as the body of the request, which doesn't make sense for a GET request.

TypeError: no implicit conversion of nil into String

Hi,

when calling the function to_s on a identity_token I get TypeError: no implicit conversion of nil into String, because there are no substitutions when key.gsub!("\n","\n") is called and a nil is returned instead.

Any special reason why you dont use just gsub ?

best regards,
Marko

Get last message with conversation

Hi,

another question. I was looking over the layer documentation and I cant find a way to get a list of conversations for a user and inside the conversation also the last message (with a single call).

Right now I am calling the message list for each conversation and it will be become slow in the future with a lot of conversations.

thx

'If-None-Match' header causes the API to reject consecutive calls

There's a problem with the way you're handling the 'If-None-Match' header. The token is created when you instantiate the platform object. So if you use that instance to say create two messages, layer will reject the second one:

conv = platform.conversations.find("conversation_id")
conv.messages.create(message)
conv.messages.create(another_message)

another_message will get rejected and the message won't be send since the API already saw that token and will interpret it as a duplicate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.