Sha256: 49f56f7f638472f554402c4ae7e20d59e383031b81ec5da60441433248fc138a

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

class Ey::Core::Client
  class Real
    def get_addon_attachments(params={})
      if account_id = params["account_id"]
        params["url"] = "/accounts/#{account_id}/attachments"
      end
      url = params.delete("url") or raise "URL needed"
      request(
        :params => params,
        :path   => url,
        :url    => url,
      )
    end
  end # Real

  class Mock
    def get_addon_attachments(params={})
      if account_id = params.delete("account_id")
        params["url"] = "/accounts/#{account_id}/attachments"
      end

      extract_url_params!(params)

      account = find(:accounts, params["account"])
      addon = find(:addons, params["addon"]) rescue nil

      found_attachments = load_addon_attachments(account["id"], addon && addon["name"])

      if addon
        found_attachments.select! {|a| a["key"] }
      end

      response(
        :body    => {"addon_attachments" => found_attachments},
        :status  => 201,
        :headers => {
          "Content-Type" => "application/json; charset=utf8"
        }
      )
    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/get_addon_attachments.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/requests/get_addon_attachments.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/requests/get_addon_attachments.rb