repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6 values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3 values |
|---|---|---|---|---|---|---|---|---|---|---|---|
namely/ruby-client | lib/namely/authenticator.rb | Namely.Authenticator.current_user | def current_user(options)
access_token = options.fetch(:access_token)
subdomain = options.fetch(:subdomain)
user_url = URL.new(options.merge(
params: {
access_token: access_token,
},
path: "/api/v1/profiles/me",
)).to_s
response = RestClient.get(
user_url,
accept: :json,
)
build_profile(
access_token,
subdomain,
JSON.parse(response)["profiles"].first
)
end | ruby | def current_user(options)
access_token = options.fetch(:access_token)
subdomain = options.fetch(:subdomain)
user_url = URL.new(options.merge(
params: {
access_token: access_token,
},
path: "/api/v1/profiles/me",
)).to_s
response = RestClient.get(
user_url,
accept: :json,
)
build_profile(
access_token,
subdomain,
JSON.parse(response)["profiles"].first
)
end | [
"def",
"current_user",
"(",
"options",
")",
"access_token",
"=",
"options",
".",
"fetch",
"(",
":access_token",
")",
"subdomain",
"=",
"options",
".",
"fetch",
"(",
":subdomain",
")",
"user_url",
"=",
"URL",
".",
"new",
"(",
"options",
".",
"merge",
"(",
... | Return the profile of the user accessing the API.
@param [Hash] options
@option options [String] access_token (required)
@option options [String] subdomain (required)
@return [Model] the profile of the current user. | [
"Return",
"the",
"profile",
"of",
"the",
"user",
"accessing",
"the",
"API",
"."
] | 6483b15ebbe12c1c1312cf558023f9244146e103 | https://github.com/namely/ruby-client/blob/6483b15ebbe12c1c1312cf558023f9244146e103/lib/namely/authenticator.rb#L116-L136 | valid |
namely/ruby-client | lib/namely/model.rb | Namely.Model.save! | def save!
if persisted?
update(to_h)
else
self.id = resource_gateway.create(to_h)
end
self
rescue RestClient::Exception => e
raise_failed_request_error(e)
end | ruby | def save!
if persisted?
update(to_h)
else
self.id = resource_gateway.create(to_h)
end
self
rescue RestClient::Exception => e
raise_failed_request_error(e)
end | [
"def",
"save!",
"if",
"persisted?",
"update",
"(",
"to_h",
")",
"else",
"self",
".",
"id",
"=",
"resource_gateway",
".",
"create",
"(",
"to_h",
")",
"end",
"self",
"rescue",
"RestClient",
"::",
"Exception",
"=>",
"e",
"raise_failed_request_error",
"(",
"e",
... | Try to persist the current object to the server by creating a
new resource or updating an existing one. Raise an error if the
object can't be saved.
@raise [FailedRequestError] if the request failed for any reason.
@return [Model] the model itself, if saving succeeded. | [
"Try",
"to",
"persist",
"the",
"current",
"object",
"to",
"the",
"server",
"by",
"creating",
"a",
"new",
"resource",
"or",
"updating",
"an",
"existing",
"one",
".",
"Raise",
"an",
"error",
"if",
"the",
"object",
"can",
"t",
"be",
"saved",
"."
] | 6483b15ebbe12c1c1312cf558023f9244146e103 | https://github.com/namely/ruby-client/blob/6483b15ebbe12c1c1312cf558023f9244146e103/lib/namely/model.rb#L17-L26 | valid |
namely/ruby-client | lib/namely/model.rb | Namely.Model.update | def update(attributes)
attributes.each do |key, value|
self[key] = value
end
begin
resource_gateway.update(id, attributes)
rescue RestClient::Exception => e
raise_failed_request_error(e)
end
self
end | ruby | def update(attributes)
attributes.each do |key, value|
self[key] = value
end
begin
resource_gateway.update(id, attributes)
rescue RestClient::Exception => e
raise_failed_request_error(e)
end
self
end | [
"def",
"update",
"(",
"attributes",
")",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"self",
"[",
"key",
"]",
"=",
"value",
"end",
"begin",
"resource_gateway",
".",
"update",
"(",
"id",
",",
"attributes",
")",
"rescue",
"RestClient",
... | Update the attributes of this model. Assign the attributes
according to the hash, then persist those changes on the server.
@param [Hash] attributes the attributes to be updated on the model.
@example
my_profile.update(
middle_name: "Ludwig"
)
@raise [FailedRequestError] if the request failed for any reason.
@return [Model] the updated model. | [
"Update",
"the",
"attributes",
"of",
"this",
"model",
".",
"Assign",
"the",
"attributes",
"according",
"to",
"the",
"hash",
"then",
"persist",
"those",
"changes",
"on",
"the",
"server",
"."
] | 6483b15ebbe12c1c1312cf558023f9244146e103 | https://github.com/namely/ruby-client/blob/6483b15ebbe12c1c1312cf558023f9244146e103/lib/namely/model.rb#L41-L53 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.text | def text(name, locator)
define_method("#{name}") do
adapter.text(locator).value
end
define_method("#{name}=") do |text|
adapter.text(locator).set text
end
define_method("clear_#{name}") do
adapter.text(locator).clear
end
define_method("enter_#{name}") do |text|
adapter.text(locator).enter text
end
define_method("#{name}_view") do
adapter.text(locator).view
end
end | ruby | def text(name, locator)
define_method("#{name}") do
adapter.text(locator).value
end
define_method("#{name}=") do |text|
adapter.text(locator).set text
end
define_method("clear_#{name}") do
adapter.text(locator).clear
end
define_method("enter_#{name}") do |text|
adapter.text(locator).enter text
end
define_method("#{name}_view") do
adapter.text(locator).view
end
end | [
"def",
"text",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"text",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"#{name}=\"",
")",
"do",
"|",
"text",
"|",
"adapter",
".",
"text",
... | Generates methods to enter text into a text field, get its value
and clear the text field
@example
text(:first_name, :id => 'textFieldId')
# will generate 'first_name', 'first_name=' and 'clear_first_name' methods
@param [String] the name used for the generated methods
@param [Hash] locator for how the text is found | [
"Generates",
"methods",
"to",
"enter",
"text",
"into",
"a",
"text",
"field",
"get",
"its",
"value",
"and",
"clear",
"the",
"text",
"field"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L58-L74 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.button | def button(name, locator)
define_method("#{name}") do |&block|
adapter.button(locator).click &block
end
define_method("#{name}_value") do
adapter.button(locator).value
end
define_method("#{name}_view") do
adapter.button(locator).view
end
end | ruby | def button(name, locator)
define_method("#{name}") do |&block|
adapter.button(locator).click &block
end
define_method("#{name}_value") do
adapter.button(locator).value
end
define_method("#{name}_view") do
adapter.button(locator).view
end
end | [
"def",
"button",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"|",
"&",
"block",
"|",
"adapter",
".",
"button",
"(",
"locator",
")",
".",
"click",
"&",
"block",
"end",
"define_method",
"(",
"\"#{name}_value\"",
")",
"... | Generates methods to click on a button as well as get the value of
the button text
@example
button(:close, :value => '&Close')
# will generate 'close' and 'close_value' methods
@param [String] the name used for the generated methods
@param [Hash] locator for how the button is found | [
"Generates",
"methods",
"to",
"click",
"on",
"a",
"button",
"as",
"well",
"as",
"get",
"the",
"value",
"of",
"the",
"button",
"text"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L87-L97 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.combo_box | def combo_box(name, locator)
define_method("#{name}") do
adapter.combo(locator).value
end
define_method("clear_#{name}") do |item|
adapter.combo(locator).clear item
end
define_method("#{name}_selections") do
adapter.combo(locator).values
end
define_method("#{name}=") do |item|
adapter.combo(locator).set item
end
alias_method "select_#{name}", "#{name}="
define_method("#{name}_options") do
adapter.combo(locator).options
end
define_method("#{name}_view") do
adapter.combo(locator).view
end
end | ruby | def combo_box(name, locator)
define_method("#{name}") do
adapter.combo(locator).value
end
define_method("clear_#{name}") do |item|
adapter.combo(locator).clear item
end
define_method("#{name}_selections") do
adapter.combo(locator).values
end
define_method("#{name}=") do |item|
adapter.combo(locator).set item
end
alias_method "select_#{name}", "#{name}="
define_method("#{name}_options") do
adapter.combo(locator).options
end
define_method("#{name}_view") do
adapter.combo(locator).view
end
end | [
"def",
"combo_box",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"combo",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"clear_#{name}\"",
")",
"do",
"|",
"item",
"|",
"adapter",
".",... | Generates methods to get the value of a combo box, set the selected
item by both index and value as well as to see the available options
@example
combo_box(:status, :id => 'statusComboBox')
# will generate 'status', 'status_selections', 'status=', 'select_status','clear_status' and 'status_options' methods
@param [String] the name used for the generated methods
@param [Hash] locator for how the combo box is found
=== Aliases
* combobox
* dropdown / drop_down
* select_list | [
"Generates",
"methods",
"to",
"get",
"the",
"value",
"of",
"a",
"combo",
"box",
"set",
"the",
"selected",
"item",
"by",
"both",
"index",
"and",
"value",
"as",
"well",
"as",
"to",
"see",
"the",
"available",
"options"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L115-L137 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.radio | def radio(name, locator)
define_method("#{name}") do
adapter.radio(locator).set
end
define_method("#{name}?") do
adapter.radio(locator).set?
end
define_method("#{name}_view") do
adapter.radio(locator).view
end
end | ruby | def radio(name, locator)
define_method("#{name}") do
adapter.radio(locator).set
end
define_method("#{name}?") do
adapter.radio(locator).set?
end
define_method("#{name}_view") do
adapter.radio(locator).view
end
end | [
"def",
"radio",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"radio",
"(",
"locator",
")",
".",
"set",
"end",
"define_method",
"(",
"\"#{name}?\"",
")",
"do",
"adapter",
".",
"radio",
"(",
"locator",
"... | Generates methods to set a radio button as well as see if one
is selected
@example
radio(:morning, :id => 'morningRadio')
# will generate 'morning' and 'morning?' methods
@param [String] the name used for the generated methods
@param [Hash] locator for how the radio is found | [
"Generates",
"methods",
"to",
"set",
"a",
"radio",
"button",
"as",
"well",
"as",
"see",
"if",
"one",
"is",
"selected"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L176-L186 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.label | def label(name, locator)
define_method("#{name}") do
adapter.label(locator).value
end
define_method("#{name}_view") do
adapter.label(locator).view
end
end | ruby | def label(name, locator)
define_method("#{name}") do
adapter.label(locator).value
end
define_method("#{name}_view") do
adapter.label(locator).view
end
end | [
"def",
"label",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"label",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"#{name}_view\"",
")",
"do",
"adapter",
".",
"label",
"(",
"locator... | Generates methods to get the value of a label control
@example
label(:login_info, :id => 'loginInfoLabel')
# will generate a 'login_info' method
@param [String] the name used for the generated methods
@param [Hash] locator for how the label is found | [
"Generates",
"methods",
"to",
"get",
"the",
"value",
"of",
"a",
"label",
"control"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L198-L205 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.link | def link(name, locator)
define_method("#{name}_text") do
adapter.link(locator).value
end
define_method("click_#{name}") do
adapter.link(locator).click
end
define_method("#{name}_view") do
adapter.link(locator).view
end
end | ruby | def link(name, locator)
define_method("#{name}_text") do
adapter.link(locator).value
end
define_method("click_#{name}") do
adapter.link(locator).click
end
define_method("#{name}_view") do
adapter.link(locator).view
end
end | [
"def",
"link",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}_text\"",
")",
"do",
"adapter",
".",
"link",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"click_#{name}\"",
")",
"do",
"adapter",
".",
"link",
"(",
"loca... | Generates methods to work with link controls
@example
link(:send_info_link, :id => 'sendInfoId')
# will generate 'send_info_link_text' and 'click_send_info_link' methods
@param [String] the name used for the generated methods
@param [Hash] locator for how the label is found | [
"Generates",
"methods",
"to",
"work",
"with",
"link",
"controls"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L217-L227 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.menu_item | def menu_item(name, locator)
define_method("#{name}") do
adapter.menu_item(locator).select
end
define_method("click_#{name}") do
adapter.menu_item(locator).click
end
end | ruby | def menu_item(name, locator)
define_method("#{name}") do
adapter.menu_item(locator).select
end
define_method("click_#{name}") do
adapter.menu_item(locator).click
end
end | [
"def",
"menu_item",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"menu_item",
"(",
"locator",
")",
".",
"select",
"end",
"define_method",
"(",
"\"click_#{name}\"",
")",
"do",
"adapter",
".",
"menu_item",
"... | Generates methods to work with menu items
@example
menu_item(:some_menu_item, :path => ["Path", "To", "A", "Menu Item"])
# will generate a 'some_menu_item' method to select a menu item
@param [String] the name used for the generated methods
@param [Hash] locator for how the label is found | [
"Generates",
"methods",
"to",
"work",
"with",
"menu",
"items"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L238-L245 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.table | def table(name, locator)
define_method("#{name}") do
adapter.table(locator)
end
define_method("#{name}=") do |which_item|
adapter.table(locator).select which_item
end
define_method("add_#{name}") do |hash_info|
adapter.table(locator).add hash_info
end
define_method("select_#{name}") do |hash_info|
adapter.table(locator).select hash_info
end
define_method("find_#{name}") do |hash_info|
adapter.table(locator).find_row_with hash_info
end
define_method("clear_#{name}") do |hash_info|
adapter.table(locator).clear hash_info
end
define_method("#{name}_headers") do
adapter.table(locator).headers
end
define_method("#{name}_view") do
adapter.table(locator).view
end
end | ruby | def table(name, locator)
define_method("#{name}") do
adapter.table(locator)
end
define_method("#{name}=") do |which_item|
adapter.table(locator).select which_item
end
define_method("add_#{name}") do |hash_info|
adapter.table(locator).add hash_info
end
define_method("select_#{name}") do |hash_info|
adapter.table(locator).select hash_info
end
define_method("find_#{name}") do |hash_info|
adapter.table(locator).find_row_with hash_info
end
define_method("clear_#{name}") do |hash_info|
adapter.table(locator).clear hash_info
end
define_method("#{name}_headers") do
adapter.table(locator).headers
end
define_method("#{name}_view") do
adapter.table(locator).view
end
end | [
"def",
"table",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"table",
"(",
"locator",
")",
"end",
"define_method",
"(",
"\"#{name}=\"",
")",
"do",
"|",
"which_item",
"|",
"adapter",
".",
"table",
"(",
... | Generates methods for working with table or list view controls
@example
table(:some_table, :id => "tableId")
# will generate 'some_table', 'some_table=', 'some_table_headers', 'select_some_table', 'clear_some_table',
# find_some_table and 'some_table_view' methods to get an Enumerable of table rows,
# select a table item, clear a table item, return all of the headers and get the raw view
@param [String] the name used for the generated methods
@param [Hash] locator for how the label is found
=== Aliases
* listview
* list_view | [
"Generates",
"methods",
"for",
"working",
"with",
"table",
"or",
"list",
"view",
"controls"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L262-L287 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.tree_view | def tree_view(name, locator)
define_method("#{name}") do
adapter.tree_view(locator).value
end
define_method("#{name}=") do |which_item|
adapter.tree_view(locator).select which_item
end
define_method("#{name}_items") do
adapter.tree_view(locator).items
end
define_method("expand_#{name}_item") do |which_item|
adapter.tree_view(locator).expand which_item
end
define_method("collapse_#{name}_item") do |which_item|
adapter.tree_view(locator).collapse which_item
end
define_method("#{name}_view") do
adapter.tree_view(locator).view
end
end | ruby | def tree_view(name, locator)
define_method("#{name}") do
adapter.tree_view(locator).value
end
define_method("#{name}=") do |which_item|
adapter.tree_view(locator).select which_item
end
define_method("#{name}_items") do
adapter.tree_view(locator).items
end
define_method("expand_#{name}_item") do |which_item|
adapter.tree_view(locator).expand which_item
end
define_method("collapse_#{name}_item") do |which_item|
adapter.tree_view(locator).collapse which_item
end
define_method("#{name}_view") do
adapter.tree_view(locator).view
end
end | [
"def",
"tree_view",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"adapter",
".",
"tree_view",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"#{name}=\"",
")",
"do",
"|",
"which_item",
"|",
"adapter",
... | Generates methods for working with tree view controls
@example
tree_view(:tree, :id => "treeId")
# will generate 'tree', 'tree=', 'tree_items', 'expand_tree_item' and 'collapse_tree_item'
# methods to get the tree value, set the tree value (index or string), get all of the
# items, expand an item (index or string) and collapse an item (index or string)
@param [String] the name used for the generated methods
@param [Hash] locator for how the label is found
=== Aliases
* treeview
* tree | [
"Generates",
"methods",
"for",
"working",
"with",
"tree",
"view",
"controls"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L304-L323 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.spinner | def spinner(name, locator)
define_method(name) do
adapter.spinner(locator).value
end
define_method("#{name}=") do |value|
adapter.spinner(locator).value = value
end
define_method("increment_#{name}") do
adapter.spinner(locator).increment
end
define_method("decrement_#{name}") do
adapter.spinner(locator).decrement
end
define_method("#{name}_view") do
adapter.spinner(locator).view
end
end | ruby | def spinner(name, locator)
define_method(name) do
adapter.spinner(locator).value
end
define_method("#{name}=") do |value|
adapter.spinner(locator).value = value
end
define_method("increment_#{name}") do
adapter.spinner(locator).increment
end
define_method("decrement_#{name}") do
adapter.spinner(locator).decrement
end
define_method("#{name}_view") do
adapter.spinner(locator).view
end
end | [
"def",
"spinner",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"name",
")",
"do",
"adapter",
".",
"spinner",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"#{name}=\"",
")",
"do",
"|",
"value",
"|",
"adapter",
".",
"spinner... | Generates methods for working with spinner controls
@example
spinner(:age, :id => "ageId")
# will generate 'age', 'age=' methods to get the spinner value and
# set the spinner value.
@param [String] the name used for the generated methods
@param [Hash] locator for how the spinner control is found | [
"Generates",
"methods",
"for",
"working",
"with",
"spinner",
"controls"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L335-L351 | valid |
leviwilson/mohawk | lib/mohawk/accessors.rb | Mohawk.Accessors.tabs | def tabs(name, locator)
define_method(name) do
adapter.tab_control(locator).value
end
define_method("#{name}=") do |which|
adapter.tab_control(locator).selected_tab = which
end
define_method("#{name}_items") do
adapter.tab_control(locator).items
end
define_method("#{name}_view") do
adapter.tab_control(locator)
end
end | ruby | def tabs(name, locator)
define_method(name) do
adapter.tab_control(locator).value
end
define_method("#{name}=") do |which|
adapter.tab_control(locator).selected_tab = which
end
define_method("#{name}_items") do
adapter.tab_control(locator).items
end
define_method("#{name}_view") do
adapter.tab_control(locator)
end
end | [
"def",
"tabs",
"(",
"name",
",",
"locator",
")",
"define_method",
"(",
"name",
")",
"do",
"adapter",
".",
"tab_control",
"(",
"locator",
")",
".",
"value",
"end",
"define_method",
"(",
"\"#{name}=\"",
")",
"do",
"|",
"which",
"|",
"adapter",
".",
"tab_co... | Generates methods for working with tab controls
@example
tabs(:tab, :id => "tableId")
# will generate 'tab', 'tab=' and 'tab_items' methods to get the current tab,
# set the currently selected tab (Fixnum, String or RegEx) and to get the
# available tabs to be selected
@param [String] the name used for the generated methods
@param [Hash] locator for how the tab control is found | [
"Generates",
"methods",
"for",
"working",
"with",
"tab",
"controls"
] | cacef0429cac39fecc1af1863c9c557bbd09efe7 | https://github.com/leviwilson/mohawk/blob/cacef0429cac39fecc1af1863c9c557bbd09efe7/lib/mohawk/accessors.rb#L364-L377 | valid |
sgruhier/foundation_rails_helper | lib/foundation_rails_helper/flash_helper.rb | FoundationRailsHelper.FlashHelper.display_flash_messages | def display_flash_messages(closable: true, key_matching: {})
key_matching = DEFAULT_KEY_MATCHING.merge(key_matching)
key_matching.default = :primary
capture do
flash.each do |key, value|
next if ignored_key?(key.to_sym)
alert_class = key_matching[key.to_sym]
concat alert_box(value, alert_class, closable)
end
end
end | ruby | def display_flash_messages(closable: true, key_matching: {})
key_matching = DEFAULT_KEY_MATCHING.merge(key_matching)
key_matching.default = :primary
capture do
flash.each do |key, value|
next if ignored_key?(key.to_sym)
alert_class = key_matching[key.to_sym]
concat alert_box(value, alert_class, closable)
end
end
end | [
"def",
"display_flash_messages",
"(",
"closable",
":",
"true",
",",
"key_matching",
":",
"{",
"}",
")",
"key_matching",
"=",
"DEFAULT_KEY_MATCHING",
".",
"merge",
"(",
"key_matching",
")",
"key_matching",
".",
"default",
"=",
":primary",
"capture",
"do",
"flash"... | Displays the flash messages found in ActionDispatch's +flash+ hash using
Foundation's +callout+ component.
Parameters:
* +closable+ - A boolean to determine whether the displayed flash messages
should be closable by the user. Defaults to true.
* +key_matching+ - A Hash of key/value pairs mapping flash keys to the
corresponding class to use for the callout box. | [
"Displays",
"the",
"flash",
"messages",
"found",
"in",
"ActionDispatch",
"s",
"+",
"flash",
"+",
"hash",
"using",
"Foundation",
"s",
"+",
"callout",
"+",
"component",
"."
] | 8a4b53d9b348bbf49c3608aea811fe17b9282e4c | https://github.com/sgruhier/foundation_rails_helper/blob/8a4b53d9b348bbf49c3608aea811fe17b9282e4c/lib/foundation_rails_helper/flash_helper.rb#L31-L43 | valid |
tigris/pin_payment | lib/pin_payment/charge.rb | PinPayment.Charge.refunds | def refunds
response = Charge.get(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/charges/#{token}/refunds" })
response.map{|x| Refund.new(x.delete('token'), x) }
end | ruby | def refunds
response = Charge.get(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/charges/#{token}/refunds" })
response.map{|x| Refund.new(x.delete('token'), x) }
end | [
"def",
"refunds",
"response",
"=",
"Charge",
".",
"get",
"(",
"URI",
".",
"parse",
"(",
"PinPayment",
".",
"api_url",
")",
".",
"tap",
"{",
"|",
"uri",
"|",
"uri",
".",
"path",
"=",
"\"/1/charges/#{token}/refunds\"",
"}",
")",
"response",
".",
"map",
"... | Fetches all refunds of your charge using the pin API.
@return [Array<PinPayment::Refund>]
TODO: pagination | [
"Fetches",
"all",
"refunds",
"of",
"your",
"charge",
"using",
"the",
"pin",
"API",
"."
] | 3f1acd823fe3eb1b05a7447ac6018ff37f914b9d | https://github.com/tigris/pin_payment/blob/3f1acd823fe3eb1b05a7447ac6018ff37f914b9d/lib/pin_payment/charge.rb#L54-L57 | valid |
tigris/pin_payment | lib/pin_payment/recipient.rb | PinPayment.Recipient.update | def update email, account_or_token = nil
attributes = self.class.attributes - [:token, :created_at]
options = self.class.parse_options_for_request(attributes, email: email, bank_account: account_or_token)
response = self.class.put(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/recipients/#{token}" }, options)
self.email = response['email']
self.bank_account = response['bank_account']
self
end | ruby | def update email, account_or_token = nil
attributes = self.class.attributes - [:token, :created_at]
options = self.class.parse_options_for_request(attributes, email: email, bank_account: account_or_token)
response = self.class.put(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/recipients/#{token}" }, options)
self.email = response['email']
self.bank_account = response['bank_account']
self
end | [
"def",
"update",
"email",
",",
"account_or_token",
"=",
"nil",
"attributes",
"=",
"self",
".",
"class",
".",
"attributes",
"-",
"[",
":token",
",",
":created_at",
"]",
"options",
"=",
"self",
".",
"class",
".",
"parse_options_for_request",
"(",
"attributes",
... | Update a recipient using the pin API.
@param [String] email the recipients's new email address
@param [String, PinPayment::BankAccount, Hash] account_or_token the recipient's new bank account details
@return [PinPayment::Customer] | [
"Update",
"a",
"recipient",
"using",
"the",
"pin",
"API",
"."
] | 3f1acd823fe3eb1b05a7447ac6018ff37f914b9d | https://github.com/tigris/pin_payment/blob/3f1acd823fe3eb1b05a7447ac6018ff37f914b9d/lib/pin_payment/recipient.rb#L54-L61 | valid |
tigris/pin_payment | lib/pin_payment/customer.rb | PinPayment.Customer.update | def update email, card_or_token = nil
attributes = self.class.attributes - [:token, :created_at]
options = self.class.parse_options_for_request(attributes, email: email, card: card_or_token)
response = self.class.put(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/customers/#{token}" }, options)
self.email = response['email']
self.card = response['card']
self
end | ruby | def update email, card_or_token = nil
attributes = self.class.attributes - [:token, :created_at]
options = self.class.parse_options_for_request(attributes, email: email, card: card_or_token)
response = self.class.put(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/customers/#{token}" }, options)
self.email = response['email']
self.card = response['card']
self
end | [
"def",
"update",
"email",
",",
"card_or_token",
"=",
"nil",
"attributes",
"=",
"self",
".",
"class",
".",
"attributes",
"-",
"[",
":token",
",",
":created_at",
"]",
"options",
"=",
"self",
".",
"class",
".",
"parse_options_for_request",
"(",
"attributes",
",... | Update a customer using the pin API.
@param [String] email the customer's new email address
@param [String, PinPayment::Card, Hash] card_or_token the customer's new credit card details
@return [PinPayment::Customer] | [
"Update",
"a",
"customer",
"using",
"the",
"pin",
"API",
"."
] | 3f1acd823fe3eb1b05a7447ac6018ff37f914b9d | https://github.com/tigris/pin_payment/blob/3f1acd823fe3eb1b05a7447ac6018ff37f914b9d/lib/pin_payment/customer.rb#L55-L62 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.ls | def ls(mask = '', raise = true)
ls_items = []
mask = '"' + mask + '"' if mask.include? ' '
output = exec 'ls ' + mask
output.lines.each do |line|
ls_item = LsItem.from_line(line)
ls_items << ls_item if ls_item
end
ls_items
rescue Client::RuntimeError => e
raise e if raise
[]
end | ruby | def ls(mask = '', raise = true)
ls_items = []
mask = '"' + mask + '"' if mask.include? ' '
output = exec 'ls ' + mask
output.lines.each do |line|
ls_item = LsItem.from_line(line)
ls_items << ls_item if ls_item
end
ls_items
rescue Client::RuntimeError => e
raise e if raise
[]
end | [
"def",
"ls",
"(",
"mask",
"=",
"''",
",",
"raise",
"=",
"true",
")",
"ls_items",
"=",
"[",
"]",
"mask",
"=",
"'\"'",
"+",
"mask",
"+",
"'\"'",
"if",
"mask",
".",
"include?",
"' '",
"output",
"=",
"exec",
"'ls '",
"+",
"mask",
"output",
".",
"line... | List contents of a remote directory
@param [String] mask The matching mask
@param [Boolean] raise If set, an error will be raised. If set to
+false+, an empty array will be returned
@return [Array] List of +mask+ matching LsItems | [
"List",
"contents",
"of",
"a",
"remote",
"directory"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L14-L26 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.put | def put(from, to, overwrite = false, raise = true)
ls_items = ls to, false
if !overwrite && !ls_items.empty?
raise Client::RuntimeError, "File [#{to}] already exist"
end
from = '"' + from + '"' if from.include? ' '
to = '"' + to + '"' if to.include? ' '
exec 'put ' + from + ' ' + to
true
rescue Client::RuntimeError => e
raise e if raise
false
end | ruby | def put(from, to, overwrite = false, raise = true)
ls_items = ls to, false
if !overwrite && !ls_items.empty?
raise Client::RuntimeError, "File [#{to}] already exist"
end
from = '"' + from + '"' if from.include? ' '
to = '"' + to + '"' if to.include? ' '
exec 'put ' + from + ' ' + to
true
rescue Client::RuntimeError => e
raise e if raise
false
end | [
"def",
"put",
"(",
"from",
",",
"to",
",",
"overwrite",
"=",
"false",
",",
"raise",
"=",
"true",
")",
"ls_items",
"=",
"ls",
"to",
",",
"false",
"if",
"!",
"overwrite",
"&&",
"!",
"ls_items",
".",
"empty?",
"raise",
"Client",
"::",
"RuntimeError",
",... | Upload a local file
@param [String] from The source file path (on local machine)
@param [String] to The destination file path
@param [Boolean] overwrite Overwrite if exist on server?
@param [Boolean] raise raise Error or just return +false+
@return [Boolean] true on success | [
"Upload",
"a",
"local",
"file"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L63-L75 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.write | def write(content, to, overwrite = false, raise = true)
# This is just a hack around +put+
tempfile = Tempfile.new
tempfile.write content
tempfile.close
put tempfile.path, to, overwrite, raise
end | ruby | def write(content, to, overwrite = false, raise = true)
# This is just a hack around +put+
tempfile = Tempfile.new
tempfile.write content
tempfile.close
put tempfile.path, to, overwrite, raise
end | [
"def",
"write",
"(",
"content",
",",
"to",
",",
"overwrite",
"=",
"false",
",",
"raise",
"=",
"true",
")",
"tempfile",
"=",
"Tempfile",
".",
"new",
"tempfile",
".",
"write",
"content",
"tempfile",
".",
"close",
"put",
"tempfile",
".",
"path",
",",
"to"... | Writes content to remote file
@param [String] content The content to be written
@param [String] to The destination file path
@param [Boolean] overwrite Overwrite if exist on server?
@param [Boolean] raise raise Error or just return +false+
@return [Boolean] true on success | [
"Writes",
"content",
"to",
"remote",
"file"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L83-L90 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.del | def del(path, raise = true)
path = '"' + path + '"' if path.include? ' '
exec 'del ' + path
true
rescue Client::RuntimeError => e
raise e if raise
false
end | ruby | def del(path, raise = true)
path = '"' + path + '"' if path.include? ' '
exec 'del ' + path
true
rescue Client::RuntimeError => e
raise e if raise
false
end | [
"def",
"del",
"(",
"path",
",",
"raise",
"=",
"true",
")",
"path",
"=",
"'\"'",
"+",
"path",
"+",
"'\"'",
"if",
"path",
".",
"include?",
"' '",
"exec",
"'del '",
"+",
"path",
"true",
"rescue",
"Client",
"::",
"RuntimeError",
"=>",
"e",
"raise",
"e",
... | Delete a remote file
@param [String] path The remote file to be deleted
@param [Boolean] raise raise raise Error or just return +false+
@return [Boolean] true on success | [
"Delete",
"a",
"remote",
"file"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L96-L103 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.get | def get(from, to = nil, overwrite = false, raise = true)
# Create a new tempfile but delete it
# The tempfile.path should be free to use now
tempfile = Tempfile.new
to ||= tempfile.path
tempfile.unlink
if !overwrite && File.exist?(to)
raise Client::RuntimeError, "File [#{to}] already exist locally"
end
from = '"' + from + '"' if from.include? ' '
exec 'get ' + from + ' ' + to
to
rescue Client::RuntimeError => e
raise e if raise
false
end | ruby | def get(from, to = nil, overwrite = false, raise = true)
# Create a new tempfile but delete it
# The tempfile.path should be free to use now
tempfile = Tempfile.new
to ||= tempfile.path
tempfile.unlink
if !overwrite && File.exist?(to)
raise Client::RuntimeError, "File [#{to}] already exist locally"
end
from = '"' + from + '"' if from.include? ' '
exec 'get ' + from + ' ' + to
to
rescue Client::RuntimeError => e
raise e if raise
false
end | [
"def",
"get",
"(",
"from",
",",
"to",
"=",
"nil",
",",
"overwrite",
"=",
"false",
",",
"raise",
"=",
"true",
")",
"tempfile",
"=",
"Tempfile",
".",
"new",
"to",
"||=",
"tempfile",
".",
"path",
"tempfile",
".",
"unlink",
"if",
"!",
"overwrite",
"&&",
... | Receive a file from the smb server to local.
If +to+ was not passed, a tempfile will be generated.
@param [String] from The remote file to be read
@param [String] to local file path to be created
@param [Boolean] overwrite Overwrite if exist locally?
@param [Boolean] raise raise Error or just return +false+
@return [String] path to local file | [
"Receive",
"a",
"file",
"from",
"the",
"smb",
"server",
"to",
"local",
".",
"If",
"+",
"to",
"+",
"was",
"not",
"passed",
"a",
"tempfile",
"will",
"be",
"generated",
"."
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L115-L131 | valid |
NetcomKassel/smb-client | lib/smb/client/client_helper.rb | SMB.ClientHelper.read | def read(from, overwrite = false, raise = true)
tempfile = Tempfile.new
to = tempfile.path
tempfile.unlink
get from, to, overwrite, raise
File.read to
end | ruby | def read(from, overwrite = false, raise = true)
tempfile = Tempfile.new
to = tempfile.path
tempfile.unlink
get from, to, overwrite, raise
File.read to
end | [
"def",
"read",
"(",
"from",
",",
"overwrite",
"=",
"false",
",",
"raise",
"=",
"true",
")",
"tempfile",
"=",
"Tempfile",
".",
"new",
"to",
"=",
"tempfile",
".",
"path",
"tempfile",
".",
"unlink",
"get",
"from",
",",
"to",
",",
"overwrite",
",",
"rais... | Reads a remote file and return its content
@param [String] from The file to be read from server
@param [Boolean] overwrite Overwrite if exist locally?
@param [Boolean] raise raise Error or just return +false+
@return [String] The content of the remote file | [
"Reads",
"a",
"remote",
"file",
"and",
"return",
"its",
"content"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client_helper.rb#L138-L144 | valid |
NetcomKassel/smb-client | lib/smb/client/client.rb | SMB.Client.exec | def exec(cmd)
# Send command
@write1.puts cmd
# Wait for response
text = @read2.read
# Close previous pipe
@read2.close
# Create new pipe
@read2, @write2 = IO.pipe
# Raise at the end to support continuing
raise Client::RuntimeError, text if text.start_with? 'NT_STATUS_'
text
end | ruby | def exec(cmd)
# Send command
@write1.puts cmd
# Wait for response
text = @read2.read
# Close previous pipe
@read2.close
# Create new pipe
@read2, @write2 = IO.pipe
# Raise at the end to support continuing
raise Client::RuntimeError, text if text.start_with? 'NT_STATUS_'
text
end | [
"def",
"exec",
"(",
"cmd",
")",
"@write1",
".",
"puts",
"cmd",
"text",
"=",
"@read2",
".",
"read",
"@read2",
".",
"close",
"@read2",
",",
"@write2",
"=",
"IO",
".",
"pipe",
"raise",
"Client",
"::",
"RuntimeError",
",",
"text",
"if",
"text",
".",
"sta... | Execute a smbclient command
@param [String] cmd The command to be executed | [
"Execute",
"a",
"smbclient",
"command"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client.rb#L54-L71 | valid |
NetcomKassel/smb-client | lib/smb/client/client.rb | SMB.Client.connect | def connect
# Run +@executable+ in a separate thread to talk to hin asynchronously
Thread.start do
# Spawn the actual +@executable+ pty with +input+ and +output+ handle
begin
PTY.spawn(@executable + ' ' + params) do |output, input, pid|
@pid = pid
output.sync = true
input.sync = true
# Write inputs to pty from +exec+ method
Thread.start do
while (line = @read1.readline)
input.puts line
end
end
# Wait for responses ending with input prompt
loop do
output.expect(/smb: \\>$/) { |text| handle_response text }
end
end
rescue Errno::EIO => e
unless @shutdown_in_progress
if @connection_established
raise StandardError, "Unexpected error: [#{e.message}]"
else
raise Client::ConnectionError, 'Cannot connect to SMB server'
end
end
end
end
end | ruby | def connect
# Run +@executable+ in a separate thread to talk to hin asynchronously
Thread.start do
# Spawn the actual +@executable+ pty with +input+ and +output+ handle
begin
PTY.spawn(@executable + ' ' + params) do |output, input, pid|
@pid = pid
output.sync = true
input.sync = true
# Write inputs to pty from +exec+ method
Thread.start do
while (line = @read1.readline)
input.puts line
end
end
# Wait for responses ending with input prompt
loop do
output.expect(/smb: \\>$/) { |text| handle_response text }
end
end
rescue Errno::EIO => e
unless @shutdown_in_progress
if @connection_established
raise StandardError, "Unexpected error: [#{e.message}]"
else
raise Client::ConnectionError, 'Cannot connect to SMB server'
end
end
end
end
end | [
"def",
"connect",
"Thread",
".",
"start",
"do",
"begin",
"PTY",
".",
"spawn",
"(",
"@executable",
"+",
"' '",
"+",
"params",
")",
"do",
"|",
"output",
",",
"input",
",",
"pid",
"|",
"@pid",
"=",
"pid",
"output",
".",
"sync",
"=",
"true",
"input",
"... | Connect to the server using separate threads and pipe for communications | [
"Connect",
"to",
"the",
"server",
"using",
"separate",
"threads",
"and",
"pipe",
"for",
"communications"
] | 5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd | https://github.com/NetcomKassel/smb-client/blob/5f6a24e5e7cc279ec5bb09f42efa1f4184444bcd/lib/smb/client/client.rb#L76-L108 | valid |
metanorma/iso-bib-item | lib/iso_bib_item/iso_bibliographic_item.rb | IsoBibItem.IsoBibliographicItem.to_all_parts | def to_all_parts
me = DeepClone.clone(self)
me.disable_id_attribute
@relations << DocumentRelation.new(type: "partOf", identifier: nil, url: nil, bibitem: me)
@title.each(&:remove_part)
@abstract = []
@docidentifier.each(&:remove_part)
@docidentifier.each(&:all_parts)
@all_parts = true
end | ruby | def to_all_parts
me = DeepClone.clone(self)
me.disable_id_attribute
@relations << DocumentRelation.new(type: "partOf", identifier: nil, url: nil, bibitem: me)
@title.each(&:remove_part)
@abstract = []
@docidentifier.each(&:remove_part)
@docidentifier.each(&:all_parts)
@all_parts = true
end | [
"def",
"to_all_parts",
"me",
"=",
"DeepClone",
".",
"clone",
"(",
"self",
")",
"me",
".",
"disable_id_attribute",
"@relations",
"<<",
"DocumentRelation",
".",
"new",
"(",
"type",
":",
"\"partOf\"",
",",
"identifier",
":",
"nil",
",",
"url",
":",
"nil",
","... | remove title part components and abstract | [
"remove",
"title",
"part",
"components",
"and",
"abstract"
] | 205ef2b5e4ce626cf9b65f3c39f613825b10db03 | https://github.com/metanorma/iso-bib-item/blob/205ef2b5e4ce626cf9b65f3c39f613825b10db03/lib/iso_bib_item/iso_bibliographic_item.rb#L201-L210 | valid |
jico/automata | lib/automata/dfa.rb | Automata.DFA.valid? | def valid?
# @todo Check that each state is connected.
# Iterate through each states to verify the graph
# is not disjoint.
@transitions.each do |key, val|
@alphabet.each do |a|
return false unless @transitions[key].has_key? a.to_s
end
end
return true
end | ruby | def valid?
# @todo Check that each state is connected.
# Iterate through each states to verify the graph
# is not disjoint.
@transitions.each do |key, val|
@alphabet.each do |a|
return false unless @transitions[key].has_key? a.to_s
end
end
return true
end | [
"def",
"valid?",
"@transitions",
".",
"each",
"do",
"|",
"key",
",",
"val",
"|",
"@alphabet",
".",
"each",
"do",
"|",
"a",
"|",
"return",
"false",
"unless",
"@transitions",
"[",
"key",
"]",
".",
"has_key?",
"a",
".",
"to_s",
"end",
"end",
"return",
"... | Verifies that the initialized DFA is valid.
Checks that each state has a transition for each
symbol in the alphabet.
@return [Boolean] whether or not the DFA is valid. | [
"Verifies",
"that",
"the",
"initialized",
"DFA",
"is",
"valid",
".",
"Checks",
"that",
"each",
"state",
"has",
"a",
"transition",
"for",
"each",
"symbol",
"in",
"the",
"alphabet",
"."
] | 177cea186de1d55be2f1d2ed1a78c313f74945a1 | https://github.com/jico/automata/blob/177cea186de1d55be2f1d2ed1a78c313f74945a1/lib/automata/dfa.rb#L9-L19 | valid |
jico/automata | lib/automata/dfa.rb | Automata.DFA.feed | def feed(input)
head = @start.to_s
input.each_char { |symbol| head = @transitions[head][symbol] }
accept = is_accept_state? head
resp = {
input: input,
accept: accept,
head: head
}
resp
end | ruby | def feed(input)
head = @start.to_s
input.each_char { |symbol| head = @transitions[head][symbol] }
accept = is_accept_state? head
resp = {
input: input,
accept: accept,
head: head
}
resp
end | [
"def",
"feed",
"(",
"input",
")",
"head",
"=",
"@start",
".",
"to_s",
"input",
".",
"each_char",
"{",
"|",
"symbol",
"|",
"head",
"=",
"@transitions",
"[",
"head",
"]",
"[",
"symbol",
"]",
"}",
"accept",
"=",
"is_accept_state?",
"head",
"resp",
"=",
... | Runs the input on the machine and returns a Hash describing
the machine's final state after running.
@param [String] input the string to use as input for the DFA
@return [Hash] a hash describing the DFA state after running
* :input [String] the original input string
* :accept [Boolean] whether or not the DFA accepted the string
* :head [String] the state which the head is currently on | [
"Runs",
"the",
"input",
"on",
"the",
"machine",
"and",
"returns",
"a",
"Hash",
"describing",
"the",
"machine",
"s",
"final",
"state",
"after",
"running",
"."
] | 177cea186de1d55be2f1d2ed1a78c313f74945a1 | https://github.com/jico/automata/blob/177cea186de1d55be2f1d2ed1a78c313f74945a1/lib/automata/dfa.rb#L29-L39 | valid |
bmuller/hbaserb | lib/hbaserb/table.rb | HBaseRb.Table.create_scanner | def create_scanner(start_row=nil, end_row=nil, *columns, &block)
columns = (columns.length > 0) ? columns : column_families.keys
sid = call :scannerOpenWithStop, start_row.to_s, end_row.to_s, columns
Scanner.new @client, sid, &block
end | ruby | def create_scanner(start_row=nil, end_row=nil, *columns, &block)
columns = (columns.length > 0) ? columns : column_families.keys
sid = call :scannerOpenWithStop, start_row.to_s, end_row.to_s, columns
Scanner.new @client, sid, &block
end | [
"def",
"create_scanner",
"(",
"start_row",
"=",
"nil",
",",
"end_row",
"=",
"nil",
",",
"*",
"columns",
",",
"&",
"block",
")",
"columns",
"=",
"(",
"columns",
".",
"length",
">",
"0",
")",
"?",
"columns",
":",
"column_families",
".",
"keys",
"sid",
... | pass in no params to scan whole table | [
"pass",
"in",
"no",
"params",
"to",
"scan",
"whole",
"table"
] | cc8a323daef375b63382259f7dc85d00e2727531 | https://github.com/bmuller/hbaserb/blob/cc8a323daef375b63382259f7dc85d00e2727531/lib/hbaserb/table.rb#L49-L54 | valid |
jico/automata | lib/automata/turing.rb | Automata.Tape.transition | def transition(read, write, move)
if read == @memory[@head]
@memory[@head] = write
case move
when 'R'
# Move right
@memory << '@' if @memory[@head + 1]
@head += 1
when 'L'
# Move left
@memory.unshift('@') if @head == 0
@head -= 1
end
return true
else
return false
end
end | ruby | def transition(read, write, move)
if read == @memory[@head]
@memory[@head] = write
case move
when 'R'
# Move right
@memory << '@' if @memory[@head + 1]
@head += 1
when 'L'
# Move left
@memory.unshift('@') if @head == 0
@head -= 1
end
return true
else
return false
end
end | [
"def",
"transition",
"(",
"read",
",",
"write",
",",
"move",
")",
"if",
"read",
"==",
"@memory",
"[",
"@head",
"]",
"@memory",
"[",
"@head",
"]",
"=",
"write",
"case",
"move",
"when",
"'R'",
"@memory",
"<<",
"'@'",
"if",
"@memory",
"[",
"@head",
"+",... | Creates a new tape.
@param [String] string the input string
Transitions the tape.
@param [String] read the input symbol read
@param [String] write the symbol to write
@param [String] move Either 'L', 'R', or 'S' (default) to
move left, right, or stay, respectively.
@return [Boolean] whether the transition succeeded | [
"Creates",
"a",
"new",
"tape",
"."
] | 177cea186de1d55be2f1d2ed1a78c313f74945a1 | https://github.com/jico/automata/blob/177cea186de1d55be2f1d2ed1a78c313f74945a1/lib/automata/turing.rb#L130-L147 | valid |
jico/automata | lib/automata/pda.rb | Automata.PDA.feed | def feed(input)
heads, @stack, accept = [@start], [], false
# Move any initial e-transitions
eTrans = transition(@start, '&') if has_transition?(@start, '&')
heads += eTrans
puts "initial heads: #{heads}"
puts "initial stack: #{@stack}"
# Iterate through each symbol of input string
input.each_char do |symbol|
newHeads = []
puts "Reading symbol: #{symbol}"
heads.each do |head|
puts "At head #{head}"
# Check if head can transition read symbol
# Head dies if no transition for symbol
if has_transition?(head, symbol)
puts "Head #{head} transitions #{symbol}"
puts "stack: #{@stack}"
transition(head, symbol).each { |t| newHeads << t }
puts "heads: #{newHeads}"
puts "stack: #{@stack}"
end
end
heads = newHeads
break if heads.empty?
end
puts "Loop finished"
accept = includes_accept_state? heads
puts "heads: #{heads}"
puts "stack: #{stack}"
puts "accept: #{accept}"
resp = {
input: input,
accept: accept,
heads: heads,
stack: stack
}
end | ruby | def feed(input)
heads, @stack, accept = [@start], [], false
# Move any initial e-transitions
eTrans = transition(@start, '&') if has_transition?(@start, '&')
heads += eTrans
puts "initial heads: #{heads}"
puts "initial stack: #{@stack}"
# Iterate through each symbol of input string
input.each_char do |symbol|
newHeads = []
puts "Reading symbol: #{symbol}"
heads.each do |head|
puts "At head #{head}"
# Check if head can transition read symbol
# Head dies if no transition for symbol
if has_transition?(head, symbol)
puts "Head #{head} transitions #{symbol}"
puts "stack: #{@stack}"
transition(head, symbol).each { |t| newHeads << t }
puts "heads: #{newHeads}"
puts "stack: #{@stack}"
end
end
heads = newHeads
break if heads.empty?
end
puts "Loop finished"
accept = includes_accept_state? heads
puts "heads: #{heads}"
puts "stack: #{stack}"
puts "accept: #{accept}"
resp = {
input: input,
accept: accept,
heads: heads,
stack: stack
}
end | [
"def",
"feed",
"(",
"input",
")",
"heads",
",",
"@stack",
",",
"accept",
"=",
"[",
"@start",
"]",
",",
"[",
"]",
",",
"false",
"eTrans",
"=",
"transition",
"(",
"@start",
",",
"'&'",
")",
"if",
"has_transition?",
"(",
"@start",
",",
"'&'",
")",
"he... | Initialize a PDA object.
Runs the input on the machine and returns a Hash describing
the machine's final state after running.
@param [String] input the string to use as input for the PDA
@return [Hash] a hash describing the PDA state after running
* :input [String] the original input string
* :accept [Boolean] whether or not the PDA accepted the string
* :heads [Array] the state which the head is currently on | [
"Initialize",
"a",
"PDA",
"object",
".",
"Runs",
"the",
"input",
"on",
"the",
"machine",
"and",
"returns",
"a",
"Hash",
"describing",
"the",
"machine",
"s",
"final",
"state",
"after",
"running",
"."
] | 177cea186de1d55be2f1d2ed1a78c313f74945a1 | https://github.com/jico/automata/blob/177cea186de1d55be2f1d2ed1a78c313f74945a1/lib/automata/pda.rb#L21-L70 | valid |
jico/automata | lib/automata/pda.rb | Automata.PDA.has_transition? | def has_transition?(state, symbol)
return false unless @transitions.has_key? state
if @transitions[state].has_key? symbol
actions = @transitions[state][symbol]
return false if actions['pop'] && @stack.last != actions['pop']
return true
else
return false
end
end | ruby | def has_transition?(state, symbol)
return false unless @transitions.has_key? state
if @transitions[state].has_key? symbol
actions = @transitions[state][symbol]
return false if actions['pop'] && @stack.last != actions['pop']
return true
else
return false
end
end | [
"def",
"has_transition?",
"(",
"state",
",",
"symbol",
")",
"return",
"false",
"unless",
"@transitions",
".",
"has_key?",
"state",
"if",
"@transitions",
"[",
"state",
"]",
".",
"has_key?",
"symbol",
"actions",
"=",
"@transitions",
"[",
"state",
"]",
"[",
"sy... | Determines whether or not any transition states exist
given a beginning state and input symbol pair.
@param (see #transition)
@return [Boolean] Whether or not a transition exists. | [
"Determines",
"whether",
"or",
"not",
"any",
"transition",
"states",
"exist",
"given",
"a",
"beginning",
"state",
"and",
"input",
"symbol",
"pair",
"."
] | 177cea186de1d55be2f1d2ed1a78c313f74945a1 | https://github.com/jico/automata/blob/177cea186de1d55be2f1d2ed1a78c313f74945a1/lib/automata/pda.rb#L135-L144 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/model.rb | AmazonFlexPay.Model.to_hash | def to_hash
self.class.attribute_names.inject({}) do |hash, name|
val = format_value(send(name.underscore))
val.empty? ? hash : hash.merge(format_key(name) => val)
end
end | ruby | def to_hash
self.class.attribute_names.inject({}) do |hash, name|
val = format_value(send(name.underscore))
val.empty? ? hash : hash.merge(format_key(name) => val)
end
end | [
"def",
"to_hash",
"self",
".",
"class",
".",
"attribute_names",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"hash",
",",
"name",
"|",
"val",
"=",
"format_value",
"(",
"send",
"(",
"name",
".",
"underscore",
")",
")",
"val",
".",
"empty?",
"?",
"h... | Formats all attributes into a hash of parameters. | [
"Formats",
"all",
"attributes",
"into",
"a",
"hash",
"of",
"parameters",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/model.rb#L100-L105 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/model.rb | AmazonFlexPay.Model.format_value | def format_value(val)
case val
when AmazonFlexPay::Model
val.to_hash
when Time
val.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
when TrueClass, FalseClass
val.to_s.capitalize
when Array
val.join(',')
else
val.to_s
end
end | ruby | def format_value(val)
case val
when AmazonFlexPay::Model
val.to_hash
when Time
val.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
when TrueClass, FalseClass
val.to_s.capitalize
when Array
val.join(',')
else
val.to_s
end
end | [
"def",
"format_value",
"(",
"val",
")",
"case",
"val",
"when",
"AmazonFlexPay",
"::",
"Model",
"val",
".",
"to_hash",
"when",
"Time",
"val",
".",
"utc",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%SZ'",
")",
"when",
"TrueClass",
",",
"FalseClass",
"val",
".",
... | Formats times and booleans as Amazon desires them. | [
"Formats",
"times",
"and",
"booleans",
"as",
"Amazon",
"desires",
"them",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/model.rb#L115-L132 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/model.rb | AmazonFlexPay.Model.assign | def assign(hash)
hash.each do |k, v|
send("#{k.to_s.underscore}=", v.respond_to?(:strip) ? v.strip : v)
end
end | ruby | def assign(hash)
hash.each do |k, v|
send("#{k.to_s.underscore}=", v.respond_to?(:strip) ? v.strip : v)
end
end | [
"def",
"assign",
"(",
"hash",
")",
"hash",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"send",
"(",
"\"#{k.to_s.underscore}=\"",
",",
"v",
".",
"respond_to?",
"(",
":strip",
")",
"?",
"v",
".",
"strip",
":",
"v",
")",
"end",
"end"
] | Allows easy initialization for a model by assigning attributes from a hash. | [
"Allows",
"easy",
"initialization",
"for",
"a",
"model",
"by",
"assigning",
"attributes",
"from",
"a",
"hash",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/model.rb#L135-L139 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/pipelines.rb | AmazonFlexPay.Pipelines.edit_token_pipeline | def edit_token_pipeline(caller_reference, return_url, options = {})
cbui EditToken.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | ruby | def edit_token_pipeline(caller_reference, return_url, options = {})
cbui EditToken.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | [
"def",
"edit_token_pipeline",
"(",
"caller_reference",
",",
"return_url",
",",
"options",
"=",
"{",
"}",
")",
"cbui",
"EditToken",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":caller_reference",
"=>",
"caller_reference",
",",
":return_url",
"=>",
"return_url... | Creates a pipeline that may be used to change the payment method of a token.
Note that this does not allow changing a token's limits or recipients or really anything but the method.
See http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAdvancedGuide/EditTokenPipeline.html | [
"Creates",
"a",
"pipeline",
"that",
"may",
"be",
"used",
"to",
"change",
"the",
"payment",
"method",
"of",
"a",
"token",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/pipelines.rb#L11-L13 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/pipelines.rb | AmazonFlexPay.Pipelines.multi_use_pipeline | def multi_use_pipeline(caller_reference, return_url, options = {})
cbui MultiUse.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | ruby | def multi_use_pipeline(caller_reference, return_url, options = {})
cbui MultiUse.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | [
"def",
"multi_use_pipeline",
"(",
"caller_reference",
",",
"return_url",
",",
"options",
"=",
"{",
"}",
")",
"cbui",
"MultiUse",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":caller_reference",
"=>",
"caller_reference",
",",
":return_url",
"=>",
"return_url",... | Creates a pipeline that will authorize you to send money _from_ the user multiple times.
This is also necessary to create sender tokens that are valid for a long period of time, even if
you only plan to collect from the token once.
See http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAdvancedGuide/MultiUsePipeline.html | [
"Creates",
"a",
"pipeline",
"that",
"will",
"authorize",
"you",
"to",
"send",
"money",
"_from_",
"the",
"user",
"multiple",
"times",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/pipelines.rb#L21-L23 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/pipelines.rb | AmazonFlexPay.Pipelines.recipient_pipeline | def recipient_pipeline(caller_reference, return_url, options = {})
cbui Recipient.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | ruby | def recipient_pipeline(caller_reference, return_url, options = {})
cbui Recipient.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | [
"def",
"recipient_pipeline",
"(",
"caller_reference",
",",
"return_url",
",",
"options",
"=",
"{",
"}",
")",
"cbui",
"Recipient",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":caller_reference",
"=>",
"caller_reference",
",",
":return_url",
"=>",
"return_url"... | Creates a pipeline that will authorize you to send money _to_ the user.
See http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAdvancedGuide/CBUIapiMerchant.html | [
"Creates",
"a",
"pipeline",
"that",
"will",
"authorize",
"you",
"to",
"send",
"money",
"_to_",
"the",
"user",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/pipelines.rb#L28-L30 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/pipelines.rb | AmazonFlexPay.Pipelines.single_use_pipeline | def single_use_pipeline(caller_reference, return_url, options = {})
cbui SingleUse.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | ruby | def single_use_pipeline(caller_reference, return_url, options = {})
cbui SingleUse.new(options.merge(:caller_reference => caller_reference, :return_url => return_url))
end | [
"def",
"single_use_pipeline",
"(",
"caller_reference",
",",
"return_url",
",",
"options",
"=",
"{",
"}",
")",
"cbui",
"SingleUse",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":caller_reference",
"=>",
"caller_reference",
",",
":return_url",
"=>",
"return_url... | Creates a pipeline that will authorize you to send money _from_ the user one time.
Note that if this payment fails, you must create another pipeline to get another token.
See http://docs.amazonwebservices.com/AmazonFPS/2010-08-28/FPSBasicGuide/SingleUsePipeline.html | [
"Creates",
"a",
"pipeline",
"that",
"will",
"authorize",
"you",
"to",
"send",
"money",
"_from_",
"the",
"user",
"one",
"time",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/pipelines.rb#L37-L39 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/pipelines/base.rb | AmazonFlexPay::Pipelines.Base.to_param | def to_param
params = to_hash.merge(
'callerKey' => AmazonFlexPay.access_key,
'signatureVersion' => 2,
'signatureMethod' => 'HmacSHA256'
)
params['signature'] = AmazonFlexPay.sign(AmazonFlexPay.pipeline_endpoint, params)
AmazonFlexPay::Util.query_string(params)
end | ruby | def to_param
params = to_hash.merge(
'callerKey' => AmazonFlexPay.access_key,
'signatureVersion' => 2,
'signatureMethod' => 'HmacSHA256'
)
params['signature'] = AmazonFlexPay.sign(AmazonFlexPay.pipeline_endpoint, params)
AmazonFlexPay::Util.query_string(params)
end | [
"def",
"to_param",
"params",
"=",
"to_hash",
".",
"merge",
"(",
"'callerKey'",
"=>",
"AmazonFlexPay",
".",
"access_key",
",",
"'signatureVersion'",
"=>",
"2",
",",
"'signatureMethod'",
"=>",
"'HmacSHA256'",
")",
"params",
"[",
"'signature'",
"]",
"=",
"AmazonFle... | Converts the Pipeline object into parameters and signs them. | [
"Converts",
"the",
"Pipeline",
"object",
"into",
"parameters",
"and",
"signs",
"them",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/pipelines/base.rb#L15-L23 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/api.rb | AmazonFlexPay.API.get_account_activity | def get_account_activity(start_date, end_date, options = {})
submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))
end | ruby | def get_account_activity(start_date, end_date, options = {})
submit GetAccountActivity.new(options.merge(:start_date => start_date, :end_date => end_date))
end | [
"def",
"get_account_activity",
"(",
"start_date",
",",
"end_date",
",",
"options",
"=",
"{",
"}",
")",
"submit",
"GetAccountActivity",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":start_date",
"=>",
"start_date",
",",
":end_date",
"=>",
"end_date",
")",
... | Searches through transactions on your account. Helpful if you want to compare vs your own records,
or print an admin report.
See http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAccountManagementGuide/GetAccountActivity.html | [
"Searches",
"through",
"transactions",
"on",
"your",
"account",
".",
"Helpful",
"if",
"you",
"want",
"to",
"compare",
"vs",
"your",
"own",
"records",
"or",
"print",
"an",
"admin",
"report",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/api.rb#L24-L26 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/api.rb | AmazonFlexPay.API.refund | def refund(transaction_id, caller_reference, options = {})
submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))
end | ruby | def refund(transaction_id, caller_reference, options = {})
submit Refund.new(options.merge(:transaction_id => transaction_id, :caller_reference => caller_reference))
end | [
"def",
"refund",
"(",
"transaction_id",
",",
"caller_reference",
",",
"options",
"=",
"{",
"}",
")",
"submit",
"Refund",
".",
"new",
"(",
"options",
".",
"merge",
"(",
":transaction_id",
"=>",
"transaction_id",
",",
":caller_reference",
"=>",
"caller_reference",... | Refunds a transaction. By default it will refund the entire transaction, but you can
provide an amount for partial refunds.
Sign up for Instant Payment Notifications to be told when this has finished.
See http://docs.amazonwebservices.com/AmazonFPS/latest/FPSAdvancedGuide/Refund.html | [
"Refunds",
"a",
"transaction",
".",
"By",
"default",
"it",
"will",
"refund",
"the",
"entire",
"transaction",
"but",
"you",
"can",
"provide",
"an",
"amount",
"for",
"partial",
"refunds",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/api.rb#L128-L130 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/api.rb | AmazonFlexPay.API.verify_request | def verify_request(request)
verify_signature(
# url without query string
request.protocol + request.host_with_port + request.path,
# raw parameters
request.get? ? request.query_string : request.raw_post
)
end | ruby | def verify_request(request)
verify_signature(
# url without query string
request.protocol + request.host_with_port + request.path,
# raw parameters
request.get? ? request.query_string : request.raw_post
)
end | [
"def",
"verify_request",
"(",
"request",
")",
"verify_signature",
"(",
"request",
".",
"protocol",
"+",
"request",
".",
"host_with_port",
"+",
"request",
".",
"path",
",",
"request",
".",
"get?",
"?",
"request",
".",
"query_string",
":",
"request",
".",
"raw... | This is how you verify IPNs and pipeline responses.
Pass the entire request object. | [
"This",
"is",
"how",
"you",
"verify",
"IPNs",
"and",
"pipeline",
"responses",
".",
"Pass",
"the",
"entire",
"request",
"object",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/api.rb#L143-L150 | valid |
kickstarter/amazon_flex_pay | lib/amazon_flex_pay/api.rb | AmazonFlexPay.API.submit | def submit(request)
url = request.to_url
ActiveSupport::Notifications.instrument("amazon_flex_pay.api", :action => request.action_name, :request => url) do |payload|
begin
http = RestClient.get(url)
payload[:response] = http.body
payload[:code] = http.code
response = request.class::Response.from_xml(http.body)
response.request = request
response
rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::Forbidden => e
payload[:response] = e.http_body
payload[:code] = e.http_code
er = AmazonFlexPay::API::BaseRequest::ErrorResponse.from_xml(e.response.body)
klass = AmazonFlexPay::API.const_get(er.errors.first.code)
raise klass.new(er.errors.first.code, er.errors.first.message, er.request_id, request)
end
end
end | ruby | def submit(request)
url = request.to_url
ActiveSupport::Notifications.instrument("amazon_flex_pay.api", :action => request.action_name, :request => url) do |payload|
begin
http = RestClient.get(url)
payload[:response] = http.body
payload[:code] = http.code
response = request.class::Response.from_xml(http.body)
response.request = request
response
rescue RestClient::BadRequest, RestClient::Unauthorized, RestClient::Forbidden => e
payload[:response] = e.http_body
payload[:code] = e.http_code
er = AmazonFlexPay::API::BaseRequest::ErrorResponse.from_xml(e.response.body)
klass = AmazonFlexPay::API.const_get(er.errors.first.code)
raise klass.new(er.errors.first.code, er.errors.first.message, er.request_id, request)
end
end
end | [
"def",
"submit",
"(",
"request",
")",
"url",
"=",
"request",
".",
"to_url",
"ActiveSupport",
"::",
"Notifications",
".",
"instrument",
"(",
"\"amazon_flex_pay.api\"",
",",
":action",
"=>",
"request",
".",
"action_name",
",",
":request",
"=>",
"url",
")",
"do",... | This compiles an API request object into a URL, sends it to Amazon, and processes
the response. | [
"This",
"compiles",
"an",
"API",
"request",
"object",
"into",
"a",
"URL",
"sends",
"it",
"to",
"Amazon",
"and",
"processes",
"the",
"response",
"."
] | 5a4cbc608b41858a2db2f6a44884aa4efee77c1e | https://github.com/kickstarter/amazon_flex_pay/blob/5a4cbc608b41858a2db2f6a44884aa4efee77c1e/lib/amazon_flex_pay/api.rb#L163-L185 | valid |
jsmestad/jsonapi-consumer | lib/jsonapi/consumer/resource.rb | JSONAPI::Consumer.Resource.save | def save
return false unless valid?
self.last_result_set = if persisted?
self.class.requestor.update(self)
else
self.class.requestor.create(self)
end
if last_result_set.has_errors?
fill_errors
false
else
self.errors.clear if self.errors
mark_as_persisted!
if updated = last_result_set.first
self.attributes = updated.attributes
self.links.attributes = updated.links.attributes
self.relationships.attributes = updated.relationships.attributes
clear_changes_information
end
true
end
end | ruby | def save
return false unless valid?
self.last_result_set = if persisted?
self.class.requestor.update(self)
else
self.class.requestor.create(self)
end
if last_result_set.has_errors?
fill_errors
false
else
self.errors.clear if self.errors
mark_as_persisted!
if updated = last_result_set.first
self.attributes = updated.attributes
self.links.attributes = updated.links.attributes
self.relationships.attributes = updated.relationships.attributes
clear_changes_information
end
true
end
end | [
"def",
"save",
"return",
"false",
"unless",
"valid?",
"self",
".",
"last_result_set",
"=",
"if",
"persisted?",
"self",
".",
"class",
".",
"requestor",
".",
"update",
"(",
"self",
")",
"else",
"self",
".",
"class",
".",
"requestor",
".",
"create",
"(",
"s... | Commit the current changes to the resource to the remote server.
If the resource was previously loaded from the server, we will
try to update the record. Otherwise if it's a new record, then
we will try to create it
@return [Boolean] Whether or not the save succeeded | [
"Commit",
"the",
"current",
"changes",
"to",
"the",
"resource",
"to",
"the",
"remote",
"server",
".",
"If",
"the",
"resource",
"was",
"previously",
"loaded",
"from",
"the",
"server",
"we",
"will",
"try",
"to",
"update",
"the",
"record",
".",
"Otherwise",
"... | 6ba07d613c4e1fc2bbac3ac26f89241e82cf1551 | https://github.com/jsmestad/jsonapi-consumer/blob/6ba07d613c4e1fc2bbac3ac26f89241e82cf1551/lib/jsonapi/consumer/resource.rb#L439-L462 | valid |
jsmestad/jsonapi-consumer | lib/jsonapi/consumer/resource.rb | JSONAPI::Consumer.Resource.destroy | def destroy
self.last_result_set = self.class.requestor.destroy(self)
if last_result_set.has_errors?
fill_errors
false
else
self.attributes.clear
true
end
end | ruby | def destroy
self.last_result_set = self.class.requestor.destroy(self)
if last_result_set.has_errors?
fill_errors
false
else
self.attributes.clear
true
end
end | [
"def",
"destroy",
"self",
".",
"last_result_set",
"=",
"self",
".",
"class",
".",
"requestor",
".",
"destroy",
"(",
"self",
")",
"if",
"last_result_set",
".",
"has_errors?",
"fill_errors",
"false",
"else",
"self",
".",
"attributes",
".",
"clear",
"true",
"en... | Try to destroy this resource
@return [Boolean] Whether or not the destroy succeeded | [
"Try",
"to",
"destroy",
"this",
"resource"
] | 6ba07d613c4e1fc2bbac3ac26f89241e82cf1551 | https://github.com/jsmestad/jsonapi-consumer/blob/6ba07d613c4e1fc2bbac3ac26f89241e82cf1551/lib/jsonapi/consumer/resource.rb#L467-L476 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.redi_search_schema | def redi_search_schema(schema)
@schema = schema.to_a.flatten
@fields = schema.keys
@model = self.name.constantize
@index_name = @model.to_s
@score = 1
end | ruby | def redi_search_schema(schema)
@schema = schema.to_a.flatten
@fields = schema.keys
@model = self.name.constantize
@index_name = @model.to_s
@score = 1
end | [
"def",
"redi_search_schema",
"(",
"schema",
")",
"@schema",
"=",
"schema",
".",
"to_a",
".",
"flatten",
"@fields",
"=",
"schema",
".",
"keys",
"@model",
"=",
"self",
".",
"name",
".",
"constantize",
"@index_name",
"=",
"@model",
".",
"to_s",
"@score",
"=",... | will configure the RediSearch for the specific model
@see https://github.com/dmitrypol/redi_search_rails
@param schema [Hash] name: 'TEXT', age: 'NUMERIC' | [
"will",
"configure",
"the",
"RediSearch",
"for",
"the",
"specific",
"model"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L17-L23 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_search_count | def ft_search_count(args)
ft_search(args).first
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_search_count(args)
ft_search(args).first
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_search_count",
"(",
"args",
")",
"ft_search",
"(",
"args",
")",
".",
"first",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",
"Rails",
"return",
"e",
".",
"message",
"end"
] | number of records found for keywords
@param keyword [Hash] keyword that gets passed to ft_search
@return [Integer] number of results matching the search | [
"number",
"of",
"records",
"found",
"for",
"keywords"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L79-L84 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_add_all | def ft_add_all
@model.all.each {|record| ft_add(record: record) }
ft_optimize
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_add_all
@model.all.each {|record| ft_add(record: record) }
ft_optimize
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_add_all",
"@model",
".",
"all",
".",
"each",
"{",
"|",
"record",
"|",
"ft_add",
"(",
"record",
":",
"record",
")",
"}",
"ft_optimize",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",
"Rails",
"r... | index all records in specific model
@return [String] | [
"index",
"all",
"records",
"in",
"specific",
"model"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L103-L109 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_add | def ft_add record:
fields = []
@fields.each { |field| fields.push(field, record.send(field)) }
REDI_SEARCH.call('FT.ADD', @index_name, record.to_global_id.to_s, @score,
'REPLACE',
'FIELDS', fields
#'NOSAVE', 'PAYLOAD', 'LANGUAGE'
)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_add record:
fields = []
@fields.each { |field| fields.push(field, record.send(field)) }
REDI_SEARCH.call('FT.ADD', @index_name, record.to_global_id.to_s, @score,
'REPLACE',
'FIELDS', fields
#'NOSAVE', 'PAYLOAD', 'LANGUAGE'
)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_add",
"record",
":",
"fields",
"=",
"[",
"]",
"@fields",
".",
"each",
"{",
"|",
"field",
"|",
"fields",
".",
"push",
"(",
"field",
",",
"record",
".",
"send",
"(",
"field",
")",
")",
"}",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.ADD'",
",",... | index specific record
@param record [Object] Object to index
@return [String] | [
"index",
"specific",
"record"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L115-L126 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_addhash | def ft_addhash redis_key:
REDI_SEARCH.call('FT.ADDHASH', @index_name, redis_key, @score, 'REPLACE')
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_addhash redis_key:
REDI_SEARCH.call('FT.ADDHASH', @index_name, redis_key, @score, 'REPLACE')
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_addhash",
"redis_key",
":",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.ADDHASH'",
",",
"@index_name",
",",
"redis_key",
",",
"@score",
",",
"'REPLACE'",
")",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",... | index existing Hash
@param record [string] key of existing HASH key in Redis that will hold the fields the index needs.
@return [String] | [
"index",
"existing",
"Hash"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L132-L137 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_del_all | def ft_del_all
@model.all.each {|record| ft_del(record: record) }
ft_optimize
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_del_all
@model.all.each {|record| ft_del(record: record) }
ft_optimize
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_del_all",
"@model",
".",
"all",
".",
"each",
"{",
"|",
"record",
"|",
"ft_del",
"(",
"record",
":",
"record",
")",
"}",
"ft_optimize",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",
"Rails",
"r... | delete all records in specific model
@return [String] | [
"delete",
"all",
"records",
"in",
"specific",
"model"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L142-L148 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_del | def ft_del record:
doc_id = record.to_global_id
REDI_SEARCH.call('FT.DEL', @index_name, doc_id)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_del record:
doc_id = record.to_global_id
REDI_SEARCH.call('FT.DEL', @index_name, doc_id)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_del",
"record",
":",
"doc_id",
"=",
"record",
".",
"to_global_id",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.DEL'",
",",
"@index_name",
",",
"doc_id",
")",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?"... | delete specific document from index
@param record [Object] Object to delete
@return [String] | [
"delete",
"specific",
"document",
"from",
"index"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L154-L160 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_info | def ft_info
REDI_SEARCH.call('FT.INFO', @index_name)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_info
REDI_SEARCH.call('FT.INFO', @index_name)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_info",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.INFO'",
",",
"@index_name",
")",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",
"Rails",
"return",
"e",
".",
"message",
"end"
] | get info about specific index
@return [String] | [
"get",
"info",
"about",
"specific",
"index"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L185-L190 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_sugadd_all | def ft_sugadd_all (attribute:)
@model.all.each {|record| ft_sugadd(record: record, attribute: attribute) }
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_sugadd_all (attribute:)
@model.all.each {|record| ft_sugadd(record: record, attribute: attribute) }
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_sugadd_all",
"(",
"attribute",
":",
")",
"@model",
".",
"all",
".",
"each",
"{",
"|",
"record",
"|",
"ft_sugadd",
"(",
"record",
":",
"record",
",",
"attribute",
":",
"attribute",
")",
"}",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"lo... | add all values for a model attribute to autocomplete
@param attribute [String] - name, email, etc | [
"add",
"all",
"values",
"for",
"a",
"model",
"attribute",
"to",
"autocomplete"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L195-L200 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_sugadd | def ft_sugadd (record:, attribute:, score: 1)
# => combine model with attribute to create unique key like user_name
key = "#{@model.to_s}:#{attribute}"
string = record.send(attribute)
REDI_SEARCH.call('FT.SUGADD', key, string, score)
# => INCR
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_sugadd (record:, attribute:, score: 1)
# => combine model with attribute to create unique key like user_name
key = "#{@model.to_s}:#{attribute}"
string = record.send(attribute)
REDI_SEARCH.call('FT.SUGADD', key, string, score)
# => INCR
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_sugadd",
"(",
"record",
":",
",",
"attribute",
":",
",",
"score",
":",
"1",
")",
"key",
"=",
"\"#{@model.to_s}:#{attribute}\"",
"string",
"=",
"record",
".",
"send",
"(",
"attribute",
")",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.SUGADD'",
",",
"ke... | add string to autocomplete dictionary
@param record [Object] object
@param attribute [String] - name, email, etc
@param score [Integer] - score
@return [Integer] - current size of the dictionary | [
"add",
"string",
"to",
"autocomplete",
"dictionary"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L208-L217 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_sugget | def ft_sugget (attribute:, prefix:)
key = "#{@model}:#{attribute}"
REDI_SEARCH.call('FT.SUGGET', key, prefix)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_sugget (attribute:, prefix:)
key = "#{@model}:#{attribute}"
REDI_SEARCH.call('FT.SUGGET', key, prefix)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_sugget",
"(",
"attribute",
":",
",",
"prefix",
":",
")",
"key",
"=",
"\"#{@model}:#{attribute}\"",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.SUGGET'",
",",
"key",
",",
"prefix",
")",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"er... | query dictionary for suggestion
@param attribute [String] - name, email, etc
@param prefix [String] - prefix to query dictionary
@return [Array] - suggestions for prefix | [
"query",
"dictionary",
"for",
"suggestion"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L224-L230 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_sugdel_all | def ft_sugdel_all (attribute:)
@model.all.each {|record| ft_sugdel(record: record, attribute: attribute) }
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_sugdel_all (attribute:)
@model.all.each {|record| ft_sugdel(record: record, attribute: attribute) }
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_sugdel_all",
"(",
"attribute",
":",
")",
"@model",
".",
"all",
".",
"each",
"{",
"|",
"record",
"|",
"ft_sugdel",
"(",
"record",
":",
"record",
",",
"attribute",
":",
"attribute",
")",
"}",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"lo... | delete all values for a model attribute to autocomplete
@param attribute [String] - name, email, etc | [
"delete",
"all",
"values",
"for",
"a",
"model",
"attribute",
"to",
"autocomplete"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L235-L240 | valid |
dmitrypol/redi_search_rails | lib/redi_search_rails.rb | RediSearchRails.ClassMethods.ft_suglen | def ft_suglen (attribute:)
key = "#{@model}:#{attribute}"
REDI_SEARCH.call('FT.SUGLEN', key)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | ruby | def ft_suglen (attribute:)
key = "#{@model}:#{attribute}"
REDI_SEARCH.call('FT.SUGLEN', key)
rescue Exception => e
Rails.logger.error e if defined? Rails
return e.message
end | [
"def",
"ft_suglen",
"(",
"attribute",
":",
")",
"key",
"=",
"\"#{@model}:#{attribute}\"",
"REDI_SEARCH",
".",
"call",
"(",
"'FT.SUGLEN'",
",",
"key",
")",
"rescue",
"Exception",
"=>",
"e",
"Rails",
".",
"logger",
".",
"error",
"e",
"if",
"defined?",
"Rails",... | size of dictionary
@param attribute [String]
@return [Integer] - number of possible suggestions | [
"size",
"of",
"dictionary"
] | 3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6 | https://github.com/dmitrypol/redi_search_rails/blob/3f08a4a5a3c9e32c0d8b7007bc13a76cbc82d7e6/lib/redi_search_rails.rb#L260-L266 | valid |
realityforge/zapwhite | lib/reality/zapwhite.rb | Reality.Zapwhite.run | def run
normalize_count = 0
if generate_gitattributes?
output_options = {:prefix => '# DO NOT EDIT: File is auto-generated', :normalize => true}
new_gitattributes = generate_gitattributes!
new_content = new_gitattributes.as_file_contents(output_options)
old_content = File.exist?(@attributes.attributes_file) ? IO.read(@attributes.attributes_file) : nil
if new_content != old_content
@attributes = new_gitattributes
if check_only?
puts 'Non-normalized .gitattributes file'
else
puts 'Fixing: .gitattributes'
@attributes.write(output_options)
end
normalize_count += 1
end
end
files = {}
collect_file_attributes(files)
files.each_pair do |filename, config|
full_filename = "#{@base_directory}/#{filename}"
original_bin_content = File.binread(full_filename)
encoding = config[:encoding].nil? ? 'utf-8' : config[:encoding].gsub(/^UTF/,'utf-')
content = File.read(full_filename, :encoding => "bom|#{encoding}")
content =
config[:dos] ?
clean_dos_whitespace(filename, content, config[:eofnl], config[:allow_empty]) :
clean_whitespace(filename, content, config[:eofnl], config[:allow_empty])
if config[:nodupnl]
while content.gsub!(/\n\n\n/, "\n\n")
# Keep removing duplicate new lines till they have gone
end
end
if content.bytes != original_bin_content.bytes
normalize_count += 1
if check_only?
puts "Non-normalized whitespace in #{filename}"
else
puts "Fixing: #{filename}"
File.open(full_filename, 'wb') do |out|
out.write content
end
end
end
end
normalize_count
end | ruby | def run
normalize_count = 0
if generate_gitattributes?
output_options = {:prefix => '# DO NOT EDIT: File is auto-generated', :normalize => true}
new_gitattributes = generate_gitattributes!
new_content = new_gitattributes.as_file_contents(output_options)
old_content = File.exist?(@attributes.attributes_file) ? IO.read(@attributes.attributes_file) : nil
if new_content != old_content
@attributes = new_gitattributes
if check_only?
puts 'Non-normalized .gitattributes file'
else
puts 'Fixing: .gitattributes'
@attributes.write(output_options)
end
normalize_count += 1
end
end
files = {}
collect_file_attributes(files)
files.each_pair do |filename, config|
full_filename = "#{@base_directory}/#{filename}"
original_bin_content = File.binread(full_filename)
encoding = config[:encoding].nil? ? 'utf-8' : config[:encoding].gsub(/^UTF/,'utf-')
content = File.read(full_filename, :encoding => "bom|#{encoding}")
content =
config[:dos] ?
clean_dos_whitespace(filename, content, config[:eofnl], config[:allow_empty]) :
clean_whitespace(filename, content, config[:eofnl], config[:allow_empty])
if config[:nodupnl]
while content.gsub!(/\n\n\n/, "\n\n")
# Keep removing duplicate new lines till they have gone
end
end
if content.bytes != original_bin_content.bytes
normalize_count += 1
if check_only?
puts "Non-normalized whitespace in #{filename}"
else
puts "Fixing: #{filename}"
File.open(full_filename, 'wb') do |out|
out.write content
end
end
end
end
normalize_count
end | [
"def",
"run",
"normalize_count",
"=",
"0",
"if",
"generate_gitattributes?",
"output_options",
"=",
"{",
":prefix",
"=>",
"'# DO NOT EDIT: File is auto-generated'",
",",
":normalize",
"=>",
"true",
"}",
"new_gitattributes",
"=",
"generate_gitattributes!",
"new_content",
"=... | Run normalization process across directory.
Return the number of files that need normalization | [
"Run",
"normalization",
"process",
"across",
"directory",
".",
"Return",
"the",
"number",
"of",
"files",
"that",
"need",
"normalization"
] | d34a56d4ca574c679dd8aad8a315e21093db86a5 | https://github.com/realityforge/zapwhite/blob/d34a56d4ca574c679dd8aad8a315e21093db86a5/lib/reality/zapwhite.rb#L49-L104 | valid |
realityforge/zapwhite | lib/reality/zapwhite.rb | Reality.Zapwhite.in_dir | def in_dir(dir, &block)
original_dir = Dir.pwd
begin
Dir.chdir(dir)
block.call
ensure
Dir.chdir(original_dir)
end
end | ruby | def in_dir(dir, &block)
original_dir = Dir.pwd
begin
Dir.chdir(dir)
block.call
ensure
Dir.chdir(original_dir)
end
end | [
"def",
"in_dir",
"(",
"dir",
",",
"&",
"block",
")",
"original_dir",
"=",
"Dir",
".",
"pwd",
"begin",
"Dir",
".",
"chdir",
"(",
"dir",
")",
"block",
".",
"call",
"ensure",
"Dir",
".",
"chdir",
"(",
"original_dir",
")",
"end",
"end"
] | Evaluate block after changing directory to specified directory | [
"Evaluate",
"block",
"after",
"changing",
"directory",
"to",
"specified",
"directory"
] | d34a56d4ca574c679dd8aad8a315e21093db86a5 | https://github.com/realityforge/zapwhite/blob/d34a56d4ca574c679dd8aad8a315e21093db86a5/lib/reality/zapwhite.rb#L186-L194 | valid |
aptible/fridge | lib/fridge/rails_helpers.rb | Fridge.RailsHelpers.validate_token | def validate_token(access_token)
validator = Fridge.configuration.validator
validator.call(access_token) && access_token
rescue
false
end | ruby | def validate_token(access_token)
validator = Fridge.configuration.validator
validator.call(access_token) && access_token
rescue
false
end | [
"def",
"validate_token",
"(",
"access_token",
")",
"validator",
"=",
"Fridge",
".",
"configuration",
".",
"validator",
"validator",
".",
"call",
"(",
"access_token",
")",
"&&",
"access_token",
"rescue",
"false",
"end"
] | Validates token, and returns the token, or nil | [
"Validates",
"token",
"and",
"returns",
"the",
"token",
"or",
"nil"
] | e93ac76d75228d2e5a15851f5ac7ab99b20c94fe | https://github.com/aptible/fridge/blob/e93ac76d75228d2e5a15851f5ac7ab99b20c94fe/lib/fridge/rails_helpers.rb#L52-L57 | valid |
aptible/fridge | lib/fridge/rails_helpers.rb | Fridge.RailsHelpers.validate_token! | def validate_token!(access_token)
validator = Fridge.configuration.validator
if validator.call(access_token)
access_token
else
raise InvalidToken, 'Rejected by validator'
end
end | ruby | def validate_token!(access_token)
validator = Fridge.configuration.validator
if validator.call(access_token)
access_token
else
raise InvalidToken, 'Rejected by validator'
end
end | [
"def",
"validate_token!",
"(",
"access_token",
")",
"validator",
"=",
"Fridge",
".",
"configuration",
".",
"validator",
"if",
"validator",
".",
"call",
"(",
"access_token",
")",
"access_token",
"else",
"raise",
"InvalidToken",
",",
"'Rejected by validator'",
"end",
... | Validates token, and raises an exception if invalid | [
"Validates",
"token",
"and",
"raises",
"an",
"exception",
"if",
"invalid"
] | e93ac76d75228d2e5a15851f5ac7ab99b20c94fe | https://github.com/aptible/fridge/blob/e93ac76d75228d2e5a15851f5ac7ab99b20c94fe/lib/fridge/rails_helpers.rb#L60-L67 | valid |
campaignmonitor/createsend-ruby | lib/createsend/subscriber.rb | CreateSend.Subscriber.update | def update(new_email_address, name, custom_fields, resubscribe,
consent_to_track, restart_subscription_based_autoresponders=false)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name,
:CustomFields => custom_fields,
:Resubscribe => resubscribe,
:RestartSubscriptionBasedAutoresponders =>
restart_subscription_based_autoresponders,
:ConsentToTrack => consent_to_track }.to_json }
put "/subscribers/#{@list_id}.json", options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | ruby | def update(new_email_address, name, custom_fields, resubscribe,
consent_to_track, restart_subscription_based_autoresponders=false)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name,
:CustomFields => custom_fields,
:Resubscribe => resubscribe,
:RestartSubscriptionBasedAutoresponders =>
restart_subscription_based_autoresponders,
:ConsentToTrack => consent_to_track }.to_json }
put "/subscribers/#{@list_id}.json", options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | [
"def",
"update",
"(",
"new_email_address",
",",
"name",
",",
"custom_fields",
",",
"resubscribe",
",",
"consent_to_track",
",",
"restart_subscription_based_autoresponders",
"=",
"false",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"@email_address"... | Updates any aspect of a subscriber, including email address, name, and
custom field data if supplied. | [
"Updates",
"any",
"aspect",
"of",
"a",
"subscriber",
"including",
"email",
"address",
"name",
"and",
"custom",
"field",
"data",
"if",
"supplied",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/subscriber.rb#L72-L87 | valid |
campaignmonitor/createsend-ruby | lib/createsend/subscriber.rb | CreateSend.Subscriber.history | def history
options = { :query => { :email => @email_address } }
response = cs_get "/subscribers/#{@list_id}/history.json", options
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def history
options = { :query => { :email => @email_address } }
response = cs_get "/subscribers/#{@list_id}/history.json", options
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"history",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"@email_address",
"}",
"}",
"response",
"=",
"cs_get",
"\"/subscribers/#{@list_id}/history.json\"",
",",
"options",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash... | Gets the historical record of this subscriber's trackable actions. | [
"Gets",
"the",
"historical",
"record",
"of",
"this",
"subscriber",
"s",
"trackable",
"actions",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/subscriber.rb#L97-L101 | valid |
campaignmonitor/createsend-ruby | lib/createsend/segment.rb | CreateSend.Segment.subscribers | def subscribers(date="", page=1, page_size=1000, order_field="email",
order_direction="asc", include_tracking_preference=false)
options = { :query => {
:date => date,
:page => page,
:pagesize => page_size,
:orderfield => order_field,
:orderdirection => order_direction,
:includetrackingpreference => include_tracking_preference } }
response = get "active", options
Hashie::Mash.new(response)
end | ruby | def subscribers(date="", page=1, page_size=1000, order_field="email",
order_direction="asc", include_tracking_preference=false)
options = { :query => {
:date => date,
:page => page,
:pagesize => page_size,
:orderfield => order_field,
:orderdirection => order_direction,
:includetrackingpreference => include_tracking_preference } }
response = get "active", options
Hashie::Mash.new(response)
end | [
"def",
"subscribers",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
",",
"include_tracking_preference",
"=",
"false",
")",
"options",
"=",
"{",
... | Gets the active subscribers in this segment. | [
"Gets",
"the",
"active",
"subscribers",
"in",
"this",
"segment",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/segment.rb#L37-L48 | valid |
campaignmonitor/createsend-ruby | lib/createsend/template.rb | CreateSend.Template.update | def update(name, html_url, zip_url)
options = { :body => {
:Name => name,
:HtmlPageURL => html_url,
:ZipFileURL => zip_url }.to_json }
put "/templates/#{template_id}.json", options
end | ruby | def update(name, html_url, zip_url)
options = { :body => {
:Name => name,
:HtmlPageURL => html_url,
:ZipFileURL => zip_url }.to_json }
put "/templates/#{template_id}.json", options
end | [
"def",
"update",
"(",
"name",
",",
"html_url",
",",
"zip_url",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":Name",
"=>",
"name",
",",
":HtmlPageURL",
"=>",
"html_url",
",",
":ZipFileURL",
"=>",
"zip_url",
"}",
".",
"to_json",
"}",
"put",
"\"/templates... | Updates this email template. | [
"Updates",
"this",
"email",
"template",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/template.rb#L29-L35 | valid |
campaignmonitor/createsend-ruby | lib/createsend/createsend.rb | CreateSend.CreateSend.clients | def clients
response = get('/clients.json')
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def clients
response = get('/clients.json')
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"clients",
"response",
"=",
"get",
"(",
"'/clients.json'",
")",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets your clients. | [
"Gets",
"your",
"clients",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/createsend.rb#L143-L146 | valid |
campaignmonitor/createsend-ruby | lib/createsend/createsend.rb | CreateSend.CreateSend.administrators | def administrators
response = get('/admins.json')
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def administrators
response = get('/admins.json')
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"administrators",
"response",
"=",
"get",
"(",
"'/admins.json'",
")",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the administrators for the account. | [
"Gets",
"the",
"administrators",
"for",
"the",
"account",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/createsend.rb#L173-L176 | valid |
campaignmonitor/createsend-ruby | lib/createsend/createsend.rb | CreateSend.CreateSend.set_primary_contact | def set_primary_contact(email)
options = { :query => { :email => email } }
response = put("/primarycontact.json", options)
Hashie::Mash.new(response)
end | ruby | def set_primary_contact(email)
options = { :query => { :email => email } }
response = put("/primarycontact.json", options)
Hashie::Mash.new(response)
end | [
"def",
"set_primary_contact",
"(",
"email",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"email",
"}",
"}",
"response",
"=",
"put",
"(",
"\"/primarycontact.json\"",
",",
"options",
")",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"response",... | Set the primary contect for the account. | [
"Set",
"the",
"primary",
"contect",
"for",
"the",
"account",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/createsend.rb#L185-L189 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.create_custom_field | def create_custom_field(field_name, data_type, options=[],
visible_in_preference_center=true)
options = { :body => {
:FieldName => field_name,
:DataType => data_type,
:Options => options,
:VisibleInPreferenceCenter => visible_in_preference_center }.to_json }
response = post "customfields", options
response.parsed_response
end | ruby | def create_custom_field(field_name, data_type, options=[],
visible_in_preference_center=true)
options = { :body => {
:FieldName => field_name,
:DataType => data_type,
:Options => options,
:VisibleInPreferenceCenter => visible_in_preference_center }.to_json }
response = post "customfields", options
response.parsed_response
end | [
"def",
"create_custom_field",
"(",
"field_name",
",",
"data_type",
",",
"options",
"=",
"[",
"]",
",",
"visible_in_preference_center",
"=",
"true",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":FieldName",
"=>",
"field_name",
",",
":DataType",
"=>",
"data_ty... | Creates a new custom field for this list.
field_name - String representing the name to be given to the field
data_type - String representing the data type of the field. Valid data
types are 'Text', 'Number', 'MultiSelectOne', 'MultiSelectMany',
'Date', 'Country', and 'USState'.
options - Array of Strings representing the options for the field if it
is of type 'MultiSelectOne' or 'MultiSelectMany'.
visible_in_preference_center - Boolean indicating whether or not the
field should be visible in the subscriber preference center | [
"Creates",
"a",
"new",
"custom",
"field",
"for",
"this",
"list",
".",
"field_name",
"-",
"String",
"representing",
"the",
"name",
"to",
"be",
"given",
"to",
"the",
"field",
"data_type",
"-",
"String",
"representing",
"the",
"data",
"type",
"of",
"the",
"fi... | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L51-L60 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.update_custom_field | def update_custom_field(custom_field_key, field_name,
visible_in_preference_center)
custom_field_key = CGI.escape(custom_field_key)
options = { :body => {
:FieldName => field_name,
:VisibleInPreferenceCenter => visible_in_preference_center }.to_json }
response = put "customfields/#{custom_field_key}", options
response.parsed_response
end | ruby | def update_custom_field(custom_field_key, field_name,
visible_in_preference_center)
custom_field_key = CGI.escape(custom_field_key)
options = { :body => {
:FieldName => field_name,
:VisibleInPreferenceCenter => visible_in_preference_center }.to_json }
response = put "customfields/#{custom_field_key}", options
response.parsed_response
end | [
"def",
"update_custom_field",
"(",
"custom_field_key",
",",
"field_name",
",",
"visible_in_preference_center",
")",
"custom_field_key",
"=",
"CGI",
".",
"escape",
"(",
"custom_field_key",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":FieldName",
"=>",
"field_name"... | Updates a custom field belonging to this list.
custom_field_key - String which represents the key for the custom field
field_name - String representing the name to be given to the field
visible_in_preference_center - Boolean indicating whether or not the
field should be visible in the subscriber preference center | [
"Updates",
"a",
"custom",
"field",
"belonging",
"to",
"this",
"list",
".",
"custom_field_key",
"-",
"String",
"which",
"represents",
"the",
"key",
"for",
"the",
"custom",
"field",
"field_name",
"-",
"String",
"representing",
"the",
"name",
"to",
"be",
"given",... | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L67-L75 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.update_custom_field_options | def update_custom_field_options(custom_field_key, new_options,
keep_existing_options)
custom_field_key = CGI.escape(custom_field_key)
options = { :body => {
:Options => new_options,
:KeepExistingOptions => keep_existing_options }.to_json }
put "customfields/#{custom_field_key}/options", options
end | ruby | def update_custom_field_options(custom_field_key, new_options,
keep_existing_options)
custom_field_key = CGI.escape(custom_field_key)
options = { :body => {
:Options => new_options,
:KeepExistingOptions => keep_existing_options }.to_json }
put "customfields/#{custom_field_key}/options", options
end | [
"def",
"update_custom_field_options",
"(",
"custom_field_key",
",",
"new_options",
",",
"keep_existing_options",
")",
"custom_field_key",
"=",
"CGI",
".",
"escape",
"(",
"custom_field_key",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":Options",
"=>",
"new_options... | Updates the options of a multi-optioned custom field on this list. | [
"Updates",
"the",
"options",
"of",
"a",
"multi",
"-",
"optioned",
"custom",
"field",
"on",
"this",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L84-L91 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.custom_fields | def custom_fields
response = get "customfields"
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def custom_fields
response = get "customfields"
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"custom_fields",
"response",
"=",
"get",
"\"customfields\"",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the custom fields for this list. | [
"Gets",
"the",
"custom",
"fields",
"for",
"this",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L100-L103 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.segments | def segments
response = get "segments"
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def segments
response = get "segments"
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"segments",
"response",
"=",
"get",
"\"segments\"",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the segments for this list. | [
"Gets",
"the",
"segments",
"for",
"this",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L106-L109 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.active | def active(date="", page=1, page_size=1000, order_field="email",
order_direction="asc", include_tracking_preference=false)
paged_result_by_date("active", date, page, page_size, order_field,
order_direction, include_tracking_preference)
end | ruby | def active(date="", page=1, page_size=1000, order_field="email",
order_direction="asc", include_tracking_preference=false)
paged_result_by_date("active", date, page, page_size, order_field,
order_direction, include_tracking_preference)
end | [
"def",
"active",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
",",
"include_tracking_preference",
"=",
"false",
")",
"paged_result_by_date",
"(",
... | Gets the active subscribers for this list. | [
"Gets",
"the",
"active",
"subscribers",
"for",
"this",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L118-L122 | valid |
campaignmonitor/createsend-ruby | lib/createsend/list.rb | CreateSend.List.webhooks | def webhooks
response = get "webhooks"
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def webhooks
response = get "webhooks"
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"webhooks",
"response",
"=",
"get",
"\"webhooks\"",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the webhooks for this list. | [
"Gets",
"the",
"webhooks",
"for",
"this",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/list.rb#L184-L187 | valid |
campaignmonitor/createsend-ruby | lib/createsend/person.rb | CreateSend.Person.update | def update(new_email_address, name, access_level, password)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name,
:AccessLevel => access_level,
:Password => password }.to_json }
put uri_for(client_id), options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | ruby | def update(new_email_address, name, access_level, password)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name,
:AccessLevel => access_level,
:Password => password }.to_json }
put uri_for(client_id), options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | [
"def",
"update",
"(",
"new_email_address",
",",
"name",
",",
"access_level",
",",
"password",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"@email_address",
"}",
",",
":body",
"=>",
"{",
":EmailAddress",
"=>",
"new_email_address",
",",
":Na... | Updates the person details. password is optional and will only be
updated if supplied | [
"Updates",
"the",
"person",
"details",
".",
"password",
"is",
"optional",
"and",
"will",
"only",
"be",
"updated",
"if",
"supplied"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/person.rb#L36-L47 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.campaigns | def campaigns
response = get 'campaigns'
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def campaigns
response = get 'campaigns'
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"campaigns",
"response",
"=",
"get",
"'campaigns'",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the sent campaigns belonging to this client. | [
"Gets",
"the",
"sent",
"campaigns",
"belonging",
"to",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L28-L31 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.scheduled | def scheduled
response = get 'scheduled'
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def scheduled
response = get 'scheduled'
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"scheduled",
"response",
"=",
"get",
"'scheduled'",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the currently scheduled campaigns belonging to this client. | [
"Gets",
"the",
"currently",
"scheduled",
"campaigns",
"belonging",
"to",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L34-L37 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.drafts | def drafts
response = get 'drafts'
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def drafts
response = get 'drafts'
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"drafts",
"response",
"=",
"get",
"'drafts'",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the draft campaigns belonging to this client. | [
"Gets",
"the",
"draft",
"campaigns",
"belonging",
"to",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L40-L43 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.lists | def lists
response = get 'lists'
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def lists
response = get 'lists'
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"lists",
"response",
"=",
"get",
"'lists'",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the subscriber lists belonging to this client. | [
"Gets",
"the",
"subscriber",
"lists",
"belonging",
"to",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L46-L49 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.lists_for_email | def lists_for_email(email_address)
options = { :query => { :email => email_address } }
response = get 'listsforemail', options
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def lists_for_email(email_address)
options = { :query => { :email => email_address } }
response = get 'listsforemail', options
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"lists_for_email",
"(",
"email_address",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"email_address",
"}",
"}",
"response",
"=",
"get",
"'listsforemail'",
",",
"options",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
":... | Gets the lists across a client, to which a subscriber with a particular
email address belongs.
email_address - A String representing the subcriber's email address | [
"Gets",
"the",
"lists",
"across",
"a",
"client",
"to",
"which",
"a",
"subscriber",
"with",
"a",
"particular",
"email",
"address",
"belongs",
".",
"email_address",
"-",
"A",
"String",
"representing",
"the",
"subcriber",
"s",
"email",
"address"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L54-L58 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.people | def people
response = get "people"
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def people
response = get "people"
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"people",
"response",
"=",
"get",
"\"people\"",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the people associated with this client | [
"Gets",
"the",
"people",
"associated",
"with",
"this",
"client"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L67-L70 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.suppressionlist | def suppressionlist(page=1, page_size=1000, order_field="email",
order_direction="asc")
options = { :query => {
:page => page,
:pagesize => page_size,
:orderfield => order_field,
:orderdirection => order_direction } }
response = get 'suppressionlist', options
Hashie::Mash.new(response)
end | ruby | def suppressionlist(page=1, page_size=1000, order_field="email",
order_direction="asc")
options = { :query => {
:page => page,
:pagesize => page_size,
:orderfield => order_field,
:orderdirection => order_direction } }
response = get 'suppressionlist', options
Hashie::Mash.new(response)
end | [
"def",
"suppressionlist",
"(",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"email\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":page",
"=>",
"page",
",",
":pagesize",
"=>",
"p... | Gets this client's suppression list. | [
"Gets",
"this",
"client",
"s",
"suppression",
"list",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L84-L93 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.suppress | def suppress(emails)
options = { :body => {
:EmailAddresses => emails.kind_of?(String) ?
[ emails ] : emails }.to_json }
post "suppress", options
end | ruby | def suppress(emails)
options = { :body => {
:EmailAddresses => emails.kind_of?(String) ?
[ emails ] : emails }.to_json }
post "suppress", options
end | [
"def",
"suppress",
"(",
"emails",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":EmailAddresses",
"=>",
"emails",
".",
"kind_of?",
"(",
"String",
")",
"?",
"[",
"emails",
"]",
":",
"emails",
"}",
".",
"to_json",
"}",
"post",
"\"suppress\"",
",",
"opti... | Adds email addresses to a client's suppression list | [
"Adds",
"email",
"addresses",
"to",
"a",
"client",
"s",
"suppression",
"list"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L96-L101 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.templates | def templates
response = get 'templates'
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def templates
response = get 'templates'
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"templates",
"response",
"=",
"get",
"'templates'",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the templates belonging to this client. | [
"Gets",
"the",
"templates",
"belonging",
"to",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L111-L114 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.set_basics | def set_basics(company, timezone, country)
options = { :body => {
:CompanyName => company,
:TimeZone => timezone,
:Country => country }.to_json }
put 'setbasics', options
end | ruby | def set_basics(company, timezone, country)
options = { :body => {
:CompanyName => company,
:TimeZone => timezone,
:Country => country }.to_json }
put 'setbasics', options
end | [
"def",
"set_basics",
"(",
"company",
",",
"timezone",
",",
"country",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":CompanyName",
"=>",
"company",
",",
":TimeZone",
"=>",
"timezone",
",",
":Country",
"=>",
"country",
"}",
".",
"to_json",
"}",
"put",
"'... | Sets the basic details for this client. | [
"Sets",
"the",
"basic",
"details",
"for",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L117-L123 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.set_payg_billing | def set_payg_billing(currency, can_purchase_credits, client_pays,
markup_percentage, markup_on_delivery=0, markup_per_recipient=0,
markup_on_design_spam_test=0)
options = { :body => {
:Currency => currency,
:CanPurchaseCredits => can_purchase_credits,
:ClientPays => client_pays,
:MarkupPercentage => markup_percentage,
:MarkupOnDelivery => markup_on_delivery,
:MarkupPerRecipient => markup_per_recipient,
:MarkupOnDesignSpamTest => markup_on_design_spam_test }.to_json }
put 'setpaygbilling', options
end | ruby | def set_payg_billing(currency, can_purchase_credits, client_pays,
markup_percentage, markup_on_delivery=0, markup_per_recipient=0,
markup_on_design_spam_test=0)
options = { :body => {
:Currency => currency,
:CanPurchaseCredits => can_purchase_credits,
:ClientPays => client_pays,
:MarkupPercentage => markup_percentage,
:MarkupOnDelivery => markup_on_delivery,
:MarkupPerRecipient => markup_per_recipient,
:MarkupOnDesignSpamTest => markup_on_design_spam_test }.to_json }
put 'setpaygbilling', options
end | [
"def",
"set_payg_billing",
"(",
"currency",
",",
"can_purchase_credits",
",",
"client_pays",
",",
"markup_percentage",
",",
"markup_on_delivery",
"=",
"0",
",",
"markup_per_recipient",
"=",
"0",
",",
"markup_on_design_spam_test",
"=",
"0",
")",
"options",
"=",
"{",
... | Sets the PAYG billing settings for this client. | [
"Sets",
"the",
"PAYG",
"billing",
"settings",
"for",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L126-L138 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.set_monthly_billing | def set_monthly_billing(currency, client_pays, markup_percentage,
monthly_scheme = nil)
options = { :body => {
:Currency => currency,
:ClientPays => client_pays,
:MarkupPercentage => markup_percentage,
:MonthlyScheme => monthly_scheme }.to_json }
put 'setmonthlybilling', options
end | ruby | def set_monthly_billing(currency, client_pays, markup_percentage,
monthly_scheme = nil)
options = { :body => {
:Currency => currency,
:ClientPays => client_pays,
:MarkupPercentage => markup_percentage,
:MonthlyScheme => monthly_scheme }.to_json }
put 'setmonthlybilling', options
end | [
"def",
"set_monthly_billing",
"(",
"currency",
",",
"client_pays",
",",
"markup_percentage",
",",
"monthly_scheme",
"=",
"nil",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":Currency",
"=>",
"currency",
",",
":ClientPays",
"=>",
"client_pays",
",",
":MarkupPer... | Sets the monthly billing settings for this client.
monthly_scheme must be nil, Basic or Unlimited | [
"Sets",
"the",
"monthly",
"billing",
"settings",
"for",
"this",
"client",
".",
"monthly_scheme",
"must",
"be",
"nil",
"Basic",
"or",
"Unlimited"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L142-L150 | valid |
campaignmonitor/createsend-ruby | lib/createsend/client.rb | CreateSend.Client.transfer_credits | def transfer_credits(credits, can_use_my_credits_when_they_run_out)
options = { :body => {
:Credits => credits,
:CanUseMyCreditsWhenTheyRunOut => can_use_my_credits_when_they_run_out
}.to_json }
response = post 'credits', options
Hashie::Mash.new(response)
end | ruby | def transfer_credits(credits, can_use_my_credits_when_they_run_out)
options = { :body => {
:Credits => credits,
:CanUseMyCreditsWhenTheyRunOut => can_use_my_credits_when_they_run_out
}.to_json }
response = post 'credits', options
Hashie::Mash.new(response)
end | [
"def",
"transfer_credits",
"(",
"credits",
",",
"can_use_my_credits_when_they_run_out",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":Credits",
"=>",
"credits",
",",
":CanUseMyCreditsWhenTheyRunOut",
"=>",
"can_use_my_credits_when_they_run_out",
"}",
".",
"to_json",
"... | Transfer credits to or from this client.
credits - An Integer representing the number of credits to transfer.
This value may be either positive if you want to allocate credits from
your account to the client, or negative if you want to deduct credits
from the client back into your account.
can_use_my_credits_when_they_run_out - A Boolean value representing
which, if set to true, will allow the client to continue sending using
your credits or payment details once they run out of credits, and if
set to false, will prevent the client from using your credits to
continue sending until you allocate more credits to them.
Returns an object of the following form representing the result:
{
AccountCredits # Integer representing credits in your account now
ClientCredits # Integer representing credits in this client's
account now
} | [
"Transfer",
"credits",
"to",
"or",
"from",
"this",
"client",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/client.rb#L170-L177 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.send_preview | def send_preview(recipients, personalize="fallback")
options = { :body => {
:PreviewRecipients => recipients.kind_of?(String) ?
[ recipients ] : recipients,
:Personalize => personalize }.to_json }
post "sendpreview", options
end | ruby | def send_preview(recipients, personalize="fallback")
options = { :body => {
:PreviewRecipients => recipients.kind_of?(String) ?
[ recipients ] : recipients,
:Personalize => personalize }.to_json }
post "sendpreview", options
end | [
"def",
"send_preview",
"(",
"recipients",
",",
"personalize",
"=",
"\"fallback\"",
")",
"options",
"=",
"{",
":body",
"=>",
"{",
":PreviewRecipients",
"=>",
"recipients",
".",
"kind_of?",
"(",
"String",
")",
"?",
"[",
"recipients",
"]",
":",
"recipients",
",... | Sends a preview of this campaign. | [
"Sends",
"a",
"preview",
"of",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L82-L88 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.email_client_usage | def email_client_usage
response = get "emailclientusage", {}
response.map{|item| Hashie::Mash.new(item)}
end | ruby | def email_client_usage
response = get "emailclientusage", {}
response.map{|item| Hashie::Mash.new(item)}
end | [
"def",
"email_client_usage",
"response",
"=",
"get",
"\"emailclientusage\"",
",",
"{",
"}",
"response",
".",
"map",
"{",
"|",
"item",
"|",
"Hashie",
"::",
"Mash",
".",
"new",
"(",
"item",
")",
"}",
"end"
] | Gets the email clients that subscribers used to open the campaign | [
"Gets",
"the",
"email",
"clients",
"that",
"subscribers",
"used",
"to",
"open",
"the",
"campaign"
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L116-L119 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.opens | def opens(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("opens", date, page, page_size, order_field,
order_direction)
end | ruby | def opens(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("opens", date, page, page_size, order_field,
order_direction)
end | [
"def",
"opens",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"paged_result_by_date",
"(",
"\"opens\"",
",",
"date",
",",
"page",
",",
"pa... | Retrieves the opens for this campaign. | [
"Retrieves",
"the",
"opens",
"for",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L141-L145 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.clicks | def clicks(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("clicks", date, page, page_size, order_field,
order_direction)
end | ruby | def clicks(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("clicks", date, page, page_size, order_field,
order_direction)
end | [
"def",
"clicks",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"paged_result_by_date",
"(",
"\"clicks\"",
",",
"date",
",",
"page",
",",
"... | Retrieves the subscriber clicks for this campaign. | [
"Retrieves",
"the",
"subscriber",
"clicks",
"for",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L148-L152 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.unsubscribes | def unsubscribes(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("unsubscribes", date, page, page_size, order_field,
order_direction)
end | ruby | def unsubscribes(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("unsubscribes", date, page, page_size, order_field,
order_direction)
end | [
"def",
"unsubscribes",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"paged_result_by_date",
"(",
"\"unsubscribes\"",
",",
"date",
",",
"page"... | Retrieves the unsubscribes for this campaign. | [
"Retrieves",
"the",
"unsubscribes",
"for",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L155-L159 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.spam | def spam(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("spam", date, page, page_size, order_field,
order_direction)
end | ruby | def spam(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("spam", date, page, page_size, order_field,
order_direction)
end | [
"def",
"spam",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"paged_result_by_date",
"(",
"\"spam\"",
",",
"date",
",",
"page",
",",
"page... | Retrieves the spam complaints for this campaign. | [
"Retrieves",
"the",
"spam",
"complaints",
"for",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L162-L166 | valid |
campaignmonitor/createsend-ruby | lib/createsend/campaign.rb | CreateSend.Campaign.bounces | def bounces(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("bounces", date, page, page_size, order_field,
order_direction)
end | ruby | def bounces(date="", page=1, page_size=1000, order_field="date",
order_direction="asc")
paged_result_by_date("bounces", date, page, page_size, order_field,
order_direction)
end | [
"def",
"bounces",
"(",
"date",
"=",
"\"\"",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"1000",
",",
"order_field",
"=",
"\"date\"",
",",
"order_direction",
"=",
"\"asc\"",
")",
"paged_result_by_date",
"(",
"\"bounces\"",
",",
"date",
",",
"page",
",",
... | Retrieves the bounces for this campaign. | [
"Retrieves",
"the",
"bounces",
"for",
"this",
"campaign",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/campaign.rb#L169-L173 | valid |
campaignmonitor/createsend-ruby | lib/createsend/administrator.rb | CreateSend.Administrator.update | def update(new_email_address, name)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name
}.to_json }
put '/admins.json', options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | ruby | def update(new_email_address, name)
options = {
:query => { :email => @email_address },
:body => {
:EmailAddress => new_email_address,
:Name => name
}.to_json }
put '/admins.json', options
# Update @email_address, so this object can continue to be used reliably
@email_address = new_email_address
end | [
"def",
"update",
"(",
"new_email_address",
",",
"name",
")",
"options",
"=",
"{",
":query",
"=>",
"{",
":email",
"=>",
"@email_address",
"}",
",",
":body",
"=>",
"{",
":EmailAddress",
"=>",
"new_email_address",
",",
":Name",
"=>",
"name",
"}",
".",
"to_jso... | Updates the administator details. | [
"Updates",
"the",
"administator",
"details",
"."
] | 8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5 | https://github.com/campaignmonitor/createsend-ruby/blob/8ef7eb1a048363e3557dedbb2e666c4e5b1ccbe5/lib/createsend/administrator.rb#L31-L41 | valid |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.