Sha256: 52d754c570c3cde9489fd761a17fc840bde4665e658919795a93d91cb275832a

Contents?: true

Size: 1.81 KB

Versions: 4

Compression:

Stored size: 1.81 KB

Contents

# Examples

## Preamble

``` ruby
username = 'a_user@somewhere.com'
password = 'jghajg84j1mca'
account = 'http://access.auth.theplatform.com/data/Account/1'
```

## User Class

### Login

``` ruby
user = Cts::Mpx::User.create(username: ENV["MPX_USERNAME"], password: ENV["MPX_PASSWORD"]).sign_in
```

### Logout

``` ruby
user.sign_out
```

## Web.post

```ruby
response = Services::Web.post user: user, service: 'File Management Service', endpoint: 'FileManagement', method: 'resetTask', arguments: {"taskId": "http://..."}
puts response.status
```

## Ingest.post

## Rest Methods (Data endpoint)

### GET

``` ruby
response = Cts::Mpx::Services::Data.get user: user, service:  'Media Data Service', endpoint: 'Media', account: account, fields: 'id,guid'
puts response.page.entries
```

### POST

``` ruby
Cts::Mpx::Services::Data.post user: user, service:  'Media Data Service', endpoint: 'Media', account: account, page: Page.create(entries:[{"id": "http://data.media.theplatform.com/data/media/1"}])
```

### PUT

``` ruby
Cts::Mpx::Services::Data.put user: user, service:  'Media Data Service', endpoint: 'Media', account: account, page: Page.create(entries:[{}])
```

### DELETE

``` ruby
response = Cts::Mpx::Services::Data.delete user: user, service:  'Media Data Service', endpoint: 'Media', account: account, fields: 'id,guid', ids: "1,2,3,4"
puts response.page.entries
```

## Page class

### Create

``` ruby
page = Page.create(xmlns: {namespace: 'http://...'}, entries: [{}])
```

### output

``` ruby
puts page.to_s
```

### Indented Output

``` ruby
puts page.to_s(true)
```

## Query

``` ruby
media_query = Query.create({
  account_id:  "http://access.auth.theplatform.com/data/Account/2034777617",
  service:  'Media Data Service',
  endpoint: 'Media',
  fields:    'id,guid,title,ownerId'
}).run user: user

media_query.entries
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cts-mpx-1.2.0 EXAMPLES.md
cts-mpx-1.1.2 EXAMPLES.md
cts-mpx-1.1.1 EXAMPLES.md
cts-mpx-1.1.0 EXAMPLES.md