Sha256: 9f437e0ad7b1084fd5d5a1e3a885bf2d1625bbd3a3380ff6f58ec06e5dca9721

Contents?: true

Size: 927 Bytes

Versions: 15

Compression:

Stored size: 927 Bytes

Contents

class Ey::Core::Client
  class Real
    def create_membership(params={})
      query_params = {"membership" => params["membership"]}
      body = query_params.to_json

      request(
        :method => :post,
        :path   => "/memberships",
        :body => body
      )
    end
  end # Real

  class Mock
    def create_membership(params={})
      id = self.uuid
      membership = {
        "id"      => id,
        "account" => url_for("/accounts/"+params["membership"]["account"]),
        "user"    => url_for("/users/"+params["membership"]["user"]),
        "role"    => params["membership"]["role"],
        #NOTE missing attributes: email, created_at, updated_at, deleted_at, requester_url
        #also "implied" attribute: accepted = false
      }
      self.data[:memberships][id] = membership
      response(
        :body => {"membership" => membership},
        :status => 201
      )
    end
  end # Mock
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/requests/create_membership.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/requests/create_membership.rb