ramco 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd44c1cc33aeb833b2361b21eb6e2dcbdd2b852bd8c46993ef272276b0964660
4
- data.tar.gz: 7d00666754d90a2b54e3c71de2c84649183b5421cea6bbd05f17c0e15ebdafc2
3
+ metadata.gz: 19c06fea9ff8d546df10661c4b2fc6588e51550a3fdb9888afd39c249e843d08
4
+ data.tar.gz: f32656e7d50a26edce2220d90eaf2da8b83820f2aae46a938d28fa3cacbfc197
5
5
  SHA512:
6
- metadata.gz: 4303addff9362c7b601ae3eaec6833a325728dbb1e760a8a4c1f8477caa9fbe8e6ab7507629bf59b5e5f6f7da472ece142a30a380f96e9e5f2eb8e4972d245d8
7
- data.tar.gz: eb4c0537d6cb73dad7988532cd6f2a2a9878f280ffed03fd0c2f70e23ca2cd1e0dc40d3ddfc3ef75c0b7b13b5539d16ff82ec357bed7e493380dd0dcff580bc2
6
+ metadata.gz: a308af1be3e0bd9af4aa1884c1177444896f1e499e2e4ad52be25dbb67ed078f6f1c8d1f09fec7533b8a10306bdcda7a3235a571892a993242a55dd36794d517
7
+ data.tar.gz: 9b7627c785284a998350603165ea168fb7a92230cdecf77653f3f289a241b67e120e3ba46d9f9b90539cfd8b19112d1377bb53b6c12945903d0d4213914bd0fe
data/README.md CHANGED
@@ -80,6 +80,55 @@ Returns the globally unique id of a contact that matches the provided cobalt_use
80
80
  * cobalt_username = User’s username
81
81
  * cobalt_password = User’s password
82
82
 
83
+ ## UpdateEntity
84
+
85
+ Allows for modification of attributes of existing Entities.
86
+
87
+ ramco.update_entity({"entity" => "Contact", "guid" => "6868642f-0144-e811-9c17-00155d10120d", "attribute_values" => "FirstName=#Jane#,Birthday=1980-12-31,EmailVerified=true,NumChildren=3"})
88
+
89
+ * Post params:
90
+ * Entity = Type of entity being modified (ex: Contact)
91
+ * Guid = guid of entity being modified
92
+ * AttributeValues = Comma separated attribute=value pairs.
93
+ * StringDelimiter (optional) = User-specified delimiter used to wrap string values (default is #)
94
+
95
+ ### The AttributeValue parameter syntax
96
+
97
+ A comma delimited list of attribute value pairs like:
98
+
99
+ FirstName=#Joe#,Birthday=1980-12-31,EmailVerified=true,NumChildren=3
100
+
101
+ Strings must be wrapped with a delimiter. The default delimiter is ‘#’ but a user-specified delimiter can be utilized by including the optional StringDelimiter param.
102
+
103
+ OptionSets must be set to a numeric value valid for that optionset, or zero to clear current existing value. To determine values that are valid for an optionset, use the GetOptionSet api call.
104
+ Note that when updating an attribute of type EntityReferene, usually only the guid needs to be specified. In cases where the EntityReference can be of more than one type (ex: OwnerId can be SystemUser or Team) the value must be type:guid (SystemUser:fb50333e-6b9f-e111-8d5d- 00155d000140).
105
+
106
+ In instances where the string delimiter occurs in the string itself (ex: ‘Some#Text’), the delimiter must be Base64Encoded (ex: ‘SomeIw==Text’). Of course the option to change the delimiter using the StringDelimiter parameter exists as well.
107
+
108
+
109
+ ## CreateEntity
110
+
111
+ Allows for creation of a new entity record.
112
+
113
+ ramco.create_entity({"entity" => "Contact", "attribute_values" => "FirstName=#Jane#,Birthday=1980-12-31,EmailVerified=true,NumChildren=3"})
114
+
115
+ * Post params:
116
+ * Entity = Type of entity being modified (ex: Contact)
117
+ * AttributeValues = Comma separated attribute=value pairs.
118
+ * StringDelimiter (optional) = User-specified delimiter used to wrap string values (default is #)
119
+
120
+ ### The AttributeValue parameter syntax
121
+
122
+ The AttributeValue parameter for CreateEntity follows the same format as that for UpdateEntity.
123
+
124
+ ### PrimaryIdAttribute
125
+
126
+ Every entity type has a PrimaryIdAttribute which can be determined with a GetEntityMetadata call. If a specific guid is desired for the entity being created, it can be added to the AttributeValues parameter along with the other specified values. If the PrimaryIdAttribute is not specified, one will be automatically generated.
127
+
128
+ Example creating a Contact record (ContactId is PrimaryIdAttribute):
129
+
130
+ FirstName=#John#,LastName=#Doe#,ContactId= 84a4d17f-2e48-4a4b-bb28-26f7c14fc926, Birthday=1980-12-31
131
+
83
132
  ## ClearCache
84
133
 
85
134
  Clears the server-side metadata cache. If an entity or attribute has been added (or removed), then clearing the cache will permit the changes to be reflected immediately. The cache will normally expire every 24 hours.
@@ -17,6 +17,39 @@ class Ramco
17
17
  params['operation'] = "GetEntity"
18
18
  request(connection, params)
19
19
  end
20
+
21
+ # CreateEntity
22
+ # Allows for creation of a new entity record.
23
+ #
24
+ # Entity = Type of entity being modified (ex: Contact)
25
+ # AttributeValues = Comma separated attribute=value pairs.
26
+ # StringDelimiter (optional) = User-specified delimiter used to wrap string values (default is #)
27
+ #
28
+ # {"entity" => "Contact", "attribute_values" => "FirstName=#Jane#,Birthday=1980-12-31,EmailVerified=true,NumChildren=3"}
29
+ #
30
+ # Returns json
31
+ #
32
+ def create_entity(params={})
33
+ params['operation'] = "CreateEntity"
34
+ request(connection, params)
35
+ end
36
+
37
+ # UpdateEntity
38
+ # Allows for modification of attributes of existing Entities.
39
+ #
40
+ # Entity = Type of entity being modified (ex: Contact)
41
+ # Guid = guid of entity being modified
42
+ # AttributeValues = Comma separated attribute=value pairs.
43
+ # StringDelimiter (optional) = User-specified delimiter used to wrap string values (default is #)
44
+ #
45
+ # {"entity" => "Contact", "attribute_values" => "FirstName=#Jane#,Birthday=1980-12-31,EmailVerified=true,NumChildren=3"}
46
+ #
47
+ # Returns json
48
+ #
49
+ def update_entity(params={})
50
+ params['operation'] = "UpdateEntity"
51
+ request(connection, params)
52
+ end
20
53
  end
21
54
  end
22
55
  end
@@ -1,3 +1,3 @@
1
1
  class Ramco
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -13,4 +13,30 @@ describe Ramco::API::Entity do
13
13
  end
14
14
  end
15
15
  end
16
+
17
+ describe "#update_entity" do
18
+ it "should update an entity" do
19
+ VCR.use_cassette('update entity') do
20
+ response = subject.update_entity({"entity" => "Contact", "guid" => "6868642f-0144-e811-9c17-00155d10120d", "attribute_values" => "FirstName=#Jane#,LastName=#Doe#"})
21
+ expect(response).to be_instance_of(Hash)
22
+ expect(response).to have_key "ContactId"
23
+ expect(response["ContactId"]).to eq("6868642f-0144-e811-9c17-00155d10120d")
24
+ expect(response["FirstName"]).to eq("Jane")
25
+ expect(response["LastName"]).to eq("Doe")
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "#create_entity" do
31
+ it "should create an entity" do
32
+ VCR.use_cassette('create entity') do
33
+ response = subject.create_entity({"entity" => "Contact", "attribute_values" => "FirstName=#Jane#,LastName=#Doe#"})
34
+ expect(response).to be_instance_of(Hash)
35
+ expect(response).to have_key "ContactId"
36
+ expect(response["ContactId"]).to eq("6868642f-0144-e811-9c17-00155d10120d")
37
+ expect(response["FirstName"]).to eq("Jane")
38
+ expect(response["LastName"]).to eq("Doe")
39
+ end
40
+ end
41
+ end
16
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Kowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday