Git Product home page Git Product logo

faunadb-ruby's People

Contributors

andy-faunadb avatar ashfire908 avatar bakineggs avatar benjaminjackson avatar benmanns avatar bitbckt avatar eaceaser avatar erickpintor avatar evan avatar freels avatar guilleiguaran avatar kamal avatar marrony avatar n400 avatar sprsquish avatar subhash avatar tmilewski avatar wam avatar

Stargazers

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

Watchers

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

faunadb-ruby's Issues

Importing module methods should be possible

It should be easy to bring Query methods into scope in order to eliminate the need to namespace them.

For instance, I'd like to be able to do this:

class Foo
  include Fauna::Query
  def createDB(dbName)
    create(Ref.new('databases'), quote(name: dbName))
  end
end

That's not possible without some hackery because the query methods are all module methods.

Implement `constraint` helper

Similar to field, now that we have generalized constraints.

However, perhaps we should rethink how the gem exposes access to deeply nested fields. It doesn't correspond to the regular Rails/relational way very well.

Also applies to references I suppose.

Consider making Client params accessible later on

If someone puts values like secret and observer into the client, it might be convenient to have them gettable later. They are accessible in python but not documented. Should we make it official?

README updates

  • Show how to connect to a local faunadb
  • Add a GET example
  • Explain indexes a bit. Show how to create one before paginating.

Query interface is incomplete

I don't think the query interface is fully fleshed out.

It might make more sense to exclusively support string interpolation rather than expect reified nested objects. Whatever is easier for the user to understand.

Handle invalid responses

def test_invalid_response
  # Response must be valid JSON
  assert_raises ??? do
    (stub_get 200, 'I like fine wine').get ''
  end
  # Response must have "resource"
  assert_raises ??? do
    (stub_get 200, '{"resoars": 1}').get ''
  end
end

Pagination helper flattens TOO much

When you are paginating over a set that contains arrays, the pagination helper flattens those arrays too, so it ends up emitting [a1, b1, a2, b2,....] as opposed to [[a1, b1], [a2, b2], ....]

Simplify and remove magic

Degree of magic in the client does not inspire confidence. I think we can do better, in particular around the DDL manipulation and default fields in built-in records.

Rake task 'fauna:dump' broken

The first issue is in line 37 of 'fauna.rake'

class_name = ref[0..-8]

If you have a class ref like "classes/thisisatest", the the class_name will be "classes/this". Ought to be

class_name = [8..-1]

If the ref is long enough, when Dir.chdir(class_name) is called on line 40, an additional 'classes' directory also is created.

Also, the Fauna.connection.get(class_name) on line 43 ought to be changed to Fauna.connection.get(ref).

Clean up rubocop config

It's overly opinionated. Disable everything by default and only enable linters we find useful.

`index.html` links result in content-less pages

  • Run bundle exec rake rdoc.
  • Visit doc/index.html.
  • Click on #add to go to doc/Fauna/Query.html#method-i-add.
  • The page will just consist of headers: "Basic forms", "public instance methods", "Collections", "public instance methods", "Miscellaneous functions", "public instance methods", etc.

client should allow creation of a new context to switch keys.

Since FaunaDB API access relies on keys to switch perspectives, it should be easy to temporarily do so with a client. For example:

client = Fauna::Client.new(secret: SERVER_KEY)

user_token = client.query do
  login ref('users/123'), password: 'sekrit'
end

user_client = client.with_secret(user_token[:secret])
user_client.query do
  paginate match(ref('indexes/items_by_user'), ref('users/self'))
end

New Resource objects share attribute instances

When creating multiple new resources using Fauna::Resource.new(), the resulting Resource objects share the following attributes' instances between them:

  • constraints
  • data
  • references

Since they are the same instance, edits to one of the attributes will result in the change being applied to all resources created with Fauna::Resource.new().

For example, in the following code:

settings = Fauna::Resource.new('settings', :ref => 'settings/12345678', :email => '[email protected]')
user = Fauna::Resource.new('users', :ref => 'users/87654321')

settings.data['test'] = true

The following statements will all return true:

user.data['test'] == true
user.constraints.object_id == settings.constraints.object_id
user.data.object_id == settings.data.object_id
user.references.object_id == settings.references.object_id

Namespace for errors is confusing

Fauna::Connection::NotFound makes it seem like it's a connection issue, rather than a 404 response.

Fauna::NotFound or Fauna::Resource::NotFound would be better.

Allowing a publisher key to be specified in the rails helper

It looks like a new publisher key is generated on each boot of a rails app. I've added a publisher_key setting to fauna.yml that can be used in lieu of the email/password credentials. Changes here: https://github.com/wam/fauna-ruby/compare/allow-publisher-key

Makes sense? If so I can open a pull request.

Possible issue: When using a publisher key, no root connection is established in the rails helper. Not sure if it's intended to be used elsewhere.

Expose validTime and versions

We need to let you set the valid time on a finder, as well as add CRUD for manipulating individual versions of resources.

gemspec contains reference to Evan's cloudburst private key

In 1.3.1, the gemspec has two hardcoded references to Evan's filesystem:

s.cert_chain = ["/Users/eweaver/fauna/fauna-ruby/fauna-ruby.pem"]
...
s.signing_key = "/Users/eweaver/cloudburst/configuration/gem_certificates/gem-private_key.pem"

https://github.com/fauna/fauna-ruby/blob/master/fauna.gemspec#L10
https://github.com/fauna/fauna-ruby/blob/master/fauna.gemspec#L22

Bundler is complaining about it:

Errno::ENOENT: No such file or directory - /Users/eweaver/cloudburst/configuration/gem_certificates/gem-private_key.pem
An error occurred while installing fauna (1.3.1), and Bundler cannot continue.
Make sure that `gem install fauna -v '1.3.1'` succeeds before bundling.

Is there a workaround?

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.