hexsha
stringlengths
40
40
size
int64
2
991k
ext
stringclasses
2 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
208
max_stars_repo_name
stringlengths
6
106
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
list
max_stars_count
int64
1
33.5k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
208
max_issues_repo_name
stringlengths
6
106
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
list
max_issues_count
int64
1
16.3k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
208
max_forks_repo_name
stringlengths
6
106
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
list
max_forks_count
int64
1
6.91k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
2
991k
avg_line_length
float64
1
36k
max_line_length
int64
1
977k
alphanum_fraction
float64
0
1
08e221a51bebe0595f6ee1b24463ebb13f3b34ce
709
ex
Elixir
web/gettext.ex
roryqueue/code-corps-api
f23007e13fed2d7264fd2e2e97b1497488fb54ba
[ "MIT" ]
null
null
null
web/gettext.ex
roryqueue/code-corps-api
f23007e13fed2d7264fd2e2e97b1497488fb54ba
[ "MIT" ]
null
null
null
web/gettext.ex
roryqueue/code-corps-api
f23007e13fed2d7264fd2e2e97b1497488fb54ba
[ "MIT" ]
null
null
null
defmodule CodeCorps.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: import CodeCorps.Gettext # Simple translation gettext "Here is the string to translate" # Plural translation ngettext "Here is the string to translate", "Here are the strings to translate", 3 # Domain-based translation dgettext "errors", "Here is the error message to translate" See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. """ use Gettext, otp_app: :code_corps end
28.36
72
0.681241
08e2272a8d0ec175d9adef0e74e03080289156ff
934
ex
Elixir
lib/zaryn_web/live/uploaders/post.ex
Arvandazr/zaryn
748805297b399358d28fbcb7ced7588e40f90f03
[ "Apache-2.0" ]
1
2020-01-04T11:24:44.000Z
2020-01-04T11:24:44.000Z
lib/zaryn_web/live/uploaders/post.ex
Arvandazr/zaryn
748805297b399358d28fbcb7ced7588e40f90f03
[ "Apache-2.0" ]
null
null
null
lib/zaryn_web/live/uploaders/post.ex
Arvandazr/zaryn
748805297b399358d28fbcb7ced7588e40f90f03
[ "Apache-2.0" ]
null
null
null
defmodule Zaryn.Uploaders.Post do alias ZarynWeb.Router.Helpers, as: Routes alias Zaryn.Posts.Post @upload_directory_name "uploads" @upload_directory_path "priv/static/uploads" defp ext(entry) do [ext | _] = MIME.extensions(entry.client_type) ext end def put_image_url(socket, %Post{} = post) do {completed, []} = Phoenix.LiveView.uploaded_entries(socket, :photo_url) urls = for entry <- completed do Routes.static_path(socket, "/#{@upload_directory_name}/#{entry.uuid}.#{ext(entry)}") end %Post{post | photo_url: List.to_string(urls)} end def save(socket) do if !File.exists?(@upload_directory_path), do: File.mkdir!(@upload_directory_path) Phoenix.LiveView.consume_uploaded_entries(socket, :photo_url, fn meta, entry -> dest = Path.join(@upload_directory_path, "#{entry.uuid}.#{ext(entry)}") File.cp!(meta.path, dest) end) :ok end end
25.944444
92
0.682013
08e245e1ef76ec1683df4630658890564c757c54
4,517
exs
Elixir
test/co2_offset_web/live/calculator_live/show_test.exs
markevich/co2_offset
98a799d3f30d21b595c9e083d9ee43bb96a4c68c
[ "Apache-2.0" ]
15
2018-12-26T10:31:16.000Z
2020-12-01T09:27:01.000Z
test/co2_offset_web/live/calculator_live/show_test.exs
markevich/co2_offset
98a799d3f30d21b595c9e083d9ee43bb96a4c68c
[ "Apache-2.0" ]
267
2018-12-26T07:46:17.000Z
2020-04-04T17:05:47.000Z
test/co2_offset_web/live/calculator_live/show_test.exs
markevich/co2_offset
98a799d3f30d21b595c9e083d9ee43bb96a4c68c
[ "Apache-2.0" ]
1
2019-07-12T13:53:25.000Z
2019-07-12T13:53:25.000Z
defmodule Co2OffsetWeb.DonationLive.ShowTest do use Co2OffsetWeb.ConnCase alias Co2Offset.Donations setup do donation = insert(:donation, original_distance: 642) distance_1700 = insert(:distance, distance: 1700) distance_10000 = insert(:distance, distance: 10_000) distance_278 = insert(:distance, distance: 278) distance_2509 = insert(:distance, distance: 2509) distance_14720 = insert(:distance, distance: 14_720) {:ok, view, html} = live(build_conn(), "/donations/#{donation.id}") { :ok, view: view, html: html, donation: donation, distance_1700: distance_1700, distance_10000: distance_10000, distance_278: distance_278, distance_2509: distance_2509, distance_14720: distance_14720 } end test "renders /donations/show", %{ html: new_html, donation: donation, distance_1700: distance_1700, distance_10000: distance_10000 } do assert new_html =~ "$#{donation.original_donation}" # plane assert new_html =~ "#{round(donation.original_distance)} km" assert new_html =~ "#{round(donation.original_co2)} kg" assert new_html =~ donation.original_city_from assert new_html =~ donation.original_city_to # beef assert new_html =~ "6.68 kg" # car assert new_html =~ "1751 km" assert new_html =~ distance_1700.from assert new_html =~ distance_1700.to # chicken assert new_html =~ "49 kg" # volcano assert new_html =~ "0.02 sec" # human assert new_html =~ "231 days" # petrol assert new_html =~ "99 liters" # train assert new_html =~ "10272 km" assert new_html =~ distance_10000.from assert new_html =~ distance_10000.to end test "#increase donation", %{ view: view, donation: donation, distance_278: distance_278, distance_2509: distance_2509, distance_14720: distance_14720 } do new_html = render_click(view, :increase_donation) # refetch after update donation = Donations.get_donation!(donation.id) assert new_html =~ "$#{round(donation.original_donation + donation.additional_donation)}" # plane assert new_html =~ "#{round(donation.original_distance + donation.additional_distance)} km" assert new_html =~ "#{round(donation.original_co2 + donation.additional_co2)} kg" assert new_html =~ donation.original_city_from assert new_html =~ donation.original_city_to assert new_html =~ donation.additional_city_from assert new_html =~ donation.additional_city_to # beef assert new_html =~ "9.57 kg" # car assert new_html =~ "2509 km" assert new_html =~ distance_2509.from assert new_html =~ distance_2509.to # chicken # plane assert new_html =~ "920 km" assert new_html =~ "331 kg" assert new_html =~ distance_278.from assert new_html =~ distance_278.to # beef assert new_html =~ "9.57 kg" # car assert new_html =~ "2509 km" assert new_html =~ distance_2509.from assert new_html =~ distance_2509.to # chicken assert new_html =~ "71 kg" # volcano assert new_html =~ "0.03 sec" # human assert new_html =~ "331 days" # petrol assert new_html =~ "142 liters" # train assert new_html =~ "14720 km" assert new_html =~ distance_14720.from assert new_html =~ distance_14720.to end test "#decrease donation to default", %{ view: view, donation: donation, distance_1700: distance_1700, distance_10000: distance_10000 } do render_click(view, :increase_donation) new_html = render_click(view, :decrease_donation) # refetch after update donation = Donations.get_donation!(donation.id) assert new_html =~ "$#{donation.original_donation}" # plane assert new_html =~ "#{round(donation.original_distance)} km" assert new_html =~ "#{round(donation.original_co2)} kg" assert new_html =~ donation.original_city_from assert new_html =~ donation.original_city_to # beef assert new_html =~ "6.68 kg" # car assert new_html =~ "1751 km" assert new_html =~ distance_1700.from assert new_html =~ distance_1700.to # chicken assert new_html =~ "49 kg" # volcano assert new_html =~ "0.02 sec" # human assert new_html =~ "231 days" # petrol assert new_html =~ "99 liters" # train assert new_html =~ "10272 km" assert new_html =~ distance_10000.from assert new_html =~ distance_10000.to end end
29.717105
93
0.672128
08e249686f82e870e114b4e628ae53c948928c09
1,823
ex
Elixir
lib/tube_streamer/stream.ex
surik/tube_streamer
c353e8512ec6b7521c18e8bdad927d8abad0d346
[ "MIT" ]
1
2018-02-06T17:28:51.000Z
2018-02-06T17:28:51.000Z
lib/tube_streamer/stream.ex
surik/tube_streamer
c353e8512ec6b7521c18e8bdad927d8abad0d346
[ "MIT" ]
null
null
null
lib/tube_streamer/stream.ex
surik/tube_streamer
c353e8512ec6b7521c18e8bdad927d8abad0d346
[ "MIT" ]
null
null
null
defmodule TubeStreamer.Stream do use GenServer defmodule Supervisor do @moduledoc false def start_link() do import Elixir.Supervisor.Spec children = [ worker(TubeStreamer.Stream, [], restart: :temporary) ] Elixir.Supervisor.start_link(children, strategy: :simple_one_for_one, name: __MODULE__) end end def start_link(url, opts \\ []) do GenServer.start_link(__MODULE__, [url, opts]) end def new(url, opts \\ []) do length = Elixir.Supervisor.which_children(TubeStreamer.Stream.Supervisor) |> length() limit = Application.get_env(:tube_streamer, :streams_limit, 10) if length < limit, do: Elixir.Supervisor.start_child(TubeStreamer.Stream.Supervisor, [url, opts]), else: :too_much_streams end def stream(conn, pid) do GenServer.cast(pid, {:stream, conn}) conn end def await(pid) do if Process.alive?(pid) do :timer.sleep(100) await(pid) else :done end end def init([url, _opts]) do cmd = System.find_executable("youtube-dl") args = ["-f", "bestaudio", "--no-warnings", "-q", "-r", "320K", "-o", "-", url] {:ok, %{url: url, cmd: cmd, args: args}} end def handle_cast({:stream, conn}, %{cmd: cmd, args: args} = state) do port = Port.open({:spawn_executable, cmd}, [:in, :eof, :binary, args: args]) {:noreply, Map.merge(state, %{port: port, conn: conn})} end def handle_info({port, {:data, data}}, %{port: port, conn: conn} = state) do case Plug.Conn.chunk(conn, data) do {:ok, _} -> {:noreply, state} {:error, _} -> Port.close(port) {:stop, :normal, state} end end def handle_info({port, :eof}, %{port: port, conn: _conn} = state) do Port.close(port) {:stop, :normal, state} end end
26.042857
93
0.610532
08e25d12d025a4d53cb6f0fa3dcc490bc01e9a76
602
ex
Elixir
lib/remedy/schema/thread_member.ex
bdanklin/nostrum
554ebd6cff1d0f68c874aa92f475dabf1aed5512
[ "MIT" ]
3
2021-09-05T09:44:02.000Z
2022-01-26T15:31:50.000Z
lib/remedy/schema/thread_member.ex
bdanklin/remedy
554ebd6cff1d0f68c874aa92f475dabf1aed5512
[ "MIT" ]
null
null
null
lib/remedy/schema/thread_member.ex
bdanklin/remedy
554ebd6cff1d0f68c874aa92f475dabf1aed5512
[ "MIT" ]
null
null
null
defmodule Remedy.Schema.ThreadMember do @moduledoc """ Thread Member Object """ use Remedy.Schema alias Remedy.ISO8601 @type t :: %__MODULE__{ user_id: Snowflake.t(), join_timestamp: ISO8601.t(), flags: ThreadMemberFlags.t() } @primary_key {:id, Snowflake, autogenerate: false} schema "thread_members" do field :user_id, Snowflake field :join_timestamp, ISO8601 field :flags, ThreadMemberFlags end def changeset(model \\ %__MODULE__{}, params) do model |> cast(params, [:id, :user_id, :join_timestamp, :flags]) end end
23.153846
61
0.654485
08e25e20a370ac585c712bc6266ff0cae1594d2f
7,495
exs
Elixir
test/mastani_server_web/query/cms/search_test.exs
DavidAlphaFox/coderplanets_server
3fd47bf3bba6cc04c9a34698201a60ad2f3e8254
[ "Apache-2.0" ]
1
2019-05-07T15:03:54.000Z
2019-05-07T15:03:54.000Z
test/mastani_server_web/query/cms/search_test.exs
DavidAlphaFox/coderplanets_server
3fd47bf3bba6cc04c9a34698201a60ad2f3e8254
[ "Apache-2.0" ]
null
null
null
test/mastani_server_web/query/cms/search_test.exs
DavidAlphaFox/coderplanets_server
3fd47bf3bba6cc04c9a34698201a60ad2f3e8254
[ "Apache-2.0" ]
null
null
null
defmodule MastaniServer.Test.Query.CMS.Search do use MastaniServer.TestTools # alias MastaniServer.Accounts.User # alias MastaniServer.CMS # alias CMS.{Community} setup do guest_conn = simu_conn(:guest) {:ok, _community} = db_insert(:community, %{title: "react"}) {:ok, _community} = db_insert(:community, %{title: "php"}) {:ok, _community} = db_insert(:community, %{title: "每日妹子"}) {:ok, _community} = db_insert(:community, %{title: "javascript"}) {:ok, _community} = db_insert(:community, %{title: "java"}) {:ok, _community} = db_insert(:post, %{title: "react"}) {:ok, _community} = db_insert(:post, %{title: "php"}) {:ok, _community} = db_insert(:post, %{title: "每日妹子"}) {:ok, _community} = db_insert(:post, %{title: "javascript"}) {:ok, _community} = db_insert(:post, %{title: "java"}) {:ok, _community} = db_insert(:job, %{title: "react"}) {:ok, _community} = db_insert(:job, %{title: "php"}) {:ok, _community} = db_insert(:job, %{title: "每日妹子"}) {:ok, _community} = db_insert(:job, %{title: "javascript"}) {:ok, _community} = db_insert(:job, %{title: "java"}) {:ok, _community} = db_insert(:repo, %{title: "react"}) {:ok, _community} = db_insert(:repo, %{title: "php"}) {:ok, _community} = db_insert(:repo, %{title: "每日妹子"}) {:ok, _community} = db_insert(:repo, %{title: "javascript"}) {:ok, _community} = db_insert(:repo, %{title: "java"}) {:ok, _community} = db_insert(:video, %{title: "react"}) {:ok, _community} = db_insert(:video, %{title: "php"}) {:ok, _community} = db_insert(:video, %{title: "每日妹子"}) {:ok, _community} = db_insert(:video, %{title: "javascript"}) {:ok, _community} = db_insert(:video, %{title: "java"}) {:ok, ~m(guest_conn)a} end describe "[cms search post query]" do @query """ query($title: String!) { searchPosts(title: $title) { entries { id title } totalCount } } """ test "search post by full title should valid paged communities", ~m(guest_conn)a do variables = %{title: "react"} results = guest_conn |> query_result(@query, variables, "searchPosts") assert results["totalCount"] == 1 assert results["entries"] |> Enum.any?(&(&1["title"] == "react")) variables = %{title: "java"} results = guest_conn |> query_result(@query, variables, "searchPosts") assert results["totalCount"] == 2 assert results["entries"] |> Enum.any?(&(&1["title"] == "java")) assert results["entries"] |> Enum.any?(&(&1["title"] == "javascript")) end test "search non-exsit post should get empty pagi data", ~m(guest_conn)a do variables = %{title: "non-exsit"} results = guest_conn |> query_result(@query, variables, "searchPosts") assert results["totalCount"] == 0 assert results["entries"] == [] end end describe "[cms search job query]" do @query """ query($title: String!) { searchJobs(title: $title) { entries { id title } totalCount } } """ test "search job by full title should valid paged communities", ~m(guest_conn)a do variables = %{title: "react"} results = guest_conn |> query_result(@query, variables, "searchJobs") assert results["totalCount"] == 1 assert results["entries"] |> Enum.any?(&(&1["title"] == "react")) variables = %{title: "java"} results = guest_conn |> query_result(@query, variables, "searchJobs") assert results["totalCount"] == 2 assert results["entries"] |> Enum.any?(&(&1["title"] == "java")) assert results["entries"] |> Enum.any?(&(&1["title"] == "javascript")) end test "search non-exsit job should get empty pagi data", ~m(guest_conn)a do variables = %{title: "non-exsit"} results = guest_conn |> query_result(@query, variables, "searchJobs") assert results["totalCount"] == 0 assert results["entries"] == [] end end describe "[cms search video query]" do @query """ query($title: String!) { searchVideos(title: $title) { entries { id title } totalCount } } """ test "search video by full title should valid paged communities", ~m(guest_conn)a do variables = %{title: "react"} results = guest_conn |> query_result(@query, variables, "searchVideos") assert results["totalCount"] == 1 assert results["entries"] |> Enum.any?(&(&1["title"] == "react")) variables = %{title: "java"} results = guest_conn |> query_result(@query, variables, "searchVideos") assert results["totalCount"] == 2 assert results["entries"] |> Enum.any?(&(&1["title"] == "java")) assert results["entries"] |> Enum.any?(&(&1["title"] == "javascript")) end test "search non-exsit video should get empty pagi data", ~m(guest_conn)a do variables = %{title: "non-exsit"} results = guest_conn |> query_result(@query, variables, "searchVideos") assert results["totalCount"] == 0 assert results["entries"] == [] end end describe "[cms search repo query]" do @query """ query($title: String!) { searchRepos(title: $title) { entries { id title } totalCount } } """ test "search repo by full title should valid paged communities", ~m(guest_conn)a do variables = %{title: "react"} results = guest_conn |> query_result(@query, variables, "searchRepos") assert results["totalCount"] == 1 assert results["entries"] |> Enum.any?(&(&1["title"] == "react")) variables = %{title: "java"} results = guest_conn |> query_result(@query, variables, "searchRepos") assert results["totalCount"] == 2 assert results["entries"] |> Enum.any?(&(&1["title"] == "java")) assert results["entries"] |> Enum.any?(&(&1["title"] == "javascript")) end test "search non-exsit repo should get empty pagi data", ~m(guest_conn)a do variables = %{title: "non-exsit"} results = guest_conn |> query_result(@query, variables, "searchRepos") assert results["totalCount"] == 0 assert results["entries"] == [] end end describe "[cms search community query]" do @query """ query($title: String!) { searchCommunities(title: $title) { entries { id title } totalCount } } """ test "search community by full title should valid paged communities", ~m(guest_conn)a do variables = %{title: "react"} results = guest_conn |> query_result(@query, variables, "searchCommunities") assert results["totalCount"] == 1 assert results["entries"] |> Enum.any?(&(&1["title"] == "react")) variables = %{title: "java"} results = guest_conn |> query_result(@query, variables, "searchCommunities") assert results["totalCount"] == 2 assert results["entries"] |> Enum.any?(&(&1["title"] == "java")) assert results["entries"] |> Enum.any?(&(&1["title"] == "javascript")) end test "search non-exsit community should get empty pagi data", ~m(guest_conn)a do variables = %{title: "non-exsit"} results = guest_conn |> query_result(@query, variables, "searchCommunities") assert results["totalCount"] == 0 assert results["entries"] == [] end end end
33.609865
92
0.589726
08e27eb6a46a1e66bebb4380c6b99c80f3a76a05
1,432
ex
Elixir
clients/jobs/lib/google_api/jobs/v4/model/empty.ex
yoshi-code-bot/elixir-google-api
cdb6032f01fac5ab704803113c39f2207e9e019d
[ "Apache-2.0" ]
null
null
null
clients/jobs/lib/google_api/jobs/v4/model/empty.ex
yoshi-code-bot/elixir-google-api
cdb6032f01fac5ab704803113c39f2207e9e019d
[ "Apache-2.0" ]
null
null
null
clients/jobs/lib/google_api/jobs/v4/model/empty.ex
yoshi-code-bot/elixir-google-api
cdb6032f01fac5ab704803113c39f2207e9e019d
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Jobs.V4.Model.Empty do @moduledoc """ A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } ## Attributes """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{} end defimpl Poison.Decoder, for: GoogleApi.Jobs.V4.Model.Empty do def decode(value, options) do GoogleApi.Jobs.V4.Model.Empty.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Jobs.V4.Model.Empty do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.095238
282
0.753492
08e27ec6a7f363276543a3985b89ef8aa4eb3d0a
2,382
ex
Elixir
lib/stone/operations.ex
MillionIntegrals/stone
63cc7530241b53667a28afc2259c3199d912b839
[ "MIT" ]
null
null
null
lib/stone/operations.ex
MillionIntegrals/stone
63cc7530241b53667a28afc2259c3199d912b839
[ "MIT" ]
null
null
null
lib/stone/operations.ex
MillionIntegrals/stone
63cc7530241b53667a28afc2259c3199d912b839
[ "MIT" ]
null
null
null
defmodule Stone.Operations do @moduledoc """ Basic building blocks for your `GenServer`s. Use these macros to define your desired functionality. """ alias Stone.Declaration @doc """ Define server starting function(`start`, `start_link`) together with corresponding `init/1`. """ defmacro defstart(declaration_ast, options \\ []) do declaration = Declaration.from_ast(declaration_ast) quote bind_quoted: [ declaration: Macro.escape(declaration), options: Macro.escape(options, unquote: true) ] do Stone.Operations.Implementation.define_starter(declaration, options ++ @stone_settings) |> Stone.MacroHelpers.inject_to_module(__MODULE__, __ENV__) end end @doc """ Define server `init/1` function clause with parameters packed as a tuple. """ defmacro definit(arg \\ quote(do: _), options \\ []) do quote bind_quoted: [ arg: Macro.escape(arg), options: Macro.escape(options, unquote: true) ] do Stone.Operations.Implementation.define_init(arg, options ++ @stone_settings) |> Stone.MacroHelpers.inject_to_module(__MODULE__, __ENV__) end end @doc """ Define server `handle_call/3` function with parameters packed as a tuple. """ defmacro defcall(declaration_ast, options \\ [], body \\ []) do declaration = Declaration.from_ast(declaration_ast) quote bind_quoted: [ declaration: Macro.escape(declaration), options: Macro.escape(options, unquote: true), body: Macro.escape(body, unquote: true) ] do Stone.Operations.Implementation.define_handler( :defcall, declaration, __MODULE__, options ++ body ++ @stone_settings ) |> Stone.MacroHelpers.inject_to_module(__MODULE__, __ENV__) end end @doc """ Define server `handle_cast/2` function with parameters packed as a tuple. """ defmacro defcast(declaration_ast, options \\ [], body \\ []) do declaration = Declaration.from_ast(declaration_ast) quote bind_quoted: [ declaration: Macro.escape(declaration), options: Macro.escape(options, unquote: true), body: Macro.escape(body, unquote: true) ] do Stone.Operations.Implementation.define_handler( :defcast, declaration, __MODULE__, options ++ body ++ @stone_settings ) |> Stone.MacroHelpers.inject_to_module(__MODULE__, __ENV__) end end end
32.630137
94
0.691856
08e288b9b7c5727533eebe1aa0463a78ea990090
2,126
exs
Elixir
test/erlef/wild_apricot_test.exs
joaquinalcerro/website
52dc89c70cd0b42127ab233a4c0d10f626d2b698
[ "Apache-2.0" ]
71
2019-07-02T18:06:15.000Z
2022-03-09T15:30:08.000Z
test/erlef/wild_apricot_test.exs
joaquinalcerro/website
52dc89c70cd0b42127ab233a4c0d10f626d2b698
[ "Apache-2.0" ]
157
2019-07-02T01:21:16.000Z
2022-03-30T16:08:12.000Z
test/erlef/wild_apricot_test.exs
joaquinalcerro/website
52dc89c70cd0b42127ab233a4c0d10f626d2b698
[ "Apache-2.0" ]
45
2019-07-04T05:51:11.000Z
2022-02-27T11:56:02.000Z
defmodule Erlef.WidlApricotTest do use ExUnit.Case, async: true alias Erlef.WildApricot describe "login/1" do test "when contact exists" do assert {:ok, _contact} = WildApricot.login("basic_member") end test "when contact does not exist" do assert {:error, _contact} = WildApricot.login("invalid") end end describe "get_contact/1" do test "when contact exists" do assert {:ok, _contact} = WildApricot.get_contact("basic_member") end test "when contact does not exist" do assert {:error, _contact} = WildApricot.get_contact("eh?") end end describe "get_contact_by_field_value/1" do test "when contact is found" do {:ok, contact} = WildApricot.get_contact("annual_member") %{"Value" => uuid} = Enum.find(contact["FieldValues"], fn f -> f["FieldName"] == "erlef_app_id" end) assert {:ok, ^contact} = WildApricot.get_contact_by_field_value("erlef_app_id", uuid) end test "when contact is not found" do assert {:error, :not_found} = WildApricot.get_contact_by_field_value("erlef_app_id", Ecto.UUID.generate()) end test "when field name is malformed" do assert {:error, _} = WildApricot.get_contact_by_field_value("", Ecto.UUID.generate()) end end describe "update_contact/2" do test "when contact is found" do {:ok, contact} = WildApricot.get_contact("basic_member") uuid = Ecto.UUID.generate() update = %{ "Id" => contact["Id"], "FieldValues" => [%{"FieldName" => "erlef_app_id", "Value" => uuid}] } assert {:ok, contact} = WildApricot.update_contact(contact["Id"], update) assert Enum.find(contact["FieldValues"], fn f -> f["Value"] == uuid end) end test "when bar" do {:ok, contact} = WildApricot.get_contact("basic_member") uuid = Ecto.UUID.generate() update = %{ "Id" => contact["Id"], "FieldValues" => [%{"FieldName" => "erlef_app_id", "Value" => uuid}] } assert {:error, _} = WildApricot.update_contact("does_not_exist", update) end end end
29.123288
91
0.632173
08e2a2009b98930b9991c471fd8b8d9c178c565e
6,683
ex
Elixir
lib/swoosh/adapters/smtp/helpers.ex
craigp/swoosh
83364b3e9029988e585d4cc0c4d5ec1ccfb4930a
[ "MIT" ]
1
2020-12-22T19:28:30.000Z
2020-12-22T19:28:30.000Z
lib/swoosh/adapters/smtp/helpers.ex
craigp/swoosh
83364b3e9029988e585d4cc0c4d5ec1ccfb4930a
[ "MIT" ]
null
null
null
lib/swoosh/adapters/smtp/helpers.ex
craigp/swoosh
83364b3e9029988e585d4cc0c4d5ec1ccfb4930a
[ "MIT" ]
null
null
null
defmodule Swoosh.Adapters.SMTP.Helpers do @moduledoc false alias Swoosh.Email import Swoosh.Email.Render @doc false def sender(%Email{} = email) do email.headers["Sender"] || elem(email.from, 1) end @doc false def body(email, config) do {message_config, config} = Keyword.split(config, [:transfer_encoding]) {type, subtype, headers, parts} = prepare_message(email, message_config) {encoding_config, _config} = Keyword.split(config, [:dkim]) mime_encode(type, subtype, headers, parts, encoding_config) end gen_smtp_major = if Code.ensure_loaded?(:gen_smtp_application) do Application.load(:gen_smtp) :gen_smtp |> Application.spec(:vsn) |> to_string() |> Version.parse!() |> Map.get(:major) else 0 end @parameters if(gen_smtp_major >= 1, do: %{}, else: []) defp mime_encode(type, subtype, headers, parts, encoding_config) do :mimemail.encode({type, subtype, headers, @parameters, parts}, encoding_config) end @doc false def prepare_message(email, config) do email |> prepare_headers() |> prepare_parts(email, config) end defp prepare_headers(email) do [] |> prepare_additional_headers(email) |> prepare_mime_version |> prepare_reply_to(email) |> prepare_subject(email) |> prepare_bcc(email) |> prepare_cc(email) |> prepare_to(email) |> prepare_from(email) end defp prepare_subject(headers, %{subject: subject}) when is_binary(subject), do: [{"Subject", subject} | headers] defp prepare_from(headers, %{from: from}), do: [{"From", render_recipient(from)} | headers] defp prepare_to(headers, %{to: to}), do: [{"To", render_recipient(to)} | headers] defp prepare_cc(headers, %{cc: []}), do: headers defp prepare_cc(headers, %{cc: cc}), do: [{"Cc", render_recipient(cc)} | headers] defp prepare_bcc(headers, %{bcc: []}), do: headers defp prepare_bcc(headers, %{bcc: bcc}), do: [{"Bcc", render_recipient(bcc)} | headers] defp prepare_reply_to(headers, %{reply_to: nil}), do: headers defp prepare_reply_to(headers, %{reply_to: reply_to}), do: [{"Reply-To", render_recipient(reply_to)} | headers] defp prepare_mime_version(headers), do: [{"Mime-Version", "1.0"} | headers] defp prepare_additional_headers(headers, %{headers: additional_headers}) do Map.to_list(additional_headers) ++ headers end defp prepare_parts( headers, %{ attachments: [], html_body: html_body, text_body: text_body }, config ) do case {text_body, html_body} do {text_body, nil} -> {"text", "plain", add_content_type_header(headers, "text/plain; charset=\"utf-8\""), text_body} {nil, html_body} -> {"text", "html", add_content_type_header(headers, "text/html; charset=\"utf-8\""), html_body} {text_body, html_body} -> parts = [ prepare_part(:plain, text_body, config), prepare_part(:html, html_body, config) ] {"multipart", "alternative", headers, parts} end end defp prepare_parts( headers, %{ attachments: attachments, html_body: html_body, text_body: text_body }, config ) do content_part = case {prepare_part(:plain, text_body, config), prepare_part(:html, html_body, config)} do {text_part, nil} -> text_part {nil, html_part} -> html_part {text_part, html_part} -> {"multipart", "alternative", [], @parameters, [text_part, html_part]} end attachment_parts = Enum.map(attachments, &prepare_attachment(&1)) {"multipart", "mixed", headers, [content_part | attachment_parts]} end defp prepare_part(_subtype, nil, _config), do: nil @content_params if(gen_smtp_major >= 1, do: %{ content_type_params: [{"charset", "utf-8"}], disposition: "inline", disposition_params: [] }, else: [ {"content-type-params", [{"charset", "utf-8"}]}, {"disposition", "inline"}, {"disposition-params", []} ] ) defp prepare_part(subtype, content, config) do subtype_string = to_string(subtype) transfer_encoding = Keyword.get(config, :transfer_encoding, "quoted-printable") {"text", subtype_string, [ {"Content-Type", "text/#{subtype_string}; charset=\"utf-8\""}, {"Content-Transfer-Encoding", transfer_encoding} ], @content_params, content} end defp add_content_type_header(headers, value) do if Enum.find(headers, fn {header_name, _} -> String.downcase(header_name) == "content-type" end) do headers else [{"Content-Type", value} | headers] end end defp prepare_attachment( %{ filename: filename, content_type: content_type, type: attachment_type, headers: custom_headers } = attachment ) do [type, format] = String.split(content_type, "/") content = Swoosh.Attachment.get_content(attachment) case attachment_type do :attachment -> { type, format, [ {"Content-Transfer-Encoding", "base64"} | custom_headers ], attachment_content_params(:attachment, filename), content } :inline -> { type, format, [ {"Content-Transfer-Encoding", "base64"}, {"Content-Id", "<#{filename}>"} | custom_headers ], attachment_content_params(:inline), content } end end if gen_smtp_major >= 1 do defp attachment_content_params(:attachment, filename) do %{ disposition: "attachment", disposition_params: [{"filename", filename}] } end else defp attachment_content_params(:attachment, filename) do [ {"disposition", "attachment"}, {"disposition-params", [{"filename", filename}]} ] end end if gen_smtp_major >= 1 do defp attachment_content_params(:inline) do %{ content_type_params: [], disposition: "inline", disposition_params: [] } end else defp attachment_content_params(:inline) do [ {"content-type-params", []}, {"disposition", "inline"}, {"disposition-params", []} ] end end end
27.166667
95
0.58387
08e2ac6badb81dd19c7b6221bd844b6ae6acebf2
886
ex
Elixir
clients/cloud_tasks/lib/google_api/cloud_tasks/v2/metadata.ex
jechol/elixir-google-api
0290b683dfc6491ca2ef755a80bc329378738d03
[ "Apache-2.0" ]
null
null
null
clients/cloud_tasks/lib/google_api/cloud_tasks/v2/metadata.ex
jechol/elixir-google-api
0290b683dfc6491ca2ef755a80bc329378738d03
[ "Apache-2.0" ]
null
null
null
clients/cloud_tasks/lib/google_api/cloud_tasks/v2/metadata.ex
jechol/elixir-google-api
0290b683dfc6491ca2ef755a80bc329378738d03
[ "Apache-2.0" ]
null
null
null
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.CloudTasks.V2 do @moduledoc """ API client metadata for GoogleApi.CloudTasks.V2. """ @discovery_revision "20210315" def discovery_revision(), do: @discovery_revision end
32.814815
74
0.759594
08e2d8ebdbc1e78b92760620c9e6fadbb7709042
2,803
ex
Elixir
clients/admin/lib/google_api/admin/directory_v1/model/token.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/admin/lib/google_api/admin/directory_v1/model/token.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/admin/lib/google_api/admin/directory_v1/model/token.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Admin.Directory_v1.Model.Token do @moduledoc """ JSON template for token resource in Directory API. ## Attributes * `anonymous` (*type:* `boolean()`, *default:* `nil`) - Whether the application is registered with Google. The value is `true` if the application has an anonymous Client ID. * `clientId` (*type:* `String.t`, *default:* `nil`) - The Client ID of the application the token is issued to. * `displayText` (*type:* `String.t`, *default:* `nil`) - The displayable name of the application the token is issued to. * `etag` (*type:* `String.t`, *default:* `nil`) - ETag of the resource. * `kind` (*type:* `String.t`, *default:* `admin#directory#token`) - The type of the API resource. This is always `admin#directory#token`. * `nativeApp` (*type:* `boolean()`, *default:* `nil`) - Whether the token is issued to an installed application. The value is `true` if the application is installed to a desktop or mobile device. * `scopes` (*type:* `list(String.t)`, *default:* `nil`) - A list of authorization scopes the application is granted. * `userKey` (*type:* `String.t`, *default:* `nil`) - The unique ID of the user that issued the token. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :anonymous => boolean() | nil, :clientId => String.t() | nil, :displayText => String.t() | nil, :etag => String.t() | nil, :kind => String.t() | nil, :nativeApp => boolean() | nil, :scopes => list(String.t()) | nil, :userKey => String.t() | nil } field(:anonymous) field(:clientId) field(:displayText) field(:etag) field(:kind) field(:nativeApp) field(:scopes, type: :list) field(:userKey) end defimpl Poison.Decoder, for: GoogleApi.Admin.Directory_v1.Model.Token do def decode(value, options) do GoogleApi.Admin.Directory_v1.Model.Token.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Admin.Directory_v1.Model.Token do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
41.220588
199
0.677845
08e30f85b3417007e66ab18732c8fa1eb000e159
1,226
ex
Elixir
lib/retrospectivex/accounts/accounts.ex
dreamingechoes/retrospectivex
cad0df6cfde5376121d841f4a8b36861b6ec5d45
[ "MIT" ]
5
2018-06-27T17:51:51.000Z
2020-10-05T09:59:04.000Z
lib/retrospectivex/accounts/accounts.ex
dreamingechoes/retrospectivex
cad0df6cfde5376121d841f4a8b36861b6ec5d45
[ "MIT" ]
1
2018-10-08T11:33:12.000Z
2018-10-08T11:33:12.000Z
lib/retrospectivex/accounts/accounts.ex
dreamingechoes/retrospectivex
cad0df6cfde5376121d841f4a8b36861b6ec5d45
[ "MIT" ]
2
2018-10-08T11:31:55.000Z
2020-10-05T09:59:05.000Z
defmodule Retrospectivex.Accounts do @moduledoc """ The Accounts context. """ alias Retrospectivex.Accounts.Managers.Administrator, as: AdministratorManager alias Retrospectivex.Accounts.Managers.User, as: UserManager # Administrator API defdelegate change_administrator(administrator), to: AdministratorManager defdelegate create_administrator(attrs), to: AdministratorManager defdelegate delete_administrator(administrator), to: AdministratorManager defdelegate get_administrator_by_email(email), to: AdministratorManager defdelegate get_administrator!(id), to: AdministratorManager defdelegate list_administrators, to: AdministratorManager defdelegate update_administrator(administrator, attrs), to: AdministratorManager # User API defdelegate change_user(user), to: UserManager defdelegate create_user(attrs), to: UserManager defdelegate delete_user(user), to: UserManager defdelegate get_or_create_user_by_external_id(external_id, source), to: UserManager defdelegate get_user_by_external_id(external_id), to: UserManager defdelegate get_user!(id), to: UserManager defdelegate list_users, to: UserManager defdelegate update_user(user, attrs), to: UserManager end
37.151515
80
0.814845
08e3262d81711fc934518e3a12a9aa9bb011d868
1,303
ex
Elixir
lib/aws_ingress_operator/ex_aws/elbv2/target_group.ex
bennyhat/aws_ingress_operator
81a1c873cbea95a8ba721ac1147c421dcaf1de45
[ "MIT" ]
null
null
null
lib/aws_ingress_operator/ex_aws/elbv2/target_group.ex
bennyhat/aws_ingress_operator
81a1c873cbea95a8ba721ac1147c421dcaf1de45
[ "MIT" ]
null
null
null
lib/aws_ingress_operator/ex_aws/elbv2/target_group.ex
bennyhat/aws_ingress_operator
81a1c873cbea95a8ba721ac1147c421dcaf1de45
[ "MIT" ]
null
null
null
defmodule AwsIngressOperator.ExAws.Elbv2.TargetGroup do alias AwsIngressOperator.ExAws.FilterAliases import AwsIngressOperator.ExAws.Elbv2, only: [make_request: 2, make_request: 3] def describe_target_groups!(filters) do action = :describe_target_groups aliased_filters = FilterAliases.apply_aliases(action, filters) return_target_groups = fn %{ describe_target_groups_response: %{ describe_target_groups_result: %{ target_groups: tgs } } } -> tgs || [] end case make_request(aliased_filters, action, return_target_groups) |> ExAws.request() do {:ok, tgs} -> tgs {:error, _} -> [] end end def create_target_group!(tg) do return_target_group = fn %{ create_target_group_response: %{ create_target_group_result: %{ target_groups: [tg] } } } -> tg end Map.put(tg, :name, tg.target_group_name) |> make_request(:create_target_group, return_target_group) |> ExAws.request!() end def modify_target_group!(tg) do make_request(tg, :modify_target_group) |> ExAws.request!() end def delete_target_group!(tg) do make_request(tg, :delete_target_group) |> ExAws.request!() end end
24.12963
90
0.640061
08e39862ad9a373642551165fae24fe5a5ba3c3b
645
exs
Elixir
priv/repo/seeds.exs
francocatena/ptr
4c8a960cdcb1c8523334fcc0cddba6b7fb3b3e60
[ "MIT" ]
null
null
null
priv/repo/seeds.exs
francocatena/ptr
4c8a960cdcb1c8523334fcc0cddba6b7fb3b3e60
[ "MIT" ]
2
2021-03-09T01:59:47.000Z
2022-02-10T17:08:54.000Z
priv/repo/seeds.exs
francocatena/ptr
4c8a960cdcb1c8523334fcc0cddba6b7fb3b3e60
[ "MIT" ]
null
null
null
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # Ptr.Repo.insert!(%Ptr.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong. {:ok, account} = Ptr.Accounts.create_account(%{ name: "Default", db_prefix: "default" }) session = %Ptr.Accounts.Session{account: account} {:ok, _} = Ptr.Accounts.create_user(session, %{ name: "Admin", lastname: "Admin", email: "admin@ptr.com", password: "123456" })
23.035714
61
0.657364
08e3a42440064d701a83b57b1faebc2f3f59383b
1,033
exs
Elixir
mix.exs
syamilmj/para
ed7a7ae7205a9cd0c9a0557fbab95d337741762f
[ "Apache-2.0" ]
27
2021-09-02T12:50:32.000Z
2022-03-07T05:28:06.000Z
mix.exs
syamilmj/para
ed7a7ae7205a9cd0c9a0557fbab95d337741762f
[ "Apache-2.0" ]
3
2021-09-01T19:18:32.000Z
2021-10-14T09:34:07.000Z
mix.exs
syamilmj/para
ed7a7ae7205a9cd0c9a0557fbab95d337741762f
[ "Apache-2.0" ]
null
null
null
defmodule Para.MixProject do use Mix.Project @version "0.3.0" @source_url "https://github.com/syamilmj/para" def project do [ app: :para, version: @version, elixir: "~> 1.11", start_permanent: Mix.env() == :prod, deps: deps(), # Hex description: "A declarative way to parse and validate parameters", package: package(), # Docs name: "Para", docs: [source_ref: "v#{@version}", main: "Para", extras: ["CHANGELOG.md"]] ] end # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger] ] end # Run "mix help deps" to learn about dependencies. defp deps do [ {:ecto, "~> 3.7"}, {:ex_doc, "~> 0.20", only: :dev, runtime: false} ] end def package do [ files: ~w(lib mix.exs README* LICENSE CHANGELOG.md .formatter.exs), maintainers: ["Syamil MJ"], licenses: ["Apache 2.0"], links: %{"GitHub" => @source_url} ] end end
21.081633
80
0.570184
08e41a96b9d91d6d2d2c47830098bb15a37cf323
1,525
ex
Elixir
test/support/data_case.ex
ohr486/Grimoire
4ad1ff8bb2a31da5b848ca680b33b730d6ae5ce8
[ "MIT" ]
null
null
null
test/support/data_case.ex
ohr486/Grimoire
4ad1ff8bb2a31da5b848ca680b33b730d6ae5ce8
[ "MIT" ]
null
null
null
test/support/data_case.ex
ohr486/Grimoire
4ad1ff8bb2a31da5b848ca680b33b730d6ae5ce8
[ "MIT" ]
null
null
null
defmodule Grimoire.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously by setting `use Grimoire.DataCase, async: true`, although this option is not recommended for other databases. """ use ExUnit.CaseTemplate using do quote do alias Grimoire.Repo import Ecto import Ecto.Changeset import Ecto.Query import Grimoire.DataCase end end setup tags do pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Grimoire.Repo, shared: not tags[:async]) on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) :ok end @doc """ A helper that transforms changeset errors into a map of messages. assert {:error, changeset} = Accounts.create_user(%{password: "short"}) assert "password is too short" in errors_on(changeset).password assert %{password: ["password is too short"]} = errors_on(changeset) """ def errors_on(changeset) do Ecto.Changeset.traverse_errors(changeset, fn {message, opts} -> Regex.replace(~r"%{(\w+)}", message, fn _, key -> opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() end) end) end end
29.326923
89
0.696393
08e42599ee75c090f7d09d45813c60bb74b5d65d
2,059
ex
Elixir
clients/android_publisher/lib/google_api/android_publisher/v2/model/reviews_list_response.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
1
2018-12-03T23:43:10.000Z
2018-12-03T23:43:10.000Z
clients/android_publisher/lib/google_api/android_publisher/v2/model/reviews_list_response.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
clients/android_publisher/lib/google_api/android_publisher/v2/model/reviews_list_response.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the elixir code generator program. # Do not edit the class manually. defmodule GoogleApi.AndroidPublisher.V2.Model.ReviewsListResponse do @moduledoc """ ## Attributes * `pageInfo` (*type:* `GoogleApi.AndroidPublisher.V2.Model.PageInfo.t`, *default:* `nil`) - * `reviews` (*type:* `list(GoogleApi.AndroidPublisher.V2.Model.Review.t)`, *default:* `nil`) - * `tokenPagination` (*type:* `GoogleApi.AndroidPublisher.V2.Model.TokenPagination.t`, *default:* `nil`) - """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :pageInfo => GoogleApi.AndroidPublisher.V2.Model.PageInfo.t(), :reviews => list(GoogleApi.AndroidPublisher.V2.Model.Review.t()), :tokenPagination => GoogleApi.AndroidPublisher.V2.Model.TokenPagination.t() } field(:pageInfo, as: GoogleApi.AndroidPublisher.V2.Model.PageInfo) field(:reviews, as: GoogleApi.AndroidPublisher.V2.Model.Review, type: :list) field(:tokenPagination, as: GoogleApi.AndroidPublisher.V2.Model.TokenPagination) end defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V2.Model.ReviewsListResponse do def decode(value, options) do GoogleApi.AndroidPublisher.V2.Model.ReviewsListResponse.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V2.Model.ReviewsListResponse do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
38.849057
110
0.742593
08e42e29d55d98bc6eadeef5e8d3d87a17542cbc
5,282
ex
Elixir
lib/central/account/schemas/user.ex
icexuick/teiserver
22f2e255e7e21f977e6b262acf439803626a506c
[ "MIT" ]
6
2021-02-08T10:42:53.000Z
2021-04-25T12:12:03.000Z
lib/central/account/schemas/user.ex
icexuick/teiserver
22f2e255e7e21f977e6b262acf439803626a506c
[ "MIT" ]
null
null
null
lib/central/account/schemas/user.ex
icexuick/teiserver
22f2e255e7e21f977e6b262acf439803626a506c
[ "MIT" ]
2
2021-02-23T22:34:00.000Z
2021-04-08T13:31:36.000Z
defmodule Central.Account.User do use CentralWeb, :schema @behaviour Bodyguard.Policy alias Argon2 # import Central.Account.AuthLib, only: [allow?: 2] @extra_fields [:clan_id] schema "account_users" do field :name, :string field :email, :string field :password, :string field :icon, :string field :colour, :string field :data, :map, default: %{} field :permissions, {:array, :string}, default: [] has_many :user_configs, Central.Config.UserConfig has_many :reports_against, Central.Account.Report, foreign_key: :target_id has_many :reports_made, Central.Account.Report, foreign_key: :reporter_id has_many :reports_responded, Central.Account.Report, foreign_key: :responder_id # Extra user.ex relations go here belongs_to :clan, Teiserver.Clans.Clan has_one :user_stat, Teiserver.Account.UserStat belongs_to :admin_group, Central.Account.Group many_to_many :groups, Central.Account.Group, join_through: "account_group_memberships", join_keys: [user_id: :id, group_id: :id] timestamps() end @doc false def changeset(user, attrs \\ %{}) do attrs = attrs |> remove_whitespace([:email]) if attrs["password"] == "" do user |> cast( attrs, [:name, :email, :icon, :colour, :permissions, :admin_group_id, :data] ++ @extra_fields ) |> validate_required([:name, :email, :icon, :colour, :permissions]) else user |> cast( attrs, [ :name, :email, :password, :icon, :colour, :permissions, :admin_group_id, :data ] ++ @extra_fields ) |> validate_required([:name, :email, :password, :icon, :colour, :permissions]) |> put_password_hash() end end def changeset(user, attrs, :script) do attrs = attrs |> remove_whitespace([:email]) user |> cast( attrs, [ :name, :email, :password, :icon, :colour, :permissions, :admin_group_id, :data ] ++ @extra_fields ) |> validate_required([:name, :email, :icon, :colour, :permissions]) end def changeset(struct, params, nil), do: changeset(struct, params) def changeset(struct, permissions, :permissions) do cast(struct, %{permissions: permissions}, [:permissions]) end def changeset(user, attrs, :self_create) do attrs = attrs |> remove_whitespace([:email]) user |> cast(attrs, [:name, :email]) |> validate_required([:name, :email]) |> change_password(attrs) end def changeset(user, attrs, :limited) do attrs = attrs |> remove_whitespace([:email]) user |> cast(attrs, [:name, :email, :icon, :colour] ++ @extra_fields) |> validate_required([:name, :email, :icon, :colour]) end def changeset(user, attrs, :limited_with_data) do attrs = attrs |> remove_whitespace([:email]) user |> cast(attrs, [:name, :email, :icon, :colour, :data] ++ @extra_fields) |> validate_required([:name, :email, :icon, :colour]) end def changeset(user, attrs, :user_form) do attrs = attrs |> remove_whitespace([:email]) cond do attrs["password"] == nil or attrs["password"] == "" -> user |> cast(attrs, [:name, :email]) |> validate_required([:name, :email]) |> add_error( :password_confirmation, "Please enter your password to change your account details." ) verify_password(attrs["password"], user.password) == false -> user |> cast(attrs, [:name, :email]) |> validate_required([:name, :email]) |> add_error(:password_confirmation, "Incorrect password") true -> user |> cast(attrs, [:name, :email]) |> validate_required([:name, :email]) end end def changeset(user, attrs, :password) do cond do attrs["existing"] == nil or attrs["existing"] == "" -> user |> change_password(attrs) |> add_error( :password_confirmation, "Please enter your existing password to change your password." ) verify_password(attrs["existing"], user.password) == false -> user |> change_password(attrs) |> add_error(:existing, "Incorrect password") true -> user |> change_password(attrs) end end defp change_password(user, attrs) do user |> cast(attrs, [:password]) |> validate_length(:password, min: 6) |> validate_confirmation(:password, message: "Does not match password") |> put_password_hash() end defp put_password_hash( %Ecto.Changeset{valid?: true, changes: %{password: password}} = changeset ) do change(changeset, password: Argon2.hash_pwd_salt(password)) end defp put_password_hash(changeset), do: changeset @spec verify_password(String.t(), String.t()) :: boolean def verify_password(plain_text_password, encrypted) do Argon2.verify_pass(plain_text_password, encrypted) end @spec authorize(any, Plug.Conn.t(), atom) :: boolean def authorize(_, conn, _), do: allow?(conn, "admin.user") # def authorize(_, _, _), do: false end
26.278607
94
0.608482
08e45dae511b72a1894b3446311ae4700071356e
2,482
ex
Elixir
lib/banking_graph/banking/entry.ex
oryono/banking
0a49ebae5ebf93a6db0c24476a1c86c60bb72733
[ "MIT" ]
null
null
null
lib/banking_graph/banking/entry.ex
oryono/banking
0a49ebae5ebf93a6db0c24476a1c86c60bb72733
[ "MIT" ]
null
null
null
lib/banking_graph/banking/entry.ex
oryono/banking
0a49ebae5ebf93a6db0c24476a1c86c60bb72733
[ "MIT" ]
null
null
null
defmodule BankingGraph.Banking.Entry do use Ecto.Schema import Ecto.Changeset alias BankingGraph.Banking @entry_types [:credit, :debit] schema "entries" do field :description, :string field :type, :string field :client_id, :integer field :branch_id, :integer field :amount, :decimal field :transaction_reference, :string field :auth_account_id, :integer field :running_balance, :decimal belongs_to :account, BankingGraph.Banking.Account, foreign_key: :account_id timestamps() end @doc false def changeset(entry, attrs) do entry |> cast(attrs, [:type, :description, :account_id, :transaction_reference, :running_balance, :branch_id]) |> validate_required([:type, :description, :account_id, :transaction_reference, :running_balance, :branch_id]) end def from_tuple({type, account_id, description, amount, transaction_reference, auth_account_id, client_id, branch_id}) when type in @entry_types and is_binary(description) do account = Banking.get_account!(account_id) current_balance = Banking.account_balance(account) running_balance = case type do :credit -> case account.type do "liability" -> Decimal.add(current_balance, Decimal.new(amount)) "capital" -> Decimal.add(current_balance, Decimal.new(amount)) "asset" -> Decimal.sub(current_balance, Decimal.new(amount)) "income" -> Decimal.add(current_balance, Decimal.new(amount)) end :debit -> case account.type do "liability" -> Decimal.sub(current_balance, Decimal.new(amount)) "capital" -> Decimal.sub(current_balance, Decimal.new(amount)) "asset" -> Decimal.add(current_balance, Decimal.new(amount)) "income" -> Decimal.sub(current_balance, Decimal.new(amount)) end end %BankingGraph.Banking.Entry{ type: Atom.to_string(type), account_id: account_id, description: description, amount: amount, transaction_reference: transaction_reference, auth_account_id: auth_account_id, client_id: client_id, branch_id: branch_id, running_balance: running_balance } end end
38.184615
121
0.612812
08e45fb8c6a8b31a7781ee8d2b174bb09d4cb06d
3,012
exs
Elixir
xarb/test/xarb_web/controllers/user_confirmation_controller_test.exs
Erik-joh/examensarbete
951847f0ee5195abc0e3aa5f2b6fff78233127ee
[ "MIT" ]
null
null
null
xarb/test/xarb_web/controllers/user_confirmation_controller_test.exs
Erik-joh/examensarbete
951847f0ee5195abc0e3aa5f2b6fff78233127ee
[ "MIT" ]
null
null
null
xarb/test/xarb_web/controllers/user_confirmation_controller_test.exs
Erik-joh/examensarbete
951847f0ee5195abc0e3aa5f2b6fff78233127ee
[ "MIT" ]
null
null
null
defmodule XarbWeb.UserConfirmationControllerTest do use XarbWeb.ConnCase, async: true alias Xarb.Accounts alias Xarb.Repo import Xarb.AccountsFixtures setup do %{user: user_fixture()} end describe "GET /users/confirm" do test "renders the confirmation page", %{conn: conn} do conn = get(conn, Routes.user_confirmation_path(conn, :new)) response = html_response(conn, 200) assert response =~ "<h1>Resend confirmation instructions</h1>" end end describe "POST /users/confirm" do @tag :capture_log test "sends a new confirmation token", %{conn: conn, user: user} do conn = post(conn, Routes.user_confirmation_path(conn, :create), %{ "user" => %{"email" => user.email} }) assert redirected_to(conn) == "/" assert get_flash(conn, :info) =~ "If your email is in our system" assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "confirm" end test "does not send confirmation token if account is confirmed", %{conn: conn, user: user} do Repo.update!(Accounts.User.confirm_changeset(user)) conn = post(conn, Routes.user_confirmation_path(conn, :create), %{ "user" => %{"email" => user.email} }) assert redirected_to(conn) == "/" assert get_flash(conn, :info) =~ "If your email is in our system" refute Repo.get_by(Accounts.UserToken, user_id: user.id) end test "does not send confirmation token if email is invalid", %{conn: conn} do conn = post(conn, Routes.user_confirmation_path(conn, :create), %{ "user" => %{"email" => "unknown@example.com"} }) assert redirected_to(conn) == "/" assert get_flash(conn, :info) =~ "If your email is in our system" assert Repo.all(Accounts.UserToken) == [] end end describe "GET /users/confirm/:token" do test "confirms the given token once", %{conn: conn, user: user} do token = extract_user_token(fn url -> Accounts.deliver_user_confirmation_instructions(user, url) end) conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) assert redirected_to(conn) == "/" assert get_flash(conn, :info) =~ "Account confirmed successfully" assert Accounts.get_user!(user.id).confirmed_at refute get_session(conn, :user_token) assert Repo.all(Accounts.UserToken) == [] conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token)) assert redirected_to(conn) == "/" assert get_flash(conn, :error) =~ "Confirmation link is invalid or it has expired" end test "does not confirm email with invalid token", %{conn: conn, user: user} do conn = get(conn, Routes.user_confirmation_path(conn, :confirm, "oops")) assert redirected_to(conn) == "/" assert get_flash(conn, :error) =~ "Confirmation link is invalid or it has expired" refute Accounts.get_user!(user.id).confirmed_at end end end
35.435294
97
0.65073
08e464262f8bf9832368208756e56fe3d6fcf42a
585
ex
Elixir
installer/phoenix/templates/phx_api/router.ex
elixircnx/sanction
5b270fd6eef980d37c06429271f64ec14e0f622d
[ "BSD-3-Clause" ]
130
2016-06-21T07:58:46.000Z
2022-01-01T21:45:23.000Z
installer/phoenix/templates/phx_api/router.ex
elixircnx/sanction
5b270fd6eef980d37c06429271f64ec14e0f622d
[ "BSD-3-Clause" ]
50
2016-06-29T16:01:42.000Z
2019-08-07T21:33:49.000Z
installer/phoenix/templates/phx_api/router.ex
elixircnx/sanction
5b270fd6eef980d37c06429271f64ec14e0f622d
[ "BSD-3-Clause" ]
20
2016-07-02T11:37:33.000Z
2018-10-26T19:12:41.000Z
defmodule <%= base %>.Router do use <%= base %>.Web, :router import <%= base %>.Auth pipeline :api do plug :accepts, ["json"] plug :verify_token end scope "/api", <%= base %> do pipe_through :api post "/sessions/create", SessionController, :create resources "/users", UserController, except: [:new, :edit]<%= if confirm do %> get "/sessions/confirm_email", SessionController, :confirm_email post "/password_resets/create", PasswordResetController, :create put "/password_resets/update", PasswordResetController, :update<% end %> end end
27.857143
81
0.666667
08e46912c0db48dce8edfe7be8d40058cce168b0
2,737
ex
Elixir
clients/game_services/lib/google_api/game_services/v1beta/model/counter_options.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
null
null
null
clients/game_services/lib/google_api/game_services/v1beta/model/counter_options.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
1
2020-12-18T09:25:12.000Z
2020-12-18T09:25:12.000Z
clients/game_services/lib/google_api/game_services/v1beta/model/counter_options.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
1
2020-10-04T10:12:44.000Z
2020-10-04T10:12:44.000Z
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.GameServices.V1beta.Model.CounterOptions do @moduledoc """ Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. Field names correspond to IAM request parameters and field values are their respective values. Supported field names: - "authority", which is "[token]" if IAMContext.token is present, otherwise the value of IAMContext.authority_selector if present, and otherwise a representation of IAMContext.principal; or - "iam_principal", a representation of IAMContext.principal even if a token or authority selector is present; or - "" (empty string), resulting in a counter with no fields. Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/debug_access_count {iam_principal=[value of IAMContext.principal]} ## Attributes * `customFields` (*type:* `list(GoogleApi.GameServices.V1beta.Model.CustomField.t)`, *default:* `nil`) - Custom fields. * `field` (*type:* `String.t`, *default:* `nil`) - The field value to attribute. * `metric` (*type:* `String.t`, *default:* `nil`) - The metric to update. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :customFields => list(GoogleApi.GameServices.V1beta.Model.CustomField.t()), :field => String.t(), :metric => String.t() } field(:customFields, as: GoogleApi.GameServices.V1beta.Model.CustomField, type: :list) field(:field) field(:metric) end defimpl Poison.Decoder, for: GoogleApi.GameServices.V1beta.Model.CounterOptions do def decode(value, options) do GoogleApi.GameServices.V1beta.Model.CounterOptions.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.GameServices.V1beta.Model.CounterOptions do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
51.641509
934
0.745342
08e46bc4bb36ec5b2d1c7abd275f703d84ae3d39
963
exs
Elixir
lib/linking_modules_behaviours_and_use_1/tracer.exs
mikan/elixir-practice
624525605eb2324e0c55a4ddcb68388c0d2ecefc
[ "Apache-2.0" ]
null
null
null
lib/linking_modules_behaviours_and_use_1/tracer.exs
mikan/elixir-practice
624525605eb2324e0c55a4ddcb68388c0d2ecefc
[ "Apache-2.0" ]
1
2020-01-28T00:19:53.000Z
2020-01-28T00:19:53.000Z
lib/linking_modules_behaviours_and_use_1/tracer.exs
mikan/elixir-practice
624525605eb2324e0c55a4ddcb68388c0d2ecefc
[ "Apache-2.0" ]
null
null
null
defmodule Tracer do def dump_args(args) do args |> Enum.map(&inspect/1) |> Enum.join(", ") end def dump_defn(name, args) do "#{name}(#{dump_args(args)})" end defmacro def(definition = {name, _, args}, do: content) do quote do Kernel.def(unquote(definition)) do IO.puts "==> call: #{Tracer.dump_defn(unquote(name), unquote(args))}" result = unquote(content) # IO.puts "<== result: #{unquote(result)}" # variable "result" does not exist IO.puts "<== result: #{result}" result end end end defmacro __using__(_opts) do quote do import Kernel, except: [def: 2] import unquote(__MODULE__), only: [def: 2] end end end defmodule TracerTest do use Tracer def puts_sum_three(a, b, c), do: IO.inspect(a + b + c) def add_list(list), do: Enum.reduce(list, 0, &(&1 + &2)) end TracerTest.puts_sum_three(1, 2, 3) TracerTest.add_list([5, 6, 7, 8])
24.075
92
0.599169
08e46ca651aaf82b047f40e43485d7577f83d6a9
489
exs
Elixir
mix.exs
andersonmcook/filter_map
f52e98168724aa5a939cacb0f80a48922bb8a432
[ "MIT" ]
null
null
null
mix.exs
andersonmcook/filter_map
f52e98168724aa5a939cacb0f80a48922bb8a432
[ "MIT" ]
null
null
null
mix.exs
andersonmcook/filter_map
f52e98168724aa5a939cacb0f80a48922bb8a432
[ "MIT" ]
null
null
null
defmodule FilterMap.MixProject do use Mix.Project def project do [ app: :filter_map, version: "0.1.0", elixir: "~> 1.6", start_permanent: Mix.env() == :prod, deps: deps() ] end # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger] ] end # Run "mix help deps" to learn about dependencies. defp deps do [ {:benchee, "~> 0.11", only: :dev} ] end end
17.464286
59
0.572597
08e4dec80f7f3b1908ccbee3bb72a8a56d5eca2b
170
ex
Elixir
fixtures/elixir/get_without_headers.ex
kado0413/curlconverter
a532bd415853f350198d891e14c59babed16902e
[ "MIT" ]
1
2022-03-24T04:18:11.000Z
2022-03-24T04:18:11.000Z
fixtures/elixir/get_without_headers.ex
kado0413/curlconverter
a532bd415853f350198d891e14c59babed16902e
[ "MIT" ]
null
null
null
fixtures/elixir/get_without_headers.ex
kado0413/curlconverter
a532bd415853f350198d891e14c59babed16902e
[ "MIT" ]
null
null
null
request = %HTTPoison.Request{ method: :get, url: "http://indeed.com", options: [], headers: [], params: [], body: "" } response = HTTPoison.request(request)
15.454545
37
0.605882
08e4e187c3b5e660ebe8ff8d2bd05135feb54006
3,087
ex
Elixir
lib/aws/generated/mobileanalytics.ex
benmmari/aws-elixir
b97477498a9e8ba0d46a09255302d88c6a1c8573
[ "Apache-2.0" ]
null
null
null
lib/aws/generated/mobileanalytics.ex
benmmari/aws-elixir
b97477498a9e8ba0d46a09255302d88c6a1c8573
[ "Apache-2.0" ]
null
null
null
lib/aws/generated/mobileanalytics.ex
benmmari/aws-elixir
b97477498a9e8ba0d46a09255302d88c6a1c8573
[ "Apache-2.0" ]
null
null
null
# WARNING: DO NOT EDIT, AUTO-GENERATED CODE! # See https://github.com/aws-beam/aws-codegen for more details. defmodule AWS.Mobileanalytics do @moduledoc """ Amazon Mobile Analytics is a service for collecting, visualizing, and understanding app usage data at scale. """ @doc """ The PutEvents operation records one or more events. You can have up to 1,500 unique custom events per app, any combination of up to 40 attributes and metrics per custom event, and any number of attribute or metric values. """ def put_events(client, input, options \\ []) do path_ = "/2014-06-05/events" {headers, input} = [ {"clientContext", "x-amz-Client-Context"}, {"clientContextEncoding", "x-amz-Client-Context-Encoding"}, ] |> AWS.Request.build_params(input) query_ = [] request(client, :post, path_, query_, headers, input, options, 202) end @spec request(AWS.Client.t(), binary(), binary(), list(), list(), map(), list(), pos_integer()) :: {:ok, map() | nil, map()} | {:error, term()} defp request(client, method, path, query, headers, input, options, success_status_code) do client = %{client | service: "mobileanalytics"} host = build_host("mobileanalytics", client) url = host |> build_url(path, client) |> add_query(query, client) additional_headers = [{"Host", host}, {"Content-Type", "application/x-amz-json-1.1"}] headers = AWS.Request.add_headers(additional_headers, headers) payload = encode!(client, input) headers = AWS.Request.sign_v4(client, method, url, headers, payload) perform_request(client, method, url, payload, headers, options, success_status_code) end defp perform_request(client, method, url, payload, headers, options, success_status_code) do case AWS.Client.request(client, method, url, payload, headers, options) do {:ok, %{status_code: status_code, body: body} = response} when is_nil(success_status_code) and status_code in [200, 202, 204] when status_code == success_status_code -> body = if(body != "", do: decode!(client, body)) {:ok, body, response} {:ok, response} -> {:error, {:unexpected_response, response}} error = {:error, _reason} -> error end end defp build_host(_endpoint_prefix, %{region: "local", endpoint: endpoint}) do endpoint end defp build_host(_endpoint_prefix, %{region: "local"}) do "localhost" end defp build_host(endpoint_prefix, %{region: region, endpoint: endpoint}) do "#{endpoint_prefix}.#{region}.#{endpoint}" end defp build_url(host, path, %{:proto => proto, :port => port}) do "#{proto}://#{host}:#{port}#{path}" end defp add_query(url, [], _client) do url end defp add_query(url, query, client) do querystring = encode!(client, query, :query) "#{url}?#{querystring}" end defp encode!(client, payload, format \\ :json) do AWS.Client.encode!(client, payload, format) end defp decode!(client, payload) do AWS.Client.decode!(client, payload, :json) end end
33.923077
100
0.660512
08e51aa4fb0690e06e121c7975749182524b7048
1,004
ex
Elixir
lib/community_web/views/error_helpers.ex
idkjs/graphql-elixir-starter
7728e8ce67c32a2eb57c6be92ebe852da0145930
[ "MIT" ]
1
2018-01-16T10:28:38.000Z
2018-01-16T10:28:38.000Z
lib/community_web/views/error_helpers.ex
idkjs/graphql-elixir-starter
7728e8ce67c32a2eb57c6be92ebe852da0145930
[ "MIT" ]
null
null
null
lib/community_web/views/error_helpers.ex
idkjs/graphql-elixir-starter
7728e8ce67c32a2eb57c6be92ebe852da0145930
[ "MIT" ]
null
null
null
defmodule CommunityWeb.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ @doc """ Translates an error message using gettext. """ def translate_error({msg, opts}) do # Because error messages were defined within Ecto, we must # call the Gettext module passing our Gettext backend. We # also use the "errors" domain as translations are placed # in the errors.po file. # Ecto will pass the :count keyword if the error message is # meant to be pluralized. # On your own code and templates, depending on whether you # need the message to be pluralized or not, this could be # written simply as: # # dngettext "errors", "1 file", "%{count} files", count # dgettext "errors", "is invalid" # if count = opts[:count] do Gettext.dngettext(CommunityWeb.Gettext, "errors", msg, msg, count, opts) else Gettext.dgettext(CommunityWeb.Gettext, "errors", msg, opts) end end end
33.466667
78
0.674303
08e5213d48b36a985474160b7f6bc9584944f2ed
2,884
ex
Elixir
lib/triton/setup/materialized_view.ex
karpov-dn/triton
65dd7ee4dc2d899ca0e5874e82fa5b8744f99f98
[ "MIT" ]
71
2017-11-29T03:40:54.000Z
2022-01-10T22:11:48.000Z
lib/triton/setup/materialized_view.ex
karpov-dn/triton
65dd7ee4dc2d899ca0e5874e82fa5b8744f99f98
[ "MIT" ]
19
2018-04-13T18:25:05.000Z
2020-12-24T05:22:41.000Z
lib/triton/setup/materialized_view.ex
karpov-dn/triton
65dd7ee4dc2d899ca0e5874e82fa5b8744f99f98
[ "MIT" ]
23
2017-11-02T21:34:54.000Z
2021-08-24T08:29:34.000Z
defmodule Triton.Setup.MaterializedView do def setup(blueprint) do try do node_config = Application.get_env(:triton, :clusters) |> Enum.find( &(&1[:conn] == Module.concat(blueprint.__from__, Table).__struct__.__keyspace__.__struct__.__conn__) ) |> Keyword.take([:nodes, :authentication, :keyspace]) node_config = Keyword.put(node_config, :nodes, [node_config[:nodes] |> Enum.random()]) {:ok, _apps} = Application.ensure_all_started(:xandra) {:ok, conn} = Xandra.start_link(node_config) statement = build_cql(blueprint |> Map.delete(:__struct__)) Xandra.execute!(conn, "USE #{node_config[:keyspace]};", _params = []) Xandra.execute!(conn, statement, _params = []) rescue err -> IO.inspect(err) end end defp build_cql(blueprint) do create_cql(blueprint[:__name__]) <> select_cql(blueprint[:__fields__]) <> from_cql(blueprint[:__from__]) <> where_cql(blueprint[:__partition_key__], blueprint[:__cluster_columns__]) <> primary_key_cql(blueprint[:__partition_key__], blueprint[:__cluster_columns__]) <> with_options_cql(blueprint[:__with_options__]) end defp create_cql(name), do: "CREATE MATERIALIZED VIEW IF NOT EXISTS #{name}" defp select_cql(fields) when is_list(fields), do: " AS SELECT " <> Enum.join(fields, ", ") defp select_cql(_), do: " AS SELECT *" defp from_cql(module), do: " FROM #{Module.concat(module, Table).__struct__.__name__}" defp where_cql(pk, cc) when is_list(pk) and is_list(cc) do fields_not_null = (pk ++ cc) |> Enum.map(fn field -> "#{field} IS NOT NULL" end) |> Enum.join(" AND ") " WHERE #{fields_not_null}" end defp where_cql(pk, _) when is_list(pk) do fields_not_null = pk |> Enum.map(fn field -> "#{field} IS NOT NULL" end) |> Enum.join(" AND ") " WHERE #{fields_not_null}" end defp where_cql(_, _), do: "" defp primary_key_cql(partition_key, cluster_columns) when is_list(partition_key) and is_list(cluster_columns) do " PRIMARY KEY((" <> Enum.join(partition_key, ", ") <> "), #{Enum.join(cluster_columns, ", ")})" end defp primary_key_cql(partition_key, nil) when is_list(partition_key) do " PRIMARY KEY((" <> Enum.join(partition_key, ", ") <> "))" end defp primary_key_cql(_, _), do: "" defp with_options_cql(opts) when is_list(opts) do cql = opts |> Enum.map(fn opt -> with_option_cql(opt) end) |> Enum.join(" AND ") " WITH " <> cql end defp with_options_cql(_), do: "" defp with_option_cql({:clustering_order_by, opts}) do fields_and_order = opts |> Enum.map(fn {field, order} -> "#{field} #{order}" end) |> Enum.join(", ") "CLUSTERING ORDER BY (" <> fields_and_order <> ")" end defp with_option_cql({option, value}), do: "#{String.upcase(to_string(option))} = #{value}" end
36.506329
114
0.649098
08e5280d645d9e4557606a6a2694ba833ca1c005
1,742
ex
Elixir
clients/content/lib/google_api/content/v2/model/orderpayments_notify_auth_approved_request.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/model/orderpayments_notify_auth_approved_request.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/model/orderpayments_notify_auth_approved_request.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Content.V2.Model.OrderpaymentsNotifyAuthApprovedRequest do @moduledoc """ ## Attributes - authAmountPretax (Price): Defaults to: `null`. - authAmountTax (Price): Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :authAmountPretax => GoogleApi.Content.V2.Model.Price.t(), :authAmountTax => GoogleApi.Content.V2.Model.Price.t() } field(:authAmountPretax, as: GoogleApi.Content.V2.Model.Price) field(:authAmountTax, as: GoogleApi.Content.V2.Model.Price) end defimpl Poison.Decoder, for: GoogleApi.Content.V2.Model.OrderpaymentsNotifyAuthApprovedRequest do def decode(value, options) do GoogleApi.Content.V2.Model.OrderpaymentsNotifyAuthApprovedRequest.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Content.V2.Model.OrderpaymentsNotifyAuthApprovedRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.156863
97
0.754305
08e5598df4c673ef09baba2cf8fd41408667cead
1,129
exs
Elixir
test/changelog_web/views/feed_view_test.exs
PsOverflow/changelog.com
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
[ "MIT" ]
2,599
2016-10-25T15:02:53.000Z
2022-03-26T02:34:42.000Z
test/changelog_web/views/feed_view_test.exs
type1fool/changelog.com
fbec3528cc3f5adfdc75b008bb92b17efc4f248f
[ "MIT" ]
253
2016-10-25T20:29:24.000Z
2022-03-29T21:52:36.000Z
test/changelog_web/views/feed_view_test.exs
type1fool/changelog.com
fbec3528cc3f5adfdc75b008bb92b17efc4f248f
[ "MIT" ]
298
2016-10-25T15:18:31.000Z
2022-01-18T21:25:52.000Z
defmodule ChangelogWeb.FeedViewTest do use ChangelogWeb.ConnCase, async: true alias ChangelogWeb.FeedView describe "episode_title/2" do test "includes podcast in parentheses when master" do podcast = %{name: "Master", slug: "master"} episode = %{title: "Why testing is cool", slug: "bonus", podcast: %{name: "The Changelog"}} title = FeedView.episode_title(podcast, episode) assert title == "Why testing is cool (The Changelog)" end test "includes podcast and number in parentheses when master" do podcast = %{name: "Master", slug: "master"} episode = %{title: "Why testing is cool", slug: "12", podcast: %{name: "The Changelog"}} title = FeedView.episode_title(podcast, episode) assert title == "Why testing is cool (The Changelog #12)" end test "only includes episode title when not master" do podcast = %{name: "Practial AI", slug: "practicalai"} episode = %{title: "Why testing is cool", slug: "12", podcast: podcast} title = FeedView.episode_title(podcast, episode) assert title == "Why testing is cool" end end end
38.931034
97
0.666962
08e5634df6243003b5e679dd870099fd03bed9e3
474
exs
Elixir
config/test.exs
caromo/bracketeer
93b4fcaed0e4f6e83c49af6b3ed2573e3b44fac0
[ "MIT" ]
1
2019-06-20T20:29:10.000Z
2019-06-20T20:29:10.000Z
config/test.exs
caromo/bracketeer
93b4fcaed0e4f6e83c49af6b3ed2573e3b44fac0
[ "MIT" ]
3
2020-07-16T23:11:31.000Z
2021-05-08T14:44:21.000Z
config/test.exs
caromo/bracketeer
93b4fcaed0e4f6e83c49af6b3ed2573e3b44fac0
[ "MIT" ]
null
null
null
use Mix.Config # We don't run a server during test. If one is required, # you can enable the server option below. config :bracketeer, BracketeerWeb.Endpoint, http: [port: 4002], server: false # Print only warnings and errors during test config :logger, level: :warn # Configure your database config :bracketeer, Bracketeer.Repo, username: "postgres", password: "postgres", database: "bracketeer_test", hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox
24.947368
56
0.740506
08e56a0d9e6bbd60050123151e5d07c0a7de482c
23
ex
Elixir
testData/org/elixir_lang/parser_definition/matched_addition_operation_parsing_test_case/AtNonNumericOperation.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
1,668
2015-01-03T05:54:27.000Z
2022-03-25T08:01:20.000Z
testData/org/elixir_lang/parser_definition/matched_addition_operation_parsing_test_case/AtNonNumericOperation.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
2,018
2015-01-01T22:43:39.000Z
2022-03-31T20:13:08.000Z
testData/org/elixir_lang/parser_definition/matched_addition_operation_parsing_test_case/AtNonNumericOperation.ex
keyno63/intellij-elixir
4033e319992c53ddd42a683ee7123a97b5e34f02
[ "Apache-2.0" ]
145
2015-01-15T11:37:16.000Z
2021-12-22T05:51:02.000Z
@one + @two @one - @two
11.5
11
0.521739
08e56ac28b5f3355a5010b39d5107a7a0fe581ab
3,124
exs
Elixir
test/swoosh/email/recipient_test.exs
craigp/swoosh
83364b3e9029988e585d4cc0c4d5ec1ccfb4930a
[ "MIT" ]
1,214
2016-03-21T16:56:42.000Z
2022-03-31T19:10:11.000Z
test/swoosh/email/recipient_test.exs
craigp/swoosh
83364b3e9029988e585d4cc0c4d5ec1ccfb4930a
[ "MIT" ]
399
2016-03-21T23:11:32.000Z
2022-03-04T10:52:28.000Z
test/swoosh/email/recipient_test.exs
nash-io/swoosh
05c8676890da07403225c302f9a069fc7d221330
[ "MIT" ]
208
2016-03-21T21:12:11.000Z
2022-03-04T06:35:33.000Z
defmodule Swoosh.Email.RecipientTest do use ExUnit.Case, async: true alias Swoosh.Email.Recipient defmodule Avenger do @derive {Recipient, name: :name, address: :email} defstruct [:name, :email] end defmodule Villian do @derive {Recipient, address: :email} defstruct [:we_dont_care_about_their_names, :email] end defmodule Minion do defstruct [:banana, :wulala] end defimpl Recipient, for: Minion do def format(%Minion{banana: email, wulala: w}) do {"Minion #{w}", email} end end test "derive both name and address" do assert Recipient.format(%Avenger{name: "Thor", email: "thor@avengers.org"}) == {"Thor", "thor@avengers.org"} end test "derive address only" do assert Recipient.format(%Villian{ we_dont_care_about_their_names: "Random Villian", email: "random@villain.me" }) == {"", "random@villain.me"} end test "full impl" do assert Recipient.format(%Minion{banana: "baabababa@minions.org", wulala: "www"}) == {"Minion www", "baabababa@minions.org"} end test "raise when field not exist in struct" do assert_raise ArgumentError, fn -> defmodule Failed do @derive {Recipient, address: :not_there} defstruct [:there] end end end test "format tuple" do assert Recipient.format({"Hulk", "hulk@avengers.org"}) == {"Hulk", "hulk@avengers.org"} assert Recipient.format({nil, "hulk@avengers.org"}) == {"", "hulk@avengers.org"} end test "raise when format malformed tuple" do assert_raise ArgumentError, fn -> Recipient.format({nil, ""}) end assert_raise ArgumentError, fn -> Recipient.format({"Thanos", ""}) end assert_raise ArgumentError, fn -> Recipient.format({"Thanos", nil}) end end test "format string" do assert Recipient.format("vision@avengers.org") == {"", "vision@avengers.org"} end test "raise when format empty string" do assert_raise ArgumentError, fn -> Recipient.format("") end end test "raise when format nil / unimplemented type" do assert_raise Protocol.UndefinedError, ~r/Swoosh\.Email\.Recipient needs to be implemented/, fn -> Recipient.format(nil) end end test "test with email" do import Swoosh.Email assert %Swoosh.Email{ from: {"Admin", "admin@avengers.org"}, to: [{"", "random@villain.me"}], cc: [{"Thor", "thor@avengers.org"}, {"", "ironman@avengers.org"}], bcc: [{"Minion Bob", "hahaha@minions.org"}, {"", "thanos@villain.me"}], subject: "Peace, love, not war" } = new() |> subject("Peace, love, not war") |> from(%Avenger{name: "Admin", email: "admin@avengers.org"}) |> to(%Villian{email: "random@villain.me", we_dont_care_about_their_names: "Random"}) |> cc("ironman@avengers.org") |> cc({"Thor", "thor@avengers.org"}) |> bcc({nil, "thanos@villain.me"}) |> bcc(%Minion{banana: "hahaha@minions.org", wulala: "Bob"}) end end
32.206186
98
0.611076
08e577999080659dd2cc3f771c74305e71160295
1,683
exs
Elixir
lib/exercism/twelve-days/twelve_days.exs
sprql/experimentex
6c8a37ea03b74c5bfece1b2bec21c163a2f2df2f
[ "MIT" ]
null
null
null
lib/exercism/twelve-days/twelve_days.exs
sprql/experimentex
6c8a37ea03b74c5bfece1b2bec21c163a2f2df2f
[ "MIT" ]
null
null
null
lib/exercism/twelve-days/twelve_days.exs
sprql/experimentex
6c8a37ea03b74c5bfece1b2bec21c163a2f2df2f
[ "MIT" ]
null
null
null
defmodule TwelveDays do @days ~w(first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth) @presents [ "a Partridge in a Pear Tree", "two Turtle Doves", "three French Hens", "four Calling Birds", "five Gold Rings", "six Geese-a-Laying", "seven Swans-a-Swimming", "eight Maids-a-Milking", "nine Ladies Dancing", "ten Lords-a-Leaping", "eleven Pipers Piping", "twelve Drummers Drumming" ] @doc """ Given a `number`, return the song's verse for that specific day, including all gifts for previous days in the same line. """ @spec verse(number :: integer) :: String.t() def verse(number) do "On the #{Enum.at(@days, number - 1)} day of Christmas my true love gave to me, #{presents(number)}." end defp presents(number) when number == 1, do: Enum.at(@presents, 0) defp presents(number) when number > 1 do list = for i <- (number - 1)..1, do: Enum.at(@presents, i) joined_list = Enum.join(list, ", ") "#{joined_list}, and #{Enum.at(@presents, 0)}" end @doc """ Given a `starting_verse` and an `ending_verse`, return the verses for each included day, one per line. """ @spec verses(starting_verse :: integer, ending_verse :: integer) :: String.t() def verses(starting_verse, ending_verse) do list = for number <- starting_verse..ending_verse, do: verse(number) Enum.join(list, "\n") end @doc """ Sing all 12 verses, in order, one verse per line. """ @spec sing():: String.t() def sing do verses(1, 12) end end
25.892308
105
0.600119
08e577a42e3524e125edf825b27ffaa91ad83818
1,337
ex
Elixir
backend/lib/edgehog/astarte/device/cellular_connection/modem_status.ex
szakhlypa/edgehog
b1193c26f403132dead6964c1c052e5dcae533af
[ "Apache-2.0" ]
14
2021-12-02T16:31:16.000Z
2022-03-18T17:40:44.000Z
backend/lib/edgehog/astarte/device/cellular_connection/modem_status.ex
szakhlypa/edgehog
b1193c26f403132dead6964c1c052e5dcae533af
[ "Apache-2.0" ]
77
2021-11-03T15:14:41.000Z
2022-03-30T14:13:32.000Z
backend/lib/edgehog/astarte/device/cellular_connection/modem_status.ex
szakhlypa/edgehog
b1193c26f403132dead6964c1c052e5dcae533af
[ "Apache-2.0" ]
7
2021-11-03T10:58:37.000Z
2022-02-28T14:00:03.000Z
# # This file is part of Edgehog. # # Copyright 2022 SECO Mind Srl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 # defmodule Edgehog.Astarte.Device.CellularConnection.ModemStatus do @type t :: %__MODULE__{ slot: String.t(), carrier: String.t() | nil, cell_id: integer() | nil, mobile_country_code: integer() | nil, mobile_network_code: integer() | nil, local_area_code: integer() | nil, registration_status: String.t() | nil, rssi: float() | nil, technology: String.t() | nil } @enforce_keys [ :slot, :carrier, :cell_id, :mobile_country_code, :mobile_network_code, :local_area_code, :registration_status, :rssi, :technology ] defstruct @enforce_keys end
28.446809
74
0.670157
08e5845c907073447ac217fa4b4886384c31529f
7,652
ex
Elixir
lib/sanbase_web/graphql/document/document_provider.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
null
null
null
lib/sanbase_web/graphql/document/document_provider.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
1
2021-07-24T16:26:03.000Z
2021-07-24T16:26:03.000Z
lib/sanbase_web/graphql/document/document_provider.ex
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
null
null
null
defmodule SanbaseWeb.Graphql.DocumentProvider do @moduledoc ~s""" Custom Absinthe DocumentProvider for more effective caching. Absinthe phases have one main difference compared to plugs - all phases must run and cannot be halted. But phases can be jumped over by returning `{:jump, result, destination_phase}` This module makes use of 2 new phases - a `CacheDocument` phase and `Idempotent` phase. If the value is present in the cache it is put in the blueprint and the execution jumps to the Idempotent phase, effectively skipping the Absinthe's Resolution and Result phases. Result is the last phase in the pipeline so the Idempotent phase is inserted after it. If the value is not present in the cache, the Absinthe's default Resolution and Result phases are being executed and the new DocumentCache and Idempotent phases are doing nothing. In the end there's a `before_send` hook that adds the result into the cache. """ @behaviour Absinthe.Plug.DocumentProvider alias SanbaseWeb.Graphql.Cache @doc false @impl true def pipeline(%Absinthe.Plug.Request.Query{pipeline: pipeline}) do pipeline |> Absinthe.Pipeline.insert_before( Absinthe.Phase.Document.Complexity.Analysis, SanbaseWeb.Graphql.Phase.Document.Complexity.Preprocess ) |> Absinthe.Pipeline.insert_before( Absinthe.Phase.Document.Execution.Resolution, SanbaseWeb.Graphql.Phase.Document.Execution.CacheDocument ) |> Absinthe.Pipeline.insert_after( Absinthe.Phase.Document.Result, SanbaseWeb.Graphql.Phase.Document.Execution.Idempotent ) end @doc false @impl true def process(%Absinthe.Plug.Request.Query{document: nil} = query, _), do: {:cont, query} def process(%Absinthe.Plug.Request.Query{document: _} = query, _), do: {:halt, query} end defmodule SanbaseWeb.Graphql.Phase.Document.Execution.CacheDocument do @moduledoc ~s""" Custom phase for obtaining the result from cache. In case the value is not present in the cache, the default Resolution and Result phases are ran. Otherwise the custom Resolution phase is ran and Result is jumped over. When calculating the cache key only some of the fields in the whole blueprint are taken into account. They are defined in the module attribute @cache_fields The only values that are converted to something else during constructing of the cache key are: - DateTime - It is rounded by TTL so all datetiems in a range yield the same cache key - Struct - All structs are converted to plain maps """ use Absinthe.Phase alias SanbaseWeb.Graphql.Cache @compile inline: [add_cache_key_to_blueprint: 2, queries_in_request: 1] @cached_queries SanbaseWeb.Graphql.AbsintheBeforeSend.cached_queries() @spec run(Absinthe.Blueprint.t(), Keyword.t()) :: Absinthe.Phase.result_t() def run(bp_root, _) do queries_in_request = queries_in_request(bp_root) case Enum.any?(queries_in_request, &(&1 in @cached_queries)) do false -> {:ok, bp_root} true -> context = bp_root.execution.context # Add keys that can affect the data the user can have access to additional_keys_hash = {context.permissions, context.product_id, context.auth.subscription, context.auth.plan, context.auth.auth_method} |> Sanbase.Cache.hash() cache_key = SanbaseWeb.Graphql.Cache.cache_key( {"bp_root", additional_keys_hash}, santize_blueprint(bp_root), ttl: 120, max_ttl_offset: 120 ) bp_root = add_cache_key_to_blueprint(bp_root, cache_key) case Cache.get(cache_key) do nil -> {:ok, bp_root} result -> # Storing it again `touch`es it and the TTL timer is restarted. # This can lead to infinite storing the same value Process.put(:do_not_cache_query, true) {:jump, %{bp_root | result: result}, SanbaseWeb.Graphql.Phase.Document.Execution.Idempotent} end end end # Private functions defp queries_in_request(%{operations: operations}) do operations |> Enum.flat_map(fn %{selections: selections} -> selections |> Enum.map(fn %{name: name} -> Inflex.camelize(name, :lower) end) end) end defp add_cache_key_to_blueprint( %{execution: %{context: context} = execution} = blueprint, cache_key ) do %{ blueprint | execution: %{execution | context: Map.put(context, :query_cache_key, cache_key)} } end # Leave only the fields that are needed to generate the cache key # This let's us cache with values that are interpolated into the query string itself # The datetimes are rounded so all datetimes in a bucket generate the same # cache key defp santize_blueprint(%DateTime{} = dt), do: dt defp santize_blueprint({:argument_data, _} = tuple), do: tuple defp santize_blueprint({a, b}), do: {a, santize_blueprint(b)} @cache_fields [ :name, :argument_data, :selection_set, :selections, :fragments, :operations, :alias ] defp santize_blueprint(map) when is_map(map) do Map.take(map, @cache_fields) |> Enum.map(&santize_blueprint/1) |> Map.new() end defp santize_blueprint(list) when is_list(list) do Enum.map(list, &santize_blueprint/1) end defp santize_blueprint(data), do: data end defmodule SanbaseWeb.Graphql.Phase.Document.Execution.Idempotent do @moduledoc ~s""" A phase that does nothing and is inserted after the Absinthe's Result phase. `CacheDocument` phase jumps to this `Idempotent` phase if it finds the needed value in the cache so the Absinthe's Resolution and Result phases are skipped. """ use Absinthe.Phase @spec run(Absinthe.Blueprint.t(), Keyword.t()) :: Absinthe.Phase.result_t() def run(bp_root, _), do: {:ok, bp_root} end defmodule SanbaseWeb.Graphql.Phase.Document.Complexity.Preprocess do use Absinthe.Phase @spec run(Absinthe.Blueprint.t(), Keyword.t()) :: Absinthe.Phase.result_t() def run(bp_root, _) do bp_root.operations |> Enum.flat_map(fn %{selections: selections} -> selections |> Enum.flat_map(fn %{name: name, argument_data: %{metric: metric}} = struct -> case name |> Inflex.underscore() do "get_metric" -> selections = Enum.map(struct.selections, fn %{name: name} -> name |> Inflex.underscore() _ -> nil end) |> Enum.reject(&is_nil/1) # Put the metric name in the list 0, 1 or 2 times, depending # on the selections. `timeseries_data` and `aggregated_timeseries_data` # would go through the complexity code once, remiving the metric # name from the list both times - so it has to be there twice, while # `timeseries_data_complexity` won't go through that path. # `histogram_data` does not have complexity checks right now. # This is equivalent to X -- (X -- Y) because the `--` operator # has right to left associativity common_parts = selections -- selections -- ["timeseries_data", "aggregated_timeseries_data"] Enum.map(common_parts, fn _ -> metric end) _ -> [] end _ -> [] end) end) |> case do [_ | _] = metrics -> Process.put(:__metric_name_from_get_metric_api__, metrics) _ -> :ok end {:ok, bp_root} end end
33.858407
97
0.668191
08e58feeaad295bf0166c8571579c1341545a5a1
1,254
ex
Elixir
lib/tod_web/views/error_helpers.ex
webutil/tod
0abde2ae2295aee88a40933b66adf9b0c6e5992f
[ "MIT" ]
null
null
null
lib/tod_web/views/error_helpers.ex
webutil/tod
0abde2ae2295aee88a40933b66adf9b0c6e5992f
[ "MIT" ]
null
null
null
lib/tod_web/views/error_helpers.ex
webutil/tod
0abde2ae2295aee88a40933b66adf9b0c6e5992f
[ "MIT" ]
null
null
null
defmodule TODWeb.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ use Phoenix.HTML @doc """ Generates tag for inlined form input errors. """ def error_tag(form, field) do Enum.map(Keyword.get_values(form.errors, field), fn (error) -> content_tag :span, translate_error(error), class: "help-block" end) end @doc """ Translates an error message using gettext. """ def translate_error({msg, opts}) do # Because error messages were defined within Ecto, we must # call the Gettext module passing our Gettext backend. We # also use the "errors" domain as translations are placed # in the errors.po file. # Ecto will pass the :count keyword if the error message is # meant to be pluralized. # On your own code and templates, depending on whether you # need the message to be pluralized or not, this could be # written simply as: # # dngettext "errors", "1 file", "%{count} files", count # dgettext "errors", "is invalid" # if count = opts[:count] do Gettext.dngettext(TODWeb.Gettext, "errors", msg, msg, count, opts) else Gettext.dgettext(TODWeb.Gettext, "errors", msg, opts) end end end
30.585366
72
0.667464
08e5a6326414ac8c9f98786706b22f45d9c48190
301
ex
Elixir
src/exceptions.ex
James-P-D/ElixirDump
7e03958e2fc16152eeb0d3f291541d6ae83b5c13
[ "MIT" ]
null
null
null
src/exceptions.ex
James-P-D/ElixirDump
7e03958e2fc16152eeb0d3f291541d6ae83b5c13
[ "MIT" ]
null
null
null
src/exceptions.ex
James-P-D/ElixirDump
7e03958e2fc16152eeb0d3f291541d6ae83b5c13
[ "MIT" ]
null
null
null
# cd("C:\\Users\\jdorr\\Desktop\\Dev\\ElixirDump\\src") # c("exceptions.ex") # M.main defmodule M do def main do enums_stuff() end def enums_stuff() do err = try do 5 / 1 rescue ArithmeticError -> "Divide by zero!" end IO.puts err end end
14.333333
55
0.551495
08e5b86c23ea44b591fcc439d618cbf677195167
1,764
ex
Elixir
clients/sql_admin/lib/google_api/sql_admin/v1beta4/model/import_context_csv_import_options.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/sql_admin/lib/google_api/sql_admin/v1beta4/model/import_context_csv_import_options.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/sql_admin/lib/google_api/sql_admin/v1beta4/model/import_context_csv_import_options.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.SQLAdmin.V1beta4.Model.ImportContextCsvImportOptions do @moduledoc """ Options for importing data as CSV. ## Attributes - columns ([String.t]): The columns to which CSV data is imported. If not specified, all columns of the database table are loaded with CSV data. Defaults to: `null`. - table (String.t): The table to which CSV data is imported. Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :columns => list(any()), :table => any() } field(:columns, type: :list) field(:table) end defimpl Poison.Decoder, for: GoogleApi.SQLAdmin.V1beta4.Model.ImportContextCsvImportOptions do def decode(value, options) do GoogleApi.SQLAdmin.V1beta4.Model.ImportContextCsvImportOptions.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.SQLAdmin.V1beta4.Model.ImportContextCsvImportOptions do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.588235
167
0.743197
08e5cf93f7aca78cd0e6743ead8f9e1df961ac2a
1,068
ex
Elixir
lib/matrix.ex
nemanja-m/matrix
92298697827f30a2d6ba144004c1668fe70b760e
[ "MIT" ]
null
null
null
lib/matrix.ex
nemanja-m/matrix
92298697827f30a2d6ba144004c1668fe70b760e
[ "MIT" ]
null
null
null
lib/matrix.ex
nemanja-m/matrix
92298697827f30a2d6ba144004c1668fe70b760e
[ "MIT" ]
null
null
null
defmodule Matrix do use Application def start(_type, _args) do import Supervisor.Spec # Import defined agents into VM agent_types = Matrix.AgentManager.import_agent_types # Generate supervisors for imported agents agent_supervisors = Matrix.AgentManager.generate_agent_supervisor_modules(agent_types) |> Enum.map(fn module -> supervisor(module, []) end) # Define workers and child supervisors to be supervised children = [ supervisor(Matrix.Endpoint, []), worker(Matrix.Cluster, []), worker(Matrix.Agents, [agent_types]), worker(Matrix.Heartbeat, []) ] opts = [strategy: :one_for_one, name: Matrix.Supervisor] pid = Supervisor.start_link(children ++ agent_supervisors, opts) # Register this node to network Matrix.ConnectionManager.register_self pid end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do Matrix.Endpoint.config_change(changed, removed) :ok end end
27.384615
72
0.71161
08e5d1e28ff3a17ddd281ad4a3ba929e602b154f
1,068
ex
Elixir
lib/day1/challenge_two.ex
AJPcodes/advent_of_code_2018
1c24bd41cd3b8e556e91e7d1e8ff4bbb1edf5235
[ "MIT" ]
1
2018-12-04T19:54:13.000Z
2018-12-04T19:54:13.000Z
lib/day1/challenge_two.ex
AJPcodes/advent_of_code_2018
1c24bd41cd3b8e556e91e7d1e8ff4bbb1edf5235
[ "MIT" ]
null
null
null
lib/day1/challenge_two.ex
AJPcodes/advent_of_code_2018
1c24bd41cd3b8e556e91e7d1e8ff4bbb1edf5235
[ "MIT" ]
null
null
null
defmodule D1.Ch2 do @input_file_path './challenge_inputs/day_one/challenge_one.txt' def start do @input_file_path |> ChallengeFileLoader.parse_file_to_lines() |> Enum.map(&String.to_integer(&1)) |> dupe_check end defp dupe_check([h | t] = list) do frequencies = MapSet.new([0]) dupe_check([h | t], 0, frequencies, list) end defp dupe_check([h | []], current_frequency, frequencies, full_list) do new_frequency = current_frequency + h if MapSet.member?(frequencies, new_frequency) do new_frequency else updated_frequencies = MapSet.put(frequencies, new_frequency) dupe_check(full_list, new_frequency, updated_frequencies, full_list) end end defp dupe_check([h | t], current_frequency, frequencies, full_list) do new_frequency = current_frequency + h if MapSet.member?(frequencies, new_frequency) do new_frequency else updated_frequencies = MapSet.put(frequencies, new_frequency) dupe_check(t, new_frequency, updated_frequencies, full_list) end end end
27.384615
74
0.71161
08e5d678c7c49e9f505354e4d5909f25a759f2b9
3,029
ex
Elixir
priv/perf/apps/load_test/lib/child_chain/utxos.ex
boolafish/elixir-omg
46b568404972f6e4b4da3195d42d4fb622edb934
[ "Apache-2.0" ]
null
null
null
priv/perf/apps/load_test/lib/child_chain/utxos.ex
boolafish/elixir-omg
46b568404972f6e4b4da3195d42d4fb622edb934
[ "Apache-2.0" ]
null
null
null
priv/perf/apps/load_test/lib/child_chain/utxos.ex
boolafish/elixir-omg
46b568404972f6e4b4da3195d42d4fb622edb934
[ "Apache-2.0" ]
null
null
null
# Copyright 2019-2020 OmiseGO Pte Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. defmodule LoadTest.ChildChain.Utxos do @moduledoc """ Utility functions for utxos """ alias ExPlasma.Encoding alias ExPlasma.Utxo alias LoadTest.ChildChain.Transaction alias LoadTest.Connection.WatcherInfo, as: Connection alias WatcherInfoAPI.Api alias WatcherInfoAPI.Model @doc """ Returns an addresses utxos. """ @spec get_utxos(Utxo.address_binary()) :: list(Utxo.t()) def get_utxos(address) do body = %Model.AddressBodySchema1{ address: Encoding.to_hex(address) } {:ok, response} = Api.Account.account_get_utxos(Connection.client(), body) utxos = Jason.decode!(response.body)["data"] Enum.map( utxos, fn x -> %Utxo{ blknum: x["blknum"], txindex: x["txindex"], oindex: x["oindex"], currency: x["currency"], amount: x["amount"] } end ) end @doc """ Returns the highest value utxo of a given currency """ @spec get_largest_utxo(list(Utxo.t()), Utxo.address_binary()) :: Utxo.t() def get_largest_utxo([], _currency), do: nil def get_largest_utxo(utxos, currency) do utxos |> Enum.filter(fn utxo -> currency == LoadTest.Utils.Encoding.from_hex(utxo.currency) end) |> Enum.max_by(fn x -> x.amount end, fn -> nil end) end @doc """ Merges all the given utxos into one. Note that this can take several iterations to complete. """ @spec merge(list(Utxo.t()), Utxo.address_binary(), Account.t()) :: Utxo.t() def merge(utxos, currency, faucet_account) do utxos |> Enum.filter(fn utxo -> LoadTest.Utils.Encoding.from_hex(utxo.currency) == currency end) |> merge(faucet_account) end @spec merge(list(Utxo.t()), Account.t()) :: Utxo.t() defp merge([], _faucet_account), do: :error_empty_utxo_list defp merge([single_utxo], _faucet_account), do: single_utxo defp merge(utxos, faucet_account) when length(utxos) > 4 do utxos |> Enum.chunk_every(4) |> Enum.map(fn inputs -> merge(inputs, faucet_account) end) |> merge(faucet_account) end defp merge([%{currency: currency} | _] = inputs, faucet_account) do tx_amount = Enum.reduce(inputs, 0, fn x, acc -> x.amount + acc end) output = %Utxo{amount: tx_amount, currency: currency, owner: faucet_account.addr} [utxo] = Transaction.submit_tx( inputs, [output], List.duplicate(faucet_account, length(inputs)) ) utxo end end
29.990099
94
0.671509
08e60c98afd71d51bce8d601ddfc57e1bc4d76d0
69
exs
Elixir
config/test.exs
kianmeng/broadway_cloud_pub_sub
0d59845c16864aa336e8399b12b33ace7a772cd5
[ "Apache-2.0" ]
25
2020-02-03T13:35:49.000Z
2022-03-07T06:09:40.000Z
config/test.exs
kianmeng/broadway_cloud_pub_sub
0d59845c16864aa336e8399b12b33ace7a772cd5
[ "Apache-2.0" ]
29
2020-01-25T04:43:37.000Z
2022-02-28T17:17:12.000Z
config/test.exs
kianmeng/broadway_cloud_pub_sub
0d59845c16864aa336e8399b12b33ace7a772cd5
[ "Apache-2.0" ]
18
2020-01-24T15:26:29.000Z
2022-02-27T01:03:47.000Z
use Mix.Config # Disable Goth in tests config :goth, disabled: true
13.8
28
0.753623
08e60fd534e874555dc61387de312c696acd43d9
142
exs
Elixir
config/config.exs
terianil/geetest3
8a6edaf3d893b1ef57fe140bfe807f5074686a24
[ "MIT" ]
1
2020-04-29T09:40:11.000Z
2020-04-29T09:40:11.000Z
config/config.exs
terianil/geetest3
8a6edaf3d893b1ef57fe140bfe807f5074686a24
[ "MIT" ]
null
null
null
config/config.exs
terianil/geetest3
8a6edaf3d893b1ef57fe140bfe807f5074686a24
[ "MIT" ]
null
null
null
use Mix.Config config :geetest3, :config, id: {:system, "GEETEST3_ID"}, key: {:system, "GEETEST3_KEY"} import_config "#{Mix.env()}.exs"
17.75
32
0.661972
08e61ab224d88e702693dbc10d643006141d797e
1,935
ex
Elixir
lib/utxo_store.ex
endlos/elixium_core
e4849d0934713accde357f7687bd0bcfbe4d2929
[ "MIT" ]
1
2018-06-28T20:34:05.000Z
2018-06-28T20:34:05.000Z
lib/utxo_store.ex
endlos/elixium_core
e4849d0934713accde357f7687bd0bcfbe4d2929
[ "MIT" ]
null
null
null
lib/utxo_store.ex
endlos/elixium_core
e4849d0934713accde357f7687bd0bcfbe4d2929
[ "MIT" ]
null
null
null
defmodule UltraDark.UtxoStore do use UltraDark.Store @moduledoc """ Provides an interface for interacting with the UTXOs stored in level db """ @store_dir ".utxo" def initialize do initialize(@store_dir) end @doc """ Add a utxo to leveldb, indexing it by its txoid """ @spec add_utxo(map) :: :ok | {:error, any} def add_utxo(utxo) do transact @store_dir do &Exleveldb.put(&1, String.to_atom(utxo.txoid), :erlang.term_to_binary(utxo)) end end @spec remove_utxo(String.t()) :: :ok | {:error, any} def remove_utxo(txoid) do transact @store_dir do &Exleveldb.delete(&1, String.to_atom(txoid)) end end @doc """ Retrieve a UTXO by its txoid """ @spec retrieve_utxo(String.t()) :: map def retrieve_utxo(txoid) do transact @store_dir do fn ref -> {:ok, utxo} = Exleveldb.get(ref, String.to_atom(txoid)) :erlang.binary_to_term(utxo) end end end @spec retrieve_all_utxos :: list def retrieve_all_utxos do transact @store_dir do &Exleveldb.map(&1, fn {_, utxo} -> :erlang.binary_to_term(utxo) end) end end @spec update_with_transactions(list) :: :ok | {:error, any} def update_with_transactions(transactions) do transact @store_dir do fn ref -> remove = transactions |> Enum.flat_map(& &1.inputs) |> Enum.map(&{:delete, &1.txoid}) add = transactions |> Enum.flat_map(& &1.outputs) |> Enum.map(&{:put, &1.txoid, :erlang.term_to_binary(&1)}) Exleveldb.write(ref, Enum.concat(remove, add)) end end end @spec find_by_address(String.t()) :: list def find_by_address(public_key) do transact @store_dir do fn ref -> ref |> Exleveldb.map(fn {_, utxo} -> :erlang.binary_to_term(utxo) end) |> Enum.filter(&(&1.addr == public_key)) end end end end
23.888889
82
0.61292
08e6391e7c99d927f02d3832635050bcd63bfbaf
571
exs
Elixir
samples/deactivate_output.exs
kimshrier/benchee
a295b4fd538c1d1b204f2f565daff94fcd53558c
[ "MIT" ]
null
null
null
samples/deactivate_output.exs
kimshrier/benchee
a295b4fd538c1d1b204f2f565daff94fcd53558c
[ "MIT" ]
null
null
null
samples/deactivate_output.exs
kimshrier/benchee
a295b4fd538c1d1b204f2f565daff94fcd53558c
[ "MIT" ]
null
null
null
# Deactivate the fast warnings if they annoy you # You can also deactivate the comparison report Benchee.run(%{ "fast" => fn -> 1 + 1 end, "also" => fn -> 20 * 20 end }, time: 2, warmup: 1, print: [ benchmarking: false, configuration: false, fast_warning: false ], console: [ comparison: false ]) # tobi@speedy ~/github/benchee $ mix run samples/deactivate_output.exs # # Name ips average deviation median # fast 88.43 M 0.0113 μs ±64.63% 0.0110 μs # also 87.23 M 0.0115 μs ±57.19% 0.0110 μs
24.826087
70
0.598949
08e66f7f61f70b92e8d7d45577a78cd323609c18
48
exs
Elixir
HelloWorld.exs
muchshibewow/Hello-World
fe55089dd8a3f1b5252b1ff52f20811c30aafa63
[ "MIT" ]
442
2018-10-02T09:00:04.000Z
2019-07-30T10:56:04.000Z
HelloWorld.exs
muchshibewow/Hello-World
fe55089dd8a3f1b5252b1ff52f20811c30aafa63
[ "MIT" ]
121
2018-10-02T09:01:50.000Z
2019-07-08T00:28:55.000Z
HelloWorld.exs
muchshibewow/Hello-World
fe55089dd8a3f1b5252b1ff52f20811c30aafa63
[ "MIT" ]
1,887
2018-10-02T09:03:24.000Z
2019-07-31T18:32:31.000Z
# elixir HelloWorld.exs IO.puts "Hello World!"
12
23
0.729167
08e676e3007e0659083836ae38dee043e4a56547
1,643
exs
Elixir
test/pix_request_log_test.exs
starkinfra/sdk-elixir
d434de336ad7d2331b860519f04e9d107bb9c9cd
[ "MIT" ]
1
2022-03-15T18:58:21.000Z
2022-03-15T18:58:21.000Z
test/pix_request_log_test.exs
starkinfra/sdk-elixir
d434de336ad7d2331b860519f04e9d107bb9c9cd
[ "MIT" ]
null
null
null
test/pix_request_log_test.exs
starkinfra/sdk-elixir
d434de336ad7d2331b860519f04e9d107bb9c9cd
[ "MIT" ]
null
null
null
defmodule StarkInfraTest.PixRequest.Log do use ExUnit.Case @tag :pix_request_log test "get pix request log" do log = StarkInfra.PixRequest.Log.query!(limit: 1) |> Enum.take(1) |> hd() {:ok, unique_log} = StarkInfra.PixRequest.Log.get(log.id) assert unique_log.id == log.id end @tag :pix_request_log test "get! pix request log" do log = StarkInfra.PixRequest.Log.query!(limit: 1) |> Enum.take(1) |> hd() unique_log = StarkInfra.PixRequest.Log.get!(log.id) assert unique_log.id == log.id end @tag :pix_request_log test "query pix request log" do StarkInfra.PixRequest.Log.query(limit: 101) |> Enum.take(200) |> (fn list -> assert length(list) <= 101 end).() end @tag :pix_request_log test "query! pix request log" do StarkInfra.PixRequest.Log.query!(limit: 101) |> Enum.take(200) |> (fn list -> assert length(list) <= 101 end).() end @tag :pix_request_log test "query! pix request log with filters" do pix_request = StarkInfra.PixRequest.query!(limit: 1) |> Enum.take(1) |> hd() StarkInfra.PixRequest.Log.query!(limit: 1, request_ids: [pix_request.id]) |> Enum.take(5) |> (fn list -> assert length(list) == 1 end).() end @tag :pix_request_log test "page pix request log" do {:ok, ids} = StarkInfraTest.Utils.Page.get(&StarkInfra.PixRequest.Log.page/1, 2, limit: 5) assert length(ids) <= 10 end @tag :pix_request_log test "page! pix request log" do ids = StarkInfraTest.Utils.Page.get!(&StarkInfra.PixRequest.Log.page!/1, 2, limit: 5) assert length(ids) <= 10 end end
26.079365
94
0.645161
08e67ae2d263d1f8222dd522d24bc6cf4a7205d0
3,041
exs
Elixir
test/changeset_parser_custom_field_constructor_test.exs
scottming/absinthe_error_payload
500f7fa2ad1c17eeba644e7922dd0275994f6f94
[ "MIT", "BSD-3-Clause" ]
90
2019-04-30T00:21:58.000Z
2022-02-02T15:28:25.000Z
test/changeset_parser_custom_field_constructor_test.exs
scottming/absinthe_error_payload
500f7fa2ad1c17eeba644e7922dd0275994f6f94
[ "MIT", "BSD-3-Clause" ]
18
2019-05-01T19:24:16.000Z
2022-01-04T07:22:43.000Z
test/changeset_parser_custom_field_constructor_test.exs
scottming/absinthe_error_payload
500f7fa2ad1c17eeba644e7922dd0275994f6f94
[ "MIT", "BSD-3-Clause" ]
25
2019-05-24T23:57:24.000Z
2022-02-25T19:16:23.000Z
defmodule AbsintheErrorPayload.ChangesetParserCustomFieldConstructorTest do @moduledoc """ Test conversion of changeset errors to ValidationMessage structs """ use ExUnit.Case, async: false import Ecto.Changeset alias AbsintheErrorPayload.ChangesetParser alias AbsintheErrorPayload.ValidationMessage # taken from Ecto.changeset tests defmodule Author do @moduledoc false use Ecto.Schema schema "author" do field(:name, :string) end end defmodule Tag do @moduledoc false use Ecto.Schema schema "tags" do field(:name, :string) end end defmodule Post do @moduledoc false use Ecto.Schema schema "posts" do field(:title, :string, default: "") field(:body) field(:uuid, :binary_id) field(:decimal, :decimal) field(:upvotes, :integer, default: 0) field(:topics, {:array, :string}) field(:virtual, :string, virtual: true) field(:published_at, :naive_datetime) belongs_to(:author, Author) has_many(:tags, Tag) end end defp changeset(params) do cast(%Post{}, params, ~w(title body upvotes decimal topics virtual)a) end defmodule CustomFieldConstructor do @behaviour AbsintheErrorPayload.FieldConstructor def error(parent_field, field, options \\ []) def error(parent_field, nil, _options), do: "@root›#{parent_field}" def error(parent_field, field, index: index), do: "#{parent_field}@#{index}›#{field}" def error(parent_field, field, _options), do: "#{parent_field}›#{field}" end setup do Application.put_env(:absinthe_error_payload, :field_constructor, CustomFieldConstructor) end describe "construct_message/2" do test "creates expected struct" do message = "can't be %{illegal}" options = [code: "foobar"] message = ChangesetParser.construct_message(:title, {message, options}) assert %ValidationMessage{} = message assert message.field == "@root›title" end end test "nested fields" do changeset = %{"author" => %{"name" => ""}} |> changeset() |> cast_assoc(:author, with: fn author, params -> author |> cast(params, ~w(name)a) |> validate_required(:name) end ) result = ChangesetParser.extract_messages(changeset) assert [first] = result assert %ValidationMessage{code: :required, field: "author›name", key: :name} = first end test "nested fields with index" do changeset = %{"tags" => [%{"name" => ""}, %{"name" => ""}]} |> changeset() |> cast_assoc(:tags, with: fn tag, params -> tag |> cast(params, ~w(name)a) |> validate_required(:name) end ) result = ChangesetParser.extract_messages(changeset) assert [first, second] = result assert %ValidationMessage{code: :required, field: "tags@0›name", key: :name} = first assert %ValidationMessage{code: :required, field: "tags@1›name", key: :name} = second end end
26.443478
92
0.641236
08e68fa14eae6e4c00cb360fd858e6828d0c02f2
2,644
ex
Elixir
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__text_segment.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__text_segment.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__text_segment.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextSegment do @moduledoc """ Video segment level annotation results for text detection. ## Attributes * `confidence` (*type:* `number()`, *default:* `nil`) - Confidence for the track of detected text. It is calculated as the highest over all frames where OCR detected text appears. * `frames` (*type:* `list(GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextFrame.t)`, *default:* `nil`) - Information related to the frames where OCR detected text appears. * `segment` (*type:* `GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_VideoSegment.t`, *default:* `nil`) - Video segment where a text snippet was detected. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :confidence => number(), :frames => list( GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextFrame.t() ), :segment => GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_VideoSegment.t() } field(:confidence) field(:frames, as: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextFrame, type: :list ) field(:segment, as: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_VideoSegment ) end defimpl Poison.Decoder, for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextSegment do def decode(value, options) do GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextSegment.decode( value, options ) end end defimpl Poison.Encoder, for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_TextSegment do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
37.771429
206
0.750378
08e6912c194270bda3921b8bae0883028f3608fa
1,151
ex
Elixir
lib/pigeon/adm/result_parser.ex
inside-track/pigeon
596e721b5a2bdafbe61f6626b159a897c670b9f1
[ "MIT" ]
null
null
null
lib/pigeon/adm/result_parser.ex
inside-track/pigeon
596e721b5a2bdafbe61f6626b159a897c670b9f1
[ "MIT" ]
null
null
null
lib/pigeon/adm/result_parser.ex
inside-track/pigeon
596e721b5a2bdafbe61f6626b159a897c670b9f1
[ "MIT" ]
null
null
null
defmodule Pigeon.ADM.ResultParser do @moduledoc false @doc ~S""" Parses response and updates notification. ## Examples iex> parse(%Pigeon.ADM.Notification{}, %{}, fn(x) -> x end) %Pigeon.ADM.Notification{response: :success} iex> parse(%Pigeon.ADM.Notification{}, %{"registrationID" => "test"}, ...> fn(x) -> x end) %Pigeon.ADM.Notification{response: :update, updated_registration_id: "test"} iex> parse(%Pigeon.ADM.Notification{}, %{"reason" => "InvalidRegistration"}, ...> fn(x) -> x end) %Pigeon.ADM.Notification{response: :invalid_registration} """ # Handle RegID updates def parse(notification, %{"registrationID" => new_regid}, on_response) do n = %{notification | response: :update, updated_registration_id: new_regid} on_response.(n) end def parse(notification, %{"reason" => error}, on_response) do error = error |> Macro.underscore |> String.to_existing_atom n = %{notification | response: error} on_response.(n) end def parse(notification, %{}, on_response) do n = %{notification | response: :success} on_response.(n) end end
30.289474
82
0.652476
08e69fa0c06998f106ea5515108b5ba1697201ea
8,645
exs
Elixir
test/types_test.exs
elixir-maru/maru_params
4bc1d05008e881136aff87667791ed4da1c12bd4
[ "WTFPL" ]
4
2021-12-29T06:45:02.000Z
2022-02-10T12:48:57.000Z
test/types_test.exs
elixir-maru/maru_params
4bc1d05008e881136aff87667791ed4da1c12bd4
[ "WTFPL" ]
null
null
null
test/types_test.exs
elixir-maru/maru_params
4bc1d05008e881136aff87667791ed4da1c12bd4
[ "WTFPL" ]
1
2021-12-29T06:45:03.000Z
2021-12-29T06:45:03.000Z
defmodule Ecto.Enum do def values(User, :fruit), do: [:apple] def values(Nested.User2, :fruit), do: [:apple] def dump_values(User, :fruit), do: ["apple"] def dump_values(Nested.User2, :fruit), do: ["apple"] end defmodule Maru.Params.OptionTest do def values(role), do: [values: [:foo, role]] end defmodule Maru.Params.TypesTest do use ExUnit.Case, async: true alias Maru.Params.ParseError defmodule T do alias Nested.User2 use Maru.Params.TestHelper params :atom do optional :role, Atom, values: [:role1, :role2] optional :name, Atom, Maru.Params.OptionTest.values(:bar) optional :fruit, Atom, ecto_enum: {User, :fruit} optional :fruit2, Atom, ecto_enum: {User2, :fruit} end params :base64 do optional :d1, Base64 optional :d2, Base64, options: [padding: false] end params :boolean do optional :b1, Boolean optional :b2, Boolean end params :datetime do optional :d01, DateTime, format: :iso8601 optional :d02, DateTime, format: :unix optional :d03, DateTime, format: {:unix, :microsecond} optional :d04, DateTime, format: :iso8601, naive: true optional :d05, DateTime, format: :unix, naive: true optional :d06, DateTime, format: {:unix, :microsecond}, naive: true optional :d07, DateTime, format: :iso8601, truncate: :second optional :d08, DateTime, format: :iso8601, naive: true, truncate: :second optional :d09, DateTime, format: {:unix, :microsecond}, truncate: :millisecond optional :d10, DateTime, format: {:unix, :microsecond}, naive: true, truncate: :second optional :d11, DateTime optional :d12, DateTime, naive: true end params :float do optional :pi1, Float optional :pi2, Float, style: :decimals end params :integer do optional :i1, Integer optional :i2, Integer, min: 1 optional :i3, Integer, max: 11 optional :i4, Integer, range: 5..10 end params :json do optional :j1, Json |> Integer optional :j2, Json |> String optional :j3, Json |> List[Integer], max_length: 3 optional :j4, Json, json_library_options: [keys: :atoms] end params :list do optional :l1, List[Integer] optional :l2, List[Integer], string_strategy: :codepoints optional :l3, List[Integer], string_strategy: :charlist optional :l4, List[String], max_length: 2 optional :l5, List[String], min_length: 2 optional :l6, List[String], length_range: 2..4 optional :l7, List[Integer], unique: true end params :map do optional :m1, Map end params :string do optional :s1, String optional :s2, String, style: :upcase optional :s3, String, style: :downcase optional :s4, String, style: :camelcase optional :s5, String, style: :snakecase optional :s6, String, regex: ~r/^\d{1,3}$/ optional :s7, String, values: ["x", "y"] optional :s8, String, regex: :uuid end end test "atom" do assert %{fruit: :apple, role: :role1} = T.atom(%{"role" => "role1", "fruit" => "apple"}) assert %{fruit2: :apple, role: :role1} = T.atom(%{"role" => "role1", "fruit2" => "apple"}) assert %{name: :foo} = T.atom(%{"name" => "foo"}) assert %{name: :bar} = T.atom(%{"name" => :bar}) assert_raise ParseError, ~r/Parse Parameter role Error/, fn -> T.atom(%{"role" => "role3"}) end assert_raise ParseError, ~r/Validate Parameter role Error/, fn -> T.atom(%{"role" => "apple"}) end assert_raise ParseError, ~r/Validate Parameter fruit Error/, fn -> T.atom(%{"fruit" => "hehe"}) end end test "base64" do assert %{d2: "foob"} = T.base64(%{"d2" => "Zm9vYg"}) assert_raise ParseError, ~r/Parse Parameter d1 Error/, fn -> T.base64(%{"d1" => "Zm9vYg"}) end end test "boolean" do assert %{b1: true, b2: false} = T.boolean(%{"b1" => "true", "b2" => false}) end test "datetime" do assert %{ d01: ~U[2015-01-23 21:20:07.123Z], d02: ~U[2016-05-24 13:26:08Z], d03: ~U[2015-05-25 13:26:08.868569Z], d04: ~N[2015-01-23 23:50:07.123], d05: ~N[2016-05-24 13:26:08], d06: ~N[2015-05-25 13:26:08.868569], d07: ~U[2015-01-23 23:50:07Z], d08: ~N[2015-01-23 23:50:07], d09: ~U[2015-05-25 13:26:08.868Z], d10: ~N[2015-05-25 13:26:08] } = T.datetime(%{ "d01" => "2015-01-23T23:50:07.123+02:30", "d02" => 1_464_096_368, "d03" => 1_432_560_368_868_569, "d04" => "2015-01-23T23:50:07.123+02:30", "d05" => 1_464_096_368, "d06" => 1_432_560_368_868_569, "d07" => "2015-01-23T23:50:07.123456789Z", "d08" => "2015-01-23T23:50:07.123456789Z", "d09" => 1_432_560_368_868_569, "d10" => 1_432_560_368_868_569 }) assert %{d11: ~U[2015-05-25 13:26:08Z]} = T.datetime(%{"d11" => ~U[2015-05-25 13:26:08Z]}) assert %{d12: ~N[2015-05-25 13:26:08]} = T.datetime(%{"d12" => ~U[2015-05-25 13:26:08Z]}) assert %{d12: ~N[2015-05-25 13:26:08]} = T.datetime(%{"d12" => ~N[2015-05-25 13:26:08]}) assert_raise ParseError, ~r/Parse Parameter d11 Error/, fn -> T.datetime(%{"d11" => ~N[2015-05-25 13:26:08Z]}) end end test "float" do d = Decimal.new("3.14") assert %{pi1: 3.14, pi2: ^d} = T.float(%{"pi1" => 3.14, "pi2" => 3.14}) assert %{pi1: 3.14, pi2: ^d} = T.float(%{"pi1" => "3.14x", "pi2" => "3.14"}) assert_raise ParseError, ~r/Parse Parameter pi1 Error/, fn -> T.float(%{"pi1" => "x.xx"}) end assert_raise ParseError, ~r/Parse Parameter pi2 Error/, fn -> T.float(%{"pi2" => "3.x"}) end end test "integer" do assert %{i1: 314, i2: 3, i3: -1, i4: 6} = T.integer(%{"i1" => 314, "i2" => "3", "i3" => "-1", "i4" => '6'}) assert_raise ParseError, ~r/Validate Parameter i2 Error/, fn -> T.integer(%{"i2" => 0}) end assert_raise ParseError, ~r/Validate Parameter i3 Error/, fn -> T.integer(%{"i3" => 111}) end assert_raise ParseError, ~r/Validate Parameter i4 Error/, fn -> T.integer(%{"i4" => 0}) end assert_raise ParseError, ~r/Validate Parameter i4 Error/, fn -> T.integer(%{"i4" => 1000}) end end test "json" do assert %{j1: 115, j2: "hehe", j3: [1, 3, 5], j4: %{}} = T.json(%{ "j1" => ~s|"115"|, "j2" => ~s|"hehe"|, "j3" => ~s|["1", "3", "5"]|, "j4" => ~s|{"a":"1", "b":"b"}| }) end test "list" do assert %{ l1: [1], l2: [1, 2, 3], l3: '123', l4: ["1", "2"], l5: ["1", "2"], l6: ["1", "2"], l7: [1] } = T.list(%{ "l1" => ["1"], "l2" => "123", "l3" => "123", "l4" => [1, 2], "l5" => [1, 2], "l6" => [1, 2], "l7" => ["1", "1"] }) assert_raise ParseError, ~r/Validate Parameter l4 Error/, fn -> T.list(%{"l4" => ["1", "2", "3"]}) end assert_raise ParseError, ~r/Validate Parameter l5 Error/, fn -> T.list(%{"l5" => ["1"]}) end assert_raise ParseError, ~r/Validate Parameter l6 Error/, fn -> T.list(%{"l6" => ["12"]}) end end test "map" do assert %{m1: %{"key" => "value"}} = T.map(%{"m1" => %{"key" => "value"}}) end test "string" do assert %{ s1: "ALO_ha", s2: "ALO_HA", s3: "alo_ha", s4: "ALOHa", s5: "alo_ha", s6: "34", s7: "x", s8: "bf4be93a-7d5b-11ec-90d6-0242ac120003" } = T.string(%{ "s1" => "ALO_ha", "s2" => "ALO_ha", "s3" => "ALO_ha", "s4" => "ALO_ha", "s5" => "ALO_ha", "s6" => "34", "s7" => "x", "s8" => "bf4be93a-7d5b-11ec-90d6-0242ac120003" }) assert_raise ParseError, ~r/Validate Parameter s6 Error/, fn -> T.string(%{"s6" => "12313212"}) end assert_raise ParseError, ~r/Validate Parameter s7 Error/, fn -> T.string(%{"s7" => "12313212"}) end assert_raise ParseError, ~r/Validate Parameter s8 Error/, fn -> T.string(%{"s8" => "not uuid"}) end end end
30.440141
94
0.518566
08e6cda84758df98dc83f18bfe17d9058d3cf0ff
14,010
ex
Elixir
lib/aws/ecr.ex
ahsandar/aws-elixir
25de8b6c3a1401bde737cfc26b0679b14b058f23
[ "Apache-2.0" ]
null
null
null
lib/aws/ecr.ex
ahsandar/aws-elixir
25de8b6c3a1401bde737cfc26b0679b14b058f23
[ "Apache-2.0" ]
null
null
null
lib/aws/ecr.ex
ahsandar/aws-elixir
25de8b6c3a1401bde737cfc26b0679b14b058f23
[ "Apache-2.0" ]
null
null
null
# WARNING: DO NOT EDIT, AUTO-GENERATED CODE! # See https://github.com/aws-beam/aws-codegen for more details. defmodule AWS.ECR do @moduledoc """ Amazon Elastic Container Registry Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service. Customers can use the familiar Docker CLI, or their preferred client, to push, pull, and manage images. Amazon ECR provides a secure, scalable, and reliable registry for your Docker or Open Container Initiative (OCI) images. Amazon ECR supports private repositories with resource-based permissions using IAM so that specific users or Amazon EC2 instances can access repositories and images. """ @doc """ Checks the availability of one or more image layers in a repository. When an image is pushed to a repository, each image layer is checked to verify if it has been uploaded before. If it has been uploaded, then the image layer is skipped. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def batch_check_layer_availability(client, input, options \\ []) do request(client, "BatchCheckLayerAvailability", input, options) end @doc """ Deletes a list of specified images within a repository. Images are specified with either an `imageTag` or `imageDigest`. You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository. You can completely delete an image (and all of its tags) by specifying the image's digest in your request. """ def batch_delete_image(client, input, options \\ []) do request(client, "BatchDeleteImage", input, options) end @doc """ Gets detailed information for an image. Images are specified with either an `imageTag` or `imageDigest`. When an image is pulled, the BatchGetImage API is called once to retrieve the image manifest. """ def batch_get_image(client, input, options \\ []) do request(client, "BatchGetImage", input, options) end @doc """ Informs Amazon ECR that the image layer upload has completed for a specified registry, repository name, and upload ID. You can optionally provide a `sha256` digest of the image layer for data validation purposes. When an image is pushed, the CompleteLayerUpload API is called once per each new image layer to verify that the upload has completed. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def complete_layer_upload(client, input, options \\ []) do request(client, "CompleteLayerUpload", input, options) end @doc """ Creates a repository. For more information, see [Amazon ECR Repositories](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Repositories.html) in the *Amazon Elastic Container Registry User Guide*. """ def create_repository(client, input, options \\ []) do request(client, "CreateRepository", input, options) end @doc """ Deletes the lifecycle policy associated with the specified repository. """ def delete_lifecycle_policy(client, input, options \\ []) do request(client, "DeleteLifecyclePolicy", input, options) end @doc """ Deletes a repository. If the repository contains images, you must either delete all images in the repository or use the `force` option to delete the repository. """ def delete_repository(client, input, options \\ []) do request(client, "DeleteRepository", input, options) end @doc """ Deletes the repository policy associated with the specified repository. """ def delete_repository_policy(client, input, options \\ []) do request(client, "DeleteRepositoryPolicy", input, options) end @doc """ Returns the scan findings for the specified image. """ def describe_image_scan_findings(client, input, options \\ []) do request(client, "DescribeImageScanFindings", input, options) end @doc """ Returns metadata about the images in a repository. <note> Beginning with Docker version 1.9, the Docker client compresses image layers before pushing them to a V2 Docker registry. The output of the `docker images` command shows the uncompressed image size, so it may return a larger image size than the image sizes returned by `DescribeImages`. </note> """ def describe_images(client, input, options \\ []) do request(client, "DescribeImages", input, options) end @doc """ Describes image repositories in a registry. """ def describe_repositories(client, input, options \\ []) do request(client, "DescribeRepositories", input, options) end @doc """ Retrieves an authorization token. An authorization token represents your IAM authentication credentials and can be used to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours. The `authorizationToken` returned is a base64 encoded string that can be decoded and used in a `docker login` command to authenticate to a registry. The AWS CLI offers an `get-login-password` command that simplifies the login process. For more information, see [Registry Authentication](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth) in the *Amazon Elastic Container Registry User Guide*. """ def get_authorization_token(client, input, options \\ []) do request(client, "GetAuthorizationToken", input, options) end @doc """ Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image. When an image is pulled, the GetDownloadUrlForLayer API is called once per image layer that is not already cached. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def get_download_url_for_layer(client, input, options \\ []) do request(client, "GetDownloadUrlForLayer", input, options) end @doc """ Retrieves the lifecycle policy for the specified repository. """ def get_lifecycle_policy(client, input, options \\ []) do request(client, "GetLifecyclePolicy", input, options) end @doc """ Retrieves the results of the lifecycle policy preview request for the specified repository. """ def get_lifecycle_policy_preview(client, input, options \\ []) do request(client, "GetLifecyclePolicyPreview", input, options) end @doc """ Retrieves the repository policy for the specified repository. """ def get_repository_policy(client, input, options \\ []) do request(client, "GetRepositoryPolicy", input, options) end @doc """ Notifies Amazon ECR that you intend to upload an image layer. When an image is pushed, the InitiateLayerUpload API is called once per image layer that has not already been uploaded. Whether or not an image layer has been uploaded is determined by the BatchCheckLayerAvailability API action. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def initiate_layer_upload(client, input, options \\ []) do request(client, "InitiateLayerUpload", input, options) end @doc """ Lists all the image IDs for the specified repository. You can filter images based on whether or not they are tagged by using the `tagStatus` filter and specifying either `TAGGED`, `UNTAGGED` or `ANY`. For example, you can filter your results to return only `UNTAGGED` images and then pipe that result to a `BatchDeleteImage` operation to delete them. Or, you can filter your results to return only `TAGGED` images to list all of the tags in your repository. """ def list_images(client, input, options \\ []) do request(client, "ListImages", input, options) end @doc """ List the tags for an Amazon ECR resource. """ def list_tags_for_resource(client, input, options \\ []) do request(client, "ListTagsForResource", input, options) end @doc """ Creates or updates the image manifest and tags associated with an image. When an image is pushed and all new image layers have been uploaded, the PutImage API is called once to create or update the image manifest and the tags associated with the image. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def put_image(client, input, options \\ []) do request(client, "PutImage", input, options) end @doc """ Updates the image scanning configuration for the specified repository. """ def put_image_scanning_configuration(client, input, options \\ []) do request(client, "PutImageScanningConfiguration", input, options) end @doc """ Updates the image tag mutability settings for the specified repository. For more information, see [Image Tag Mutability](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html) in the *Amazon Elastic Container Registry User Guide*. """ def put_image_tag_mutability(client, input, options \\ []) do request(client, "PutImageTagMutability", input, options) end @doc """ Creates or updates the lifecycle policy for the specified repository. For more information, see [Lifecycle Policy Template](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html). """ def put_lifecycle_policy(client, input, options \\ []) do request(client, "PutLifecyclePolicy", input, options) end @doc """ Applies a repository policy to the specified repository to control access permissions. For more information, see [Amazon ECR Repository Policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html) in the *Amazon Elastic Container Registry User Guide*. """ def set_repository_policy(client, input, options \\ []) do request(client, "SetRepositoryPolicy", input, options) end @doc """ Starts an image vulnerability scan. An image scan can only be started once per day on an individual image. This limit includes if an image was scanned on initial push. For more information, see [Image Scanning](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) in the *Amazon Elastic Container Registry User Guide*. """ def start_image_scan(client, input, options \\ []) do request(client, "StartImageScan", input, options) end @doc """ Starts a preview of a lifecycle policy for the specified repository. This allows you to see the results before associating the lifecycle policy with the repository. """ def start_lifecycle_policy_preview(client, input, options \\ []) do request(client, "StartLifecyclePolicyPreview", input, options) end @doc """ Adds specified tags to a resource with the specified ARN. Existing tags on a resource are not changed if they are not specified in the request parameters. """ def tag_resource(client, input, options \\ []) do request(client, "TagResource", input, options) end @doc """ Deletes specified tags from a resource. """ def untag_resource(client, input, options \\ []) do request(client, "UntagResource", input, options) end @doc """ Uploads an image layer part to Amazon ECR. When an image is pushed, each new image layer is uploaded in parts. The maximum size of each image layer part can be 20971520 bytes (or about 20MB). The UploadLayerPart API is called once per each new image layer part. <note> This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the `docker` CLI to pull, tag, and push images. </note> """ def upload_layer_part(client, input, options \\ []) do request(client, "UploadLayerPart", input, options) end @spec request(AWS.Client.t(), binary(), map(), list()) :: {:ok, Poison.Parser.t() | nil, Poison.Response.t()} | {:error, Poison.Parser.t()} | {:error, HTTPoison.Error.t()} defp request(client, action, input, options) do client = %{client | service: "ecr"} host = build_host("api.ecr", client) url = build_url(host, client) headers = [ {"Host", host}, {"Content-Type", "application/x-amz-json-1.1"}, {"X-Amz-Target", "AmazonEC2ContainerRegistry_V20150921.#{action}"} ] payload = Poison.Encoder.encode(input, %{}) headers = AWS.Request.sign_v4(client, "POST", url, headers, payload) case HTTPoison.post(url, payload, headers, options) do {:ok, %HTTPoison.Response{status_code: 200, body: ""} = response} -> {:ok, nil, response} {:ok, %HTTPoison.Response{status_code: 200, body: body} = response} -> {:ok, Poison.Parser.parse!(body, %{}), response} {:ok, %HTTPoison.Response{body: body}} -> error = Poison.Parser.parse!(body, %{}) {:error, error} {:error, %HTTPoison.Error{reason: reason}} -> {:error, %HTTPoison.Error{reason: reason}} end end defp build_host(_endpoint_prefix, %{region: "local"}) do "localhost" end defp build_host(endpoint_prefix, %{region: region, endpoint: endpoint}) do "#{endpoint_prefix}.#{region}.#{endpoint}" end defp build_url(host, %{:proto => proto, :port => port}) do "#{proto}://#{host}:#{port}/" end end
36.295337
103
0.718844
08e6cdad7300f5bfcdbe6267f74f045d28be0d38
897
ex
Elixir
lib/mix/tasks/google_apis.format.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
lib/mix/tasks/google_apis.format.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
lib/mix/tasks/google_apis.format.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
1
2020-10-04T10:12:44.000Z
2020-10-04T10:12:44.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. defmodule Mix.Tasks.GoogleApis.Format do use Mix.Task @shortdoc "Format generated client code" def run([only]) do only |> GoogleApis.ApiConfig.load() |> Enum.each(&GoogleApis.format_client/1) end def run(_) do Enum.each(GoogleApis.ApiConfig.load_all(), &GoogleApis.format_client/1) end end
29.9
75
0.740245
08e6fd72ecb1515f6a552b1c06388c066a98fed2
87,531
ex
Elixir
apps/neo_node/test/support/http_poison_wrapper.ex
ephdtrg/neo-scan
100966b6dd10476b9162d01a782e30a8ceb7a88a
[ "MIT" ]
1
2019-12-16T17:21:21.000Z
2019-12-16T17:21:21.000Z
apps/neo_node/test/support/http_poison_wrapper.ex
ephdtrg/neo-scan
100966b6dd10476b9162d01a782e30a8ceb7a88a
[ "MIT" ]
null
null
null
apps/neo_node/test/support/http_poison_wrapper.ex
ephdtrg/neo-scan
100966b6dd10476b9162d01a782e30a8ceb7a88a
[ "MIT" ]
null
null
null
defmodule NeoNode.HTTPPoisonWrapper do @moduledoc false @unknown_block %{ code: -100, message: "Unknown block" } @block0 %{ "confirmations" => 2_326_310, "hash" => "0xd42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf", "index" => 0, "merkleroot" => "0x803ff4abe3ea6533bcc0be574efa02f83ae8fdc651c879056b0d9be336c01bf4", "nextblockhash" => "0xd782db8a38b0eea0d7394e0f007c61c71798867578c77c387c08113903946cc9", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "000000007c2bac1d", "previousblockhash" => "0x0000000000000000000000000000000000000000000000000000000000000000", "script" => %{ "invocation" => "", "verification" => "51" }, "size" => 401, "time" => 1_468_595_301, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 2_083_236_893, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0xfb5bd72b2d6792d75dc2f1084ffa9e9f70ca85543c717a6b13d9959b452a57d6", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] }, %{ "asset" => %{ "admin" => "Abf2qMs1pzQb8kYk9RuxtUb9jtRKJVuBJt", "amount" => "100000000", "name" => [ %{"lang" => "zh-CN", "name" => "小蚁股"}, %{"lang" => "en", "name" => "AntShare"} ], "owner" => "00", "precision" => 0, "type" => "GoverningToken" }, "attributes" => [], "net_fee" => "0", "scripts" => [], "size" => 107, "sys_fee" => "0", "txid" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "type" => "RegisterTransaction", "version" => 0, "vin" => [], "vout" => [] }, %{ "asset" => %{ "admin" => "AWKECj9RD8rS8RPcpCgYVjk1DeYyHwxZm3", "amount" => "100000000", "name" => [ %{"lang" => "zh-CN", "name" => "小蚁币"}, %{"lang" => "en", "name" => "AntCoin"} ], "owner" => "00", "precision" => 8, "type" => "UtilityToken" }, "attributes" => [], "net_fee" => "0", "scripts" => [], "size" => 106, "sys_fee" => "0", "txid" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "type" => "RegisterTransaction", "version" => 0, "vin" => [], "vout" => [] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [%{"invocation" => "", "verification" => "51"}], "size" => 69, "sys_fee" => "0", "txid" => "0x3631f66024ca6f5b033d7e0809eb993443374830025af904fb51b0334f127cda", "type" => "IssueTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "100000000" } ] } ], "version" => 0 } @block1 %{ "confirmations" => 2_326_309, "hash" => "0xd782db8a38b0eea0d7394e0f007c61c71798867578c77c387c08113903946cc9", "index" => 1, "merkleroot" => "0xd6ba8b0f381897a59396394e9ce266a3d1d0857b5e3827941c2d2cedc38ef918", "nextblockhash" => "0xbf638e92c85016df9bc3b62b33f3879fa22d49d5f55d822b423149a3bca9e574", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "6c727071bbd09044", "previousblockhash" => "0xd42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf", "script" => %{ "invocation" => "404edf5005771de04619235d5a4c7a9a11bb78e008541f1da7725f654c33380a3c87e2959a025da706d7255cb3a3fa07ebe9c6559d0d9e6213c68049168eb1056f4038a338f879930c8adc168983f60aae6f8542365d844f004976346b70fb0dd31aa1dbd4abd81e4a4aeef9941ecd4e2dd2c1a5b05e1cc74454d0403edaee6d7a4d4099d33c0b889bf6f3e6d87ab1b11140282e9a3265b0b9b918d6020b2c62d5a040c7e0c2c7c1dae3af9b19b178c71552ebd0b596e401c175067c70ea75717c8c00404e0ebd369e81093866fe29406dbf6b402c003774541799d08bf9bb0fc6070ec0f6bad908ab95f05fa64e682b485800b3c12102a8596e6c715ec76f4564d5eff34070e0521979fcd2cbbfa1456d97cc18d9b4a6ad87a97a2a0bcdedbf71b6c9676c645886056821b6f3fec8694894c66f41b762bc4e29e46ad15aee47f05d27d822", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 686, "time" => 1_476_647_382, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 3_151_007_812, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0xd6ba8b0f381897a59396394e9ce266a3d1d0857b5e3827941c2d2cedc38ef918", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] } ], "version" => 0 } @block2 %{ "confirmations" => 2_326_504, "hash" => "0xbf638e92c85016df9bc3b62b33f3879fa22d49d5f55d822b423149a3bca9e574", "index" => 2, "merkleroot" => "0xafa183a1579babc4d55f5609c68710954c27132d146427fb426af54295df0842", "nextblockhash" => "0x1fca8800f1ffbc9fb08bcfee1269461161d58dcee0252cf4db13220ba8189c5d", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "b29a9ce838a86fb6", "previousblockhash" => "0xd782db8a38b0eea0d7394e0f007c61c71798867578c77c387c08113903946cc9", "script" => %{ "invocation" => "40e8a85159d8655c7b5a66429831eb15dabefc0f27a22bef67febb9eccb6859cc4c5c6ae675175a0bbefeeeeff2a8e9f175aaaae0796f3b5f29cb93b5b50fbf270409270a02cbbcb99969d6dc8a85708d5609dc1bba9569c849b53db7896c7f1ffd3adc789c0fe8400fb665478567448b4c4bd9c1657432591e4de83df10348f865a40724a9cf9d43eda558bfa8755e7bd1c0e9282f96164f4ff0b7369fd80e878cf49f2e61ed0fdf8cf218e7fdd471be5f29ef1242c39f3695d5decb169667fe0d3d140860da333249f7c54db09b548ad5d5e45fb8787238d51b35a6d4759f7990f47f00ff102e7b88f45acce423dd9f4b87dbf85e7e2c5c7a6aace11e62267c0bbe16b4028d272a701c22c5f8aa3495fa22d7d5a583518ef552e73813ee369c6d51ad2f246a24eb0092ebe7e1550d7de2ee09abad4dae4f4c0277317f5b1190041b9c2c2", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 686, "time" => 1_476_647_402, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 950_562_742, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0xafa183a1579babc4d55f5609c68710954c27132d146427fb426af54295df0842", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] } ], "version" => 0 } @block123 %{ "confirmations" => 2_326_366, "hash" => "0x87ba13e7af11d599364f7ee0e59970e7e84611bbdbe27e4fccee8fb7ec6aba28", "index" => 123, "merkleroot" => "0xd55b5eade05a6a5b2021fe065107ac652ffc960c063bb13255f58ac9fe136dd7", "nextblockhash" => "0x6cc7b645d5be908967f9477dfb8e47ad0a84b7486442548ab4439ea3dc480f1f", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "5945c1e2ed85a0fd", "previousblockhash" => "0x9d704ae187dc34c348ff4daa65a1a1383ed5f6f6f4eb68fc24b9a874b4442da6", "script" => %{ "invocation" => "40d47a033f32de40908f58c84e9acd89b03e7943f91056ac80adc64892ffa200dd75d0ffb340a12963a80e5432e12a70cd9317e5d29cab1966d0a70ae2a6968b544085858865fe8773eecf2eb64aeabeb952aadd9fee5c5fa2e208cba2cd79220604deb3d318f0a9f9aeed75f85a97d527ef8ad3d87c019ac74361f926b9b067827c4070188e617e5608e16597edffee6b964b80b99803f10fd58b16e4d376e2e447810d6d02749a926cd2fb880158ca11e7ee2b91b7adc5d46e4500678b4131f7e32740693cf2227da04612f6d706994a21b29d33769b10f2a37807643145b9609bae33ac5b700118fd26661a2f1b01149ca3f1984c7e2c3f61c2da23b2ae966c66898640e6bae967949195b17dea3cf145c0502a060ee88a09d0f4b91b2e3d7ff3d211bbbdedab4c485d9f9149ef7d1eabae4adaf32a45c8d81d7bf4762bfb4afa51cb25", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 686, "time" => 1_476_649_675, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 3_984_957_693, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0xd55b5eade05a6a5b2021fe065107ac652ffc960c063bb13255f58ac9fe136dd7", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] } ], "version" => 0 } @block199 %{ "confirmations" => 2_326_284, "hash" => "0xb4cabbcde5e5d5ecf0429cb4726f7a4d857e195e12bdc568cb1df2097c2d918d", "index" => 199, "merkleroot" => "0x22785537b678da290b0fa00cf1703a0436f303ee1c8a8e8f5e93615fcbb6a280", "nextblockhash" => "0xe5313431ecd1b59d1cb7848f35dadc5e51ebd700fd232fe3502003e14aeb9bf7", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "d76e2a45089c0672", "previousblockhash" => "0x5fc3475ffa875d6e82d63523ba7a83e218e81d03a20ce36fd792d0cfbdbeb68c", "script" => %{ "invocation" => "404d679bb8131a0fe995bf0f4c4122be78ac085bfbbaf0d71e729ce832e4761e0c245fc53c23dad1d3d5fdd0f1a558de107d0f882ecb6a349ffe02e33dbe83f21e40617e3686538763de96941da201aff56c7de25d321323ed0b6fb076ab2652f8ee3b230066eec67483c37cfef315608d7c30f68929c0fc718c86e5ec20ffef901c407f3970ddb448e1d24e40afbfc5b75b69967a36da8a98ab2aa9cfe62bf465dcb16c1902d07c15e7c2c02d68583d051376f95f353252620b6cad5338d27546870240ff95af7bbd16249f17480a72ea6a6d45cab4948cc68d72f8d51930af8c512c4308a69da5a72136ec7193f142871225a3c1aafeac44cb306a275c32715a0dc969400a66a4d9e6f2ae56157246a72b0b044e54532c8d70ca2f65e4991c376b880a44e6b3e9be3e86ee577238f28802c3f28889c19d48bc1845098e061f8794af8225", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 686, "time" => 1_476_651_110, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 144_442_994, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0x22785537b678da290b0fa00cf1703a0436f303ee1c8a8e8f5e93615fcbb6a280", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] } ], "version" => 0 } @block1444843 %{ "confirmations" => 932_272, "hash" => "0xc38a8b9a4ef4b8ff2dea5d6137448b53e57e6d038c1618f580ef9b2d8ed79a97", "index" => 1_444_843, "merkleroot" => "0x14b7d26e9971c23805ac1da16f0137c7009f118b51c905353c2661253475783a", "nextblockhash" => "0x2f4d2147e6c9fd96b8ec4628bc2af9bde01dd521d976d88e678bd240b04f5616", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "01bd450bd0b8471c", "previousblockhash" => "0x13a8d29859053d3b8d9033f3e72db7e4f0e15859e044ba61a0403350ae8d835a", "script" => %{ "invocation" => "40dac543e10f911a80b242437eb3f805f8d7db6cfdef779a089ef72583a7864a16d4bd5522d1bee451c307328640ccbbf132c87f25bce1ae70267316143c84e6894095b47f43e9687992bf59003e914911d340e71780a03542eb00f1f60f125308736af878b6a340dd1804e34f633f656e2362515fe8e15358b787993a3398380a0940ee5d613ea5eaa61fc16e3f83ce3b080b6a0585473fc5313232f9dc4a8806f4cc655e07ee2087bec218c7c34d82e3adb24c6b47d1c28c6c1f5cb673d87ce7be2f40659f3cfeedf6528d2117a779a54a2c5fd1c639a32121a41fb97616bd065932a445e8e1f36a8db98fe769ad4ca8e0c5b0ae9dccef0fa907db7ca539fe86b7c8fd4061cc3f1580ac41f227bff3c9f54c9e7c2aba7fc450025bfa513fef28392d1131c01bd7ebc51deb911f5a3247afd7bac0b927b00416fbca2bacd216cc5e73d54f", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 8726, "time" => 1_507_466_032, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 3_501_737_756, "scripts" => [], "size" => 70, "sys_fee" => "0", "txid" => "0x2519fbc6c16d96f9a776cf39b46c91290ec82829ada692f139fa339b4632b2af", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ARtmDzcTZxHCYydqFxFw31d21CpSArZwi4", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.001" } ] }, %{ "attributes" => [], "gas" => "0", "net_fee" => "0.001", "script" => "00c1066465706c6f7967f91d6b7085db7c5aaf09f19eeec1ca3c0db2c6ec", "scripts" => [ %{ "invocation" => "40f99aef575d5e2be3de117c80fe3b99411f2a88f12983c33eb2d6bb88af512d4e209ff4f1ba4ea4b7dc21ff52285c8f7a9059cfeb4015ee497b5e6497184ec9d7", "verification" => "2102f2cafd8d6219ecd140198fb5d7f7ad8ca2c3dbb09950e6d896eb319867505a0aac" } ], "size" => 233, "sys_fee" => "0", "txid" => "0xc920b2192e74eda4ca6140510813aa40fef1767d00c152aa6f8027c24bdf14f2", "type" => "InvocationTransaction", "version" => 1, "vin" => [ %{ "txid" => "0xc8c9696476091fd63f4b0214715abe3eb10f4882a2959d4592c1f3cace800c24", "vout" => 0 } ], "vout" => [ %{ "address" => "AQcxz3gj42aZ74ymenykJuiMKBZqarFX6y", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "39.999" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x0a4047ef6af9f9d4a11ab0fd20ae3e7ed9611248c73a3d5201b6e81cb48a66bf", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "406b4782fad6eb34a5b966c6a37dbb5e609a1fc0d1e1168549a86cd0ba983e40d6be03219a76c71202b6f3a1faa610eaba2673c918ee7e2a5948c341ea03361d2a", "verification" => "210219cf752f43109139f399bb6188d7d2a7043255cb3529e3aa50679da2e9b0ac60ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xa2e21393a593cb16340d2cd99a385c7144511027a5e76b552f79193b9b4a3269", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ATkhBJKYoNt9jpQTcvJ2eNXmg8fwQD5DZh", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0027566" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x55d0fa2688bda83624cbe4d7be60e4525f843d6d8887c23d237c898b6d45ff81", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40fa29fe8d5bfeaee31b82ecbec2e6c2d52987b2cc0e602228caa8714f0781cfbfc531b9e5894c81ae039c387970f99cbe4fe2f7984421dea5140a0a1a76c055e2", "verification" => "2103051f9d8436d73ecd208dfdf334ca6058f82f95aed6b46038d2cec610d150167aac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0x5b18b2b20b1fab7277ef0864851bfb7c522afddd2bb2c32b4dfbc86c74bf84e1", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AVNmT7s4khwaFqNRSDy8G4rhfwTVSBQQao", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0021392" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40693dfa197ada445c2458cf875744a913f82189bde1c733a8105d5985362aaa89661e07f16b5dcbf0ed1f4d644149ce1c1fa99cc01ded0eadc291bc6714956b95", "verification" => "2102513ba0684ca7724c35399cdc8b87e5f0a770778e6f34700fd824b14de54b5482ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xafef3f6d901bfab3a70e4a1a05bb403a2e067d543fc05717fcb1827db25b17bc", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x6e3a8137ac85f2b18399cb05f515d391ced63b3f5ef9daac8ad5a2bf56fbe66e", "vout" => 0 } ], "vout" => [ %{ "address" => "AWrAn2pkW4LPj8qvduJsBxxhWmHEPNrYTB", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "244" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "403c0ca2e11ed8b766742cd02105169595d3c8433d57e4f7c9e0614881bb4e0cb7871752ed1f304df84812ef20f22c17fb1e2532680740469c781a15d3f20f8e50", "verification" => "2103c6b038614a23e6942e21a74bee6fe18d3b6b399a29da8ca3984bf5c65753d50bac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xf2d975f1d2a0f8540a511647822329decd6ff57af8e165c9e640258790ac9dda", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x58db4042cda2437a123fd3055a282e0b6b299e5327e194d527fcba50fb80cbc0", "vout" => 0 } ], "vout" => [ %{ "address" => "AZ1p8aZiAVvhjLVuJT6KU2pnyjg9nquxve", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "27" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40a1b768f921f23601f72e4a28aed8d476e4d82d4a5019663596afee847a4ebf52f53444e7b77e787e4b78369df1b2042e9585abb40ef325777d047ec67eca8d0e", "verification" => "2103239a23983f2e12356368093c1d53246c25ac7c664b73ff0186ec3002cc5b4d0bac" } ], "size" => 236, "sys_fee" => "0", "txid" => "0x079da384cd1dda07cf4ead95b62dd73976b5d948966f22bb146e57f8a2cedd43", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x692604297e6c009fe16555861e3d06d6dfc09aa6e025410936b45e8b7273be60", "vout" => 1 }, %{ "txid" => "0xa6d619e0aa12c8cdfff5fcd55c31b2e4f39e24e010b9d62a462470610a484afe", "vout" => 0 } ], "vout" => [ %{ "address" => "AbNk2xyU5yytzS3g4AFjmHFyv2DeCKANQg", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "27" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x9cad031536e4c216c93528b18f5ac86cdf36a8788556d90649dc7b2c528a45b6", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "402da779f7f530c2d28bb5603b7cce0fccf70dc0e724291329082bdd40ea1bed26cf4331ec0ee155516f9506478e7687d2b97e33261a176d63097e20b93a7d68b4", "verification" => "2102d7fbec159bab4b0a9d0d94ffa96b7d4ca706d9f004b6f1ca9e050fee1fd606fdac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0x2446886c7126d8916a75db66d740d577fc8b1ccc0d011fa44d8cdf72d77788a7", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ALWPnZ5D12m9FeZcc8b5r4HPtjF3wUwawf", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0004635" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x89d752c776896db20476ed273c0d2e74d66c642c834e535ddb10a99f4384fa1c", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4014edb2cef5bbd961549feff5f5b605894dcc70521916b8b72a644fbaab0f8f2e28a07e6a03e2cac254e3c4bf67b81a14ddb69be60b68ac972b3daa53106f0002", "verification" => "210252e98486d8529841323abf6e56b547b940289bdd534d214d720952a00184177fac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xa87da448a524b45a2f48994ba45d5df3111266cd64f13345050fd87d70dde05d", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ATF9L3CmDHaPAnPRHMJPzQvRXgCbzbB91e", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.00034374" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40eedaaa9ee2cccfd2254632261c53fc4356b227e5ddad70cb6bb449ad5171db313d9918bbdb6845a3ffd5e9ba6b7aabc5aefe1a1326c74b786a79244c8ea6bc17", "verification" => "21023a7e222acdaf93b4138af8773d6737f7d869aa57b86f98a7186917e244108eb5ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x61f4d44b095b5885038b67e2547b7d2e206b20cc741a640c872563f4e34bc919", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x90467659ae4481480220e25e9b1e1c0bf14068ac9cd04242ce06ad9e01f95448", "vout" => 0 } ], "vout" => [ %{ "address" => "AdzbXPfmYmB5qWuqraeSUiBMby3FPsCm8J", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "29" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xd5cd5365e19be3589fb4b5c3233488d5acc8eec31dcf86f3e34eccff43a2b831", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40a8df815674536210f63c6d852b806c9df0dc15e243b72ba096c57f770bb8f194bcd59e1b4bfe942963029a6122a1fe92a112071470535cbb3e83a9be4312ed86", "verification" => "2103cba4c22e4685938d52c0cc8c7f7c046ea9d77cbdbec1e5fc3658368fe46a9128ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xc2c67aaa5f495a9b5813883abc45c8cc2b34f763b4c50300a4bb69d9465ae4bf", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AWNLAtjmNXAJSR9p7P8APBri7jpYRPMwUA", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0443568" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40db5089257b72b7d34d167628049d810f947ba51e87decbe3d35b3959b47ab275214ad26ebc7d9263d8f664fa5eec51d724f817a767e035e7156fa2ea3e2f007e", "verification" => "210227c9ee83282eb841cfb6e541659927ce9d00859dc98b5c47b1220c2c34b20897ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x5cab0d9cfe835fbb0c991350025852fee229ee88e199c2ba2acaa9b89cba4af8", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x82928ba10749dc59641357ed31f673c650875674b1ba82d0871befde98d06054", "vout" => 0 } ], "vout" => [ %{ "address" => "AJdCehHv2cw7kThRv9N2MF3E5Z75PLp7dx", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "14" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4005ee1b177617376e5ec07bd2eab922bcf6bbffe7ec21d4a4b7dc7cb8779cd38874b923cfb3cd0de31862b2bc15b839a89bcb259378fc3008766ab1db92ccecfa", "verification" => "210277eafd9f027aeeb93b493da854bd39bed4ec10cb3a45baa6e06ab0eb8bd33c5aac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xec826a17489f2c0d59a3b4f824e32b100264c1c6ccfc25f3f2c877f335d13837", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x6979685273be0ba45bd4e9e84d5466983e890e69aba255fa9bddb41e0538c9fc", "vout" => 0 } ], "vout" => [ %{ "address" => "AYFozMkej9PMGRr9mrsJeHPqyfUgdEvAqH", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "100" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xb5eeeca3afc6c2643a9bde4a77ce1b530a8aee7938e501629babfda2a7988441", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "401c0dbefac578fd4b5bce187b64f1ab5c7f719967c36af9001cb53e841875cd65573c1b139c31670f7ef3826f9308755d842442d81521b2913d0306d7c5261adc", "verification" => "2102b777dc85f6566f56c6921138e5339d1bcd865827992ee13fc60ce49307e9e63fac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xa327286c2212c1f4b0aee669d639b9b88649de0dfdadc4a3092bf84c9b69ae0e", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AWQfk5Uc5dWamFn1QpasPNmsXKdUsMc9Np", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0023652" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x36f254b56f0eed446790027c11ab98e65a7aac018abf85e2b89b3f9b69d6570d", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40bcf2f42e7a222c9b3f6c77ba4b966581c3eee4aacda2be0189e5be5be9dc7eee9956116cc0d641263bf632326c0375cf2cd2c5cc711debdbf35e55708ff0fe73", "verification" => "2102b223c25ae48fce084d0f2d3d1bbeb89a4a2265e38424e8e354e2f6a1fd5ffb8bac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0x82189c45b562958d18779f00617d1c706bb72044b4b8d51ee17b21b325a43900", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ANn2fv1MiLqDCUfmqZVYsPpCQAsEsH946m", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.02951586" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x7d6df76d22ef0fb2fd3d668e24b8c0e37b21bd606eab4bddddd3626159c119b4", "vout" => 0 }, %{ "txid" => "0x4f5d909d1e0bd4c3bb50631d3cbcceb820cfb5653e8c5f4f3f4c9584a5d0d5ce", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4040dd37bb5467780c6ba5563e0a7fa932fac9ebd057ab48702662544340d66a6d44929d93a8f72b2e35b0d45b272698da983c83cea63639355a678905eb40bcda", "verification" => "2102ed39359bcef206409542663ae3849efa276e0e3b16f3a7bde4a9439ba1974722ac" } ], "size" => 237, "sys_fee" => "0", "txid" => "0x23a369f2ba2d806b6d27f47c3ff94f875c3b2f280187f87bbab7503586cd2766", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ARfXBdJLu9GpKooDDfGE3vHotpNtuK1Kou", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0024928" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4054fad20c8a0fd28aef5583e6bb9c4c2111bca51776cdef1e9f9e153d9947b05a44cb7bb53e354d69581bb7248bcdadbd081776222166dcf80208c074c402d54a", "verification" => "2102e08b882f6d6660304c24bb0cc6e9e5c222530f6d32a57c2c97d8cbee9fa73f69ac" } ], "size" => 262, "sys_fee" => "0", "txid" => "0x14572752e56c4876d0e4f5d6c356010bd22e28385b24f7ef52c1731aea9408fa", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x223529d32b797db28ac505667f23ee753defed87eaac7aeb496bdc1e4ef33e4c", "vout" => 0 } ], "vout" => [ %{ "address" => "AVWyFZeLKioKvsWDvVDKc4ECnWURwhVsrL", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "3" }, %{ "address" => "AH49unXqx7MvkhbQho5L5K2hQxQzCGoeBY", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 1, "value" => "3" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4049eed4125be1bc6a38c2e1dad8a4d71f2c071dd5e25616fca8b05ed678dbcf236614be40768e1a61490948c64cf051bb0d572c78fde7c14bce8d55af0213e5a8", "verification" => "21037ae61122cc55f1fed885b09570033e7067ac55c70fb3edd42da6d4fd6769fe9fac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x283a28d499cd6a03f5b58ce7afbae07a54ae3ab695480092ff29d925fa741e0e", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x90c0341af375248041a8091a889a88d071e8e934a3e14b87c4f039c08c1b9251", "vout" => 0 } ], "vout" => [ %{ "address" => "AYkrR4zKNM4f7BbGuy33WmD3AXEMvLK2Ku", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "34" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40b74bcc8d08c5d064ecb733b20957185e5fa1b351005ceabe90ef4c8c7dd2eab9b4874d3a7efcb869b78be73e71327d678fb21a3af7b0c1ccd340e92153fe2d78", "verification" => "2102d3168e531de50c6bfd31e139b8e768de28a2b80126852d9d3852ce33bbaa08cfac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x00fcd545e480f3df88c846735868e86a41136a2ecb2585326d67d3f1a14965bb", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x3f6808a3ad51f5e448e5988152e947e9288c3e9bbc53ba53cb92d2fabc21020d", "vout" => 0 } ], "vout" => [ %{ "address" => "AQHwt4veLExu17xM6JYntABGY6F5KHZLqd", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "34" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "407a43dde475c202296a5e76094dc1c4091c63ad00e4f872819feefb83d4caff6b5dff44f2eb27d9c0d4f7d503fae0a6b401620a6d9f20434a61f8f77609702534", "verification" => "2103819ca5f9a347183d6d9dea3a82247b945bc90fef931b41924417146d3d3ac007ac" } ], "size" => 262, "sys_fee" => "0", "txid" => "0xb53eca9b8136be53b07bbd5632c6897bc13a88be05a56e2b273857f4081118de", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xf903722f846cebdec305b7d52029cd1bd022af88c999d78c85529e24546ece28", "vout" => 0 } ], "vout" => [ %{ "address" => "Aa9WRVhiPdMzEFz29RtLhZfAjw3vGQFWhe", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "20" }, %{ "address" => "AHBRwoGQ9MJvEfc1DkLiGrrWKe3Vukpyds", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 1, "value" => "47" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4027778cb68f354d16a7025b7f9fd5c879c6d778a9c42d5437c39f9df65d55921229cf5e44da68e0cd1aabc75edb390678542074cce01f0d60e11627ba498cb0ec", "verification" => "2102da8a1f0bc9b88dfd5ca627f1aaf46469db6d363cf8fc16efed8d398bd3e2135bac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x19a6a2482f7c48109d254c0df9a09b141c4ef220e8562d88d21cc6ca503924af", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xeb2e0969a8a9988fd9adab62ab6f70fbf0adcd95859e4073890ea36856b5115f", "vout" => 0 } ], "vout" => [ %{ "address" => "AXtwwnv5xBcGdjKLLsm4e6Q4298vhBXr33", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "184" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "407e8f19736b6f42d9f8516e3571618e43bac7706ea325981a36d6acff8c8ff4f1441a1e025a6a77f4163201fecb102635452ba19fbdfeff76f9b5db1f065ba645", "verification" => "210248dd46da41b4cd3d83e66741b1c4cc0ace2459a8d1e31e844c3029ce9b242bcfac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x0029b74ca75f9adb9fb64877961b65080ecd69cc116d15dd43290466084bc80c", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x70f0b11da845e01c91d30b2beaa3a795b368eab5bc462a3165db6e3395d77f8a", "vout" => 0 } ], "vout" => [ %{ "address" => "AdxKe5QNQt9cyvijx1HpKa1MymaZxF1H2H", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "294" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4024debbf5585bd6ce5bc31d8134c44a9f361220bd37d10be15cf8abfabdf10132285fc946716f5e5527fc53f918f28af9e74c86b7b7198114666d2b6bd1ccc5f5", "verification" => "2102a1dca5e1c2a3ecfcc126a661d911ab6d117a4283614dbde36cff0ce860ef5c38ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x705d58f10ce2f90c1abf358e5f774c0fc2613fd35fe563e8b2efac38cb7144fc", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xa2eea2ad641324212c7b21280cfa6b38afe30ebf1566b5459c411ac3a010e75f", "vout" => 0 } ], "vout" => [ %{ "address" => "AXthcdiKD8o9qofTFUcgoohQkMB3rZpfou", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "27" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "406b23fd68ce42d30a6d4e7f675ad90e14a1e047a29ae32a1495ab23c57a3991447cfead8a5ce7e39374f2286423f159ac2d2519c13bcf8d668263cf7290710bf4", "verification" => "2103b0ef00acf65e7c72b03d0fb99942dc50321329902161ef46434dfca9e9318db2ac" } ], "size" => 262, "sys_fee" => "0", "txid" => "0x9ab972de04b253d3622d09298afb1b86b440498151902c9e153e654db96aabb6", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x62d3e114f28d279b412f9755624ad693c159fb428075887cae00895565544e88", "vout" => 0 } ], "vout" => [ %{ "address" => "AZnTptKwHL6pHrASQCvR9NZJNJzKS5yBdJ", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "800" }, %{ "address" => "AFuiwwJBo1jLVHYSeSGrbsS5CfifoQMaGN", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 1, "value" => "7997" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40762905b4d76148abe6bfb36cc1414489f1930f692c40f67e75ffa991ee0ac37cbbe79d3a0c5ed2f983f46be8adf0b2403ee7e0a933da0e31f04538cc1dc9ee07", "verification" => "210341198b8d302ad17323471930a24c573ef9f142bcba0885236c371883bdae11a9ac" } ], "size" => 296, "sys_fee" => "0", "txid" => "0x5e49d7a7693cc369a0ebec830ad465fe16723d8bc523666a28ed33c14ebbac20", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x8b246d442f8bdd7ff8d88e1bd780b6449b058c6bc79a93dceb5523d610e49831", "vout" => 1 }, %{ "txid" => "0x29fc676ccc314d49ca47c9a984901e5b4b78b330d78cae9c184acb46504ef3f2", "vout" => 0 } ], "vout" => [ %{ "address" => "AdnsEEfYo8dYLAvkxHv41cu4Jnbu3wk1Wv", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.002" }, %{ "address" => "AV8kbruyQp5tuPUiLnUShzLXgzS9U7q8rm", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 1, "value" => "0.0005759" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x93bc7f013d71c88a513eb482f4b95a2e59812c65ac5179a288dc31ebc1d79bab", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40c975f2ced6cb4e710d0bfa9221f4a42d8cd88871bdab743c44667229f88690871c9f93bb34902d510e6fe316d5a7f7f5a585711c67f6c89070c87e169a0fd93a", "verification" => "2103a2d10c4990c393b483059339c19889079f7a5377fb0557076557d0f6109c30c8ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xb74db111b26859f86f7ccc3f5c4ac4efc50f6beb082b219f217a4c7086ea63b7", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AbQDA2Ks4RRCCL9Lo3uyEQv286bXeCadHv", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0009393" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "401554e07f7a49b8cfac8fc80c849cee02c9f311f4e95728ae02e9958aaf496832b721fefd2cfa69f1ec5971493ff29a524315e07591e3b4edad62c6002542d08c", "verification" => "21023a359fe70274b790d2a6b7e049c9c6ac7c2020e972ab24db591db69b95e0ca92ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x556310f4434ebc012f3f5d2a4ccbd3d99638ba97a7e111029ae1bce22b555511", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x34709f393683f44a94a67172a91f95d6f8aaf4319df73fa428cc7ead2fd82d31", "vout" => 0 } ], "vout" => [ %{ "address" => "ARjixduLKfSCRdm6CFqriri7n4D3AFUcLC", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "11" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "405530e033c0b3399904e4e10fa3c4f977694721189b7094877db53ab94837d90024783e0e20a3470bfa27d0c6d21336903d000af5b05e68e36d64c5dbd9c46974", "verification" => "2103867a80565182408b42add7d11f79939d3f2a2918542b500b961d95840044df09ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x5dcd724ba49b959d4928aa11b07c7a1883ee7f6dabf0ec1cfb66bd19eaacd8f0", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xd96055dbd28f5f1ea7f5a79bd29ff1a4a7523bae3a2a48d0e7e1047d81c658ed", "vout" => 0 } ], "vout" => [ %{ "address" => "AJFq4odEDo8AgihLaDE25J25wjFweAQvAY", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "1" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "404dfcc9fb6722281094316737a47f3bc46ee840a1e9e30cb1ed5d772d98e0844cdc4f24667de07367a225487b6f273359c89bd9d06c53f1ca86b620ba57e84357", "verification" => "2103818db76748c12a6d1cf8d0b09311e3f395b9143ef3ac20cadff4de8671a8a2f6ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xb74077de94d1a80661cf39949d104646986fd2396bb7050f538d9774bc082767", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x2a4e4f4b9b95bc720cf513ec407912eef889f6ba125cb4bf9f369af33d6528e0", "vout" => 0 } ], "vout" => [ %{ "address" => "AJTCe8h8CPJ1pL8ia3PLFfgK83ZaA4TgLQ", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "82" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xa1d3e6a8dfa0fca013f5dbc19d5e115c3419bd4ffe2c33afbfb8480688bb3cd9", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40ba692e0e03aa36944b32a7ae9774bb0f15e18b5ada88bb2518a3676574cca6f21cacd94d04a8304bd5af291f4c6728c422a812a2563a319d24e2b9c79e4b8954", "verification" => "210247f6b0f5dd24c5394324a30e0e3740d4db5ef4c05908e8efd27440b06cbaa1feac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xf947031a405fe308708f655d6689acca038e83d4d22a3e2a576268faafddb838", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "APoQfup1hRfLqvGZ1xGbufv8Vc8Gxu1KhW", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.000201" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4038db74f8b9060ebd7ca8f42013b376fe3db3cbdcb761adcb73d72a971df749997348f8b07c5080455beb03c975278ca54e6db8c5cf44f024352fcf5b4121b631", "verification" => "2103621f196104fe3c9ae14ea66d5cd69591671c53c642d03be06e5d168978f2e730ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x0940724edf8485937f5001fec4dd9c1a67ed98292c606cd6e799f05de47d2058", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x10d13eee596e9ff14474da34b9e1a9c5a007fcf56e7e0cb566914a3b2010ce19", "vout" => 0 } ], "vout" => [ %{ "address" => "AJfvGCfXH9xE4fUEYvvzKV1nMRYtpuADuK", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "27" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40c1df711e77994fe4820b5cdcc4b6b59a25f53d58e781193eb888eec236cf9911560d863f6173c398b9a7220f90ecb0ceb504f0b95c2738f9f427d177f4ce9808", "verification" => "2103972dcdf9596004da7a63749c604420edbcadc00dca3df996c55f330654757439ac" } ], "size" => 262, "sys_fee" => "0", "txid" => "0xf8e045cd8ae72d9de2f31d7328f9e2a391a03a6144587805a55699bc8cbab9a7", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xc175dcf7c2be61236eaecada3830352da06521ae0f9ffd4d5544dcc8200f3a6a", "vout" => 0 } ], "vout" => [ %{ "address" => "ALHupom7Skv6eLE2pFZYkfEae356LQzaQu", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "10" }, %{ "address" => "AMya9cb9Y3ADgCrvpQoCgWfTGVo5Qp4UQV", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 1, "value" => "5" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x3b16b994603a3b273643f08e58424d168cc173f992de8e877d8774fac426eddd", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "409fa1bfaddf9b65e661dff39b42b47cb999984089a1b178f851a4eae64e72381d19f6d53d2f53f1d880bfaeef1243cc1b68eaae5d105ea31f0a5d641d9fd91333", "verification" => "210395c38fea3030b834ba58b9138fe57ab31a9e54dbb22b5a0ad185c06bd814bb06ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xd597c8d68c410a9db4b01f2ce30295f241701fe92a961101391e8bc71ff2ae43", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ANrwNBSBcK2gj8QY3Npwycnnn2JRt99ByE", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.00005632" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40b3aa9a8151df4070717cc6b49d29ff51ca1361a84b84db4264f6269ccf64692ef59297d1196b0099162ca9b8445b40931aa2fef267b00417ff785c147a5a7a4e", "verification" => "2103695226b7e4d603c59ed8cea79266c96168ec005834588d73b9ec9a96fcdc5c38ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x0c62179ae24625a8dff48ce43722d0fe2574244ce5778b955d270d6e0f37570d", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x31e01982397763ed6976c8ce69ff06f2626a01b18a25cea26f7bef497a008308", "vout" => 0 } ], "vout" => [ %{ "address" => "AYq7xEGU2WEnAuZ57LyCz7GNw3Spwe97rF", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "34" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x5f678ea8fc68113fb0567101bda2a86cfafc2fd56bd0182ad34c5765d90ca202", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4037357c429153da13faa99dd6a0947baa7e45cd852b45ed0eceba88b4c8e78ad2ed3a8e67007a52ea936c98dcecc8650c12cd89394258f6131d415720a367a2ce", "verification" => "2103e650018239987114419d400707263359c9c25833fd00e5492f04cb136c209f82ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0x747d16129e12ad72bd0a7b23d5d0648c8c32cb96ceb45816bb7dee8160c6de77", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AUi57t9R7AZa9rmTtzpgAmwhUaxpBY8cNQ", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0017812" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0x9da9a44650277823b3065bab1e7409fc22ca7b987460714708db3e7803b059d5", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "403f9859c040b864e29b6aa0736f8284e1885bb0c3c929d6f985aa55d6aeca8cf2ed116d22ae5eb7249931d6673d7d1a032453dd34caddcc28fb804d2c662cb1bf", "verification" => "2102bc6b2a99b949bf34e308aea18f8fdccf555ac72b8bc7e3ed6997040b04e9ca77ac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0x806bf29a7030057ab7543d6ee38a3e08827a5c2bc6e011616841c75bc57666cb", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AVNV8JichWhDCzFpJqVgqknjEMvxo6zUPB", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0018534" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4062ab6dc0ed79d8f354c8f9d8602d256a097474c071237cd7d7be6f1381f0ef3a2d12d91e156a2ef1689afa5f5f25c852c27f6e560af5e2a9961e9a71e6a52635", "verification" => "2102e01c4acdc3d3c6948e931cb3076a00a1492a0478a77a7a4d3106173fa225160dac" } ], "size" => 262, "sys_fee" => "0", "txid" => "0x289846931ffe7734d261ee983958cfb1990e88fb838f14599a8221a117a09075", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xbf1f288da0bb14ee1d95b59c5fb41fb9ba684f4d2736c50cb88fa8e1724b18dc", "vout" => 0 } ], "vout" => [ %{ "address" => "ATSdbaQtu9Zr5eEmWuEQNQbQR4xgPkPVbi", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.01" }, %{ "address" => "AeNzkZzj5SSwo2bAN1xf5YE7m6NbVSoQcr", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 1, "value" => "0.041968" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "406179f502da4a6afb2bc4de3b4bc55f2d362b634a6f9777fb78973fe07ba403fd701d1be606efbe5f3918d2c883d17c9ef59625de064a6ac92fc927b0f8f8f7a0", "verification" => "21039f52e94a1ec7b25f63029ac995fa5ca9c982aef14fa6b24ac25defc45ca8d2b0ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0x587b7ebc6fd4389537b7d94fa8d7895a05b0aa7473ceb27937dbc32bd180705d", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xba43b35614410522b8ac6d900a7f507387e32a2dc3235a1a8f239e5d9b13acb3", "vout" => 0 } ], "vout" => [ %{ "address" => "AR3Y5au2dN5NVpUdrRzq3a8w6ebN6yR7Wr", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "34" } ] } ], "version" => 0 } @block2120069 %{ "confirmations" => 217_636, "hash" => "0x61042bfbc39b410c61484a1fc6fdd46a8c1addcce57a65103b0e7e15ed0f38e2", "index" => 2_120_069, "merkleroot" => "0xe6f014431d6f0a3434fb6bdbb2d9d7043c0526011b3a09a7d95d8c0cfe762eba", "nextblockhash" => "0xdca882cbada3b37d2b46523154aee8e24bcf2823fb279386473c1329cbb24d9e", "nextconsensus" => "APyEx5f4Zm4oCHwFWiSTaph1fPBxZacYVR", "nonce" => "45ddb5022b328139", "previousblockhash" => "0x0db722438a781930f371e9f3cf3640dd5f18ada360b81c62dc53a73f4796714a", "script" => %{ "invocation" => "4002b683bc3c58bbaeeb7cf57f31bdb6310e97945a2e97f9b5456e1969f76944cead0d822af7364eeb1d8b9b78ce5e1814264e2af27cf7ec213a741f3ebd1dd061406606d539f1e8af7c2ef51d16f7e140278fd8bef7845f0d8ec6abd4fcefd18f10916308ce858b8003bf939d2389226d432cf4a2191903a748b4e2f0efb329bf68405406ef62adc993af39cc990e13dc8742f34c0aca384bc1fa63a2f3fd870f9dcd3f1d33dc36b69d00cc4cbe5f070eb7a7d7197fc96874d0f1bd2571ede308f81a405360639cb6da93b22a72b75fa754650651f3739ab4378794ecf8b10169ff7ac473f93051a5c8dba9fc95e68b8634bc77d79a34615a8be97b4520df264c28ae5740f31466eb0a3ff03e1fe774183297d9d945c90beb5364f5fb44e153c7554db537fde270ac9da6698a6d4a59c561a3d6bf212563c1d071531af3604eecfa597520", "verification" => "552102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, "size" => 7332, "time" => 1_523_181_098, "tx" => [ %{ "attributes" => [], "net_fee" => "0", "nonce" => 724_730_169, "scripts" => [], "size" => 10, "sys_fee" => "0", "txid" => "0xac7ac88ad7b19538d0b7f8560abda1be344098cf6d9d6266b1c028160f8e7be6", "type" => "MinerTransaction", "version" => 0, "vin" => [], "vout" => [] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40e54c344b3011bbcea9c96b3aa2160ff9fc51255f1ce35bf04b26ca89f5f09068f7d8486abf11ce2c001ef942f373104e5e6eafb08cd5da50ea4677cb7f4553de", "verification" => "2103831a2118274db3627775a52c1ecfd73904fb3f8ed916654bdfb093b4e5b98800ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xf3f185e62b02aaf6148a7614b943b1c640e08effc32be45a02fa548cb80e3c63", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x78217fe5d27b3392c7111afa4d615d70d84cd3179374dc1875f9ecb2774f56d5", "vout" => 0 } ], "vout" => [ %{ "address" => "Ab9VnEtwvJiJs9EzzWA9kJH8rm2UvoAjQ2", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "315" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "408f733f6219423e9104434e207738ec2152db8c97153008d8b70c0327e195e59a573809173b49f6bdb544d978b403c20ba7c7d9ea12e7e4622ceb0236e2520178", "verification" => "2102ba338b892051e7946a01db5e6070241d9ebd9e47028033aa492c10837092f164ac" } ], "size" => 202, "sys_fee" => "0", "txid" => "0xea2df2113958621090f949a5785b353d7e821b56b5d9ebe62ba8db5f167e8225", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x0f4e826f30b927b9bba4f14a06cf16c1d23f3ba4b27969e67186d03f12ee1f1d", "vout" => 0 } ], "vout" => [ %{ "address" => "AbZhKaVk59Jxuwzkk9XrRxFwzLhwzhTHeA", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "100" } ] }, %{ "attributes" => [], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40a7537342d5c8719be9a2cfe9da155afd8930bb71413d51aa07cdb1231d3ce4b65fea96499059c22a0a143b5c5737e5ee3a562d5e2c4fb74b7111aa83fb409807", "verification" => "210269a1fe5d5c5de9f268ae44885518c9a5f087ea001777ea6e2ff18a45408d2b8eac" }, %{ "invocation" => "407dd618cbda1a8a7a5844e377a51838d2f37407a07288e869a51792961dda61d35f696d5a66b609f80870edc962e7b4d48541ed75e30e38942710a2cdb13251e6", "verification" => "210320bba1040f8983ee6caa1326e7509449f8569400046e7903e39b3218ed1db4baac" }, %{ "invocation" => "404c6b21ceb1a8295f2d6394aa61a5d60fe9d52b1034210e1b2af9bedff90257218391fa6cc75edb89d37cc679d91920ba741e804d0ae94643f3b17d4903555c91", "verification" => "21027c0a815027b73b371347c38b391a0f0f1815a79680185854e771346e76ac902fac" } ], "size" => 654, "sys_fee" => "0", "txid" => "0xab6fb0e8a02a6ed8c075cfeac9da3cd7f440da5bf7cd4c8579478b8a1ee419ee", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x02b497ea1dc8aa9349d2c8bbaa79dbcc40aa77b398fe1bec8012d96dcb7d1c86", "vout" => 2 }, %{ "txid" => "0x46ba72b7e8f0a71ae6644bf47262624215fb98581498f9b5b3d6d5f94c0fc8ac", "vout" => 3 }, %{ "txid" => "0x5db33685bcf163bb100bb4c493765949d8756ec38cb780fb9a116df01f556c5f", "vout" => 0 } ], "vout" => [ %{ "address" => "AZHJD3yq2oC4m19ziV6woq8N7n6WAJCjWS", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "20" }, %{ "address" => "AT4TTRxrPFuxLGmkydYrt8a1GiFewGqZGA", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 1, "value" => "733" }, %{ "address" => "AeQLu1AXvXxNnamiX1RvU6pZ1GGhWPKDAq", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 2, "value" => "7" }, %{ "address" => "AKxVv9ti4na6SJdPg9SWttJLE1Web869fS", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 3, "value" => "48" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xff6341a02ede751ef587ba20fff994b51c24ac0570ca70f823022808aa7c3bbf", "vout" => 0 }, %{ "txid" => "0x66f0d21a33705b80d4250baf29d7a24a566f4b54b1c4140dac1f93ec26901f2a", "vout" => 0 }, %{ "txid" => "0x94d227562bc11d010e58e323c12a5e8bc056bb9288fc2f89bfe2bc5a3fef86fd", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4023c75edfe823d76905ee1e4c15c9b7f2501fe79b27e6f12919ffc06413fa7f7ceb263f05ad4fe87cbf47d986dc52481e982cec3a7603c981e1ab9f7a94c6a671", "verification" => "21039a80bb96e6c0cdd60d91143b8132232d84430d1710aa916902212b9a55b08ceeac" } ], "size" => 271, "sys_fee" => "0", "txid" => "0x855610bcd7b69fdeef65f8b73a066999f87124d96000e3c28c90b59634ab7c78", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AZ4ZaDg6H9L9JjVbHd7kNW7t2rLbejyaAb", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.0011858" } ] }, %{ "attributes" => [], "gas" => "0", "net_fee" => "0", "script" => "208663c57d6f829667c61cf395315119ed1155448b803071df64a40032662f8571348558ca14c02f47b85f4a2404f4a53ff7a693d4459b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc552c10b63616e63656c4f66666572671f559d5eea8ca22910a3feb0e4637c0f2e71c50e", "scripts" => [ %{ "invocation" => "4079d856792e7ec01dc0ce066cefbfad37e1098483c875a0cc7efee7aad6f9687c5e4361599ca7e60a28bad4a134ec7f721d843f218ef845dbdf04708dc11647a9", "verification" => "21038f3c43e504e2185a93dd5372176e0fd08271547edb34ec88f24ff78eec41ba83ac" } ], "size" => 324, "sys_fee" => "0", "txid" => "0x81bac3c2ecb0c8d331a621c5578b419856bfc3e5a9dcfd3e72ecf447eb0bfe06", "type" => "InvocationTransaction", "version" => 1, "vin" => [ %{ "txid" => "0xc89b71b9a7fc5f25f12550690d1f3bcf581ba1cb65681fd83ab2e8f5aa7bdd85", "vout" => 0 } ], "vout" => [ %{ "address" => "AKaTLdd4Hb3bGQSCPvqnWoe8b7igPZmAFN", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.00000001" } ] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xa4d5fa1a10518f23c093c4859a0750bc40677845e5d40af05ac3d8c39af512d0", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40edaa253c6ef4c1af1c79c4afe5a23371f5a5cc0c95a81fef968699006e2c069e6910f3118de3ec4f122d5ecbf21745e4d40f410ecc4b89d08302e5c4ce0f3b42", "verification" => "21034f1b557274edd91a8e8ebf6e66c5151dbba5cb842b2f02325e1f7ee630a0380fac" } ], "size" => 203, "sys_fee" => "0", "txid" => "0xc8add97a251f10fd77147668bafa37e68316554cd9d64503db9f8d60f52408d1", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AaWpzUxaseVH3aUvtp5dD4QbsSTg6CvkNB", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.21264285" } ] }, %{ "attributes" => [ %{ "data" => "bf28093023643bb0858a119f0e065b450b14564c", "usage" => "Script" } ], "gas" => "0", "net_fee" => "0", "script" => "0600bf7c481809145534bd37e4d65543700f00cdb833b1da94e4927314bf28093023643bb0858a119f0e065b450b14564c53c1087472616e7366657267187fc13bec8ff0906c079e7f4cc8276709472913f1660524be56b66d3cc9", "scripts" => [ %{ "invocation" => "4005bbd111005e52f7021d5ce3a65ae6eb804b0361a3d97c8463ffac8e2bf18e46ce42dd9584aab08c6f8d378328dc77a5bd03d7edec92bd4a5704b708382408a0", "verification" => "21035bdb8f130dfbb25037f93a26afdb0ea04973d893711351ed9afca51e3f4a17daac" } ], "size" => 221, "sys_fee" => "0", "txid" => "0xd3da8bac63bbc06a32e72b34ad755f17b7ff19d0cd436a57d6999eed398ec8b3", "type" => "InvocationTransaction", "version" => 1, "vin" => [], "vout" => [] }, %{ "attributes" => [], "claims" => [ %{ "txid" => "0xb71a32964d02d9d9c105f5c1bb98c24665a61aaf75b08edb066ece210367a298", "vout" => 0 }, %{ "txid" => "0xae6ca84df552d038f6bf557e8fa1af45686f7332950bbabd40b15147ed2097ac", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "40c4a04edb81b4aea285390d8a5b46c77b4db24d11a981c176578130ce7d491477be407265e3437cd8edfdf3968b647dffd7da83ab9aa5bd8f642e6117bbf06df6", "verification" => "21035f692136e46dcab4455e8f015f8ce04e0473f6b41bf84015ed8a5afbcc9f9136ac" } ], "size" => 237, "sys_fee" => "0", "txid" => "0x6b79145ac24fac0bddc4df98d22b136e514a05e6d1578c8ae721948ed23b6326", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "AKVwoXxikfMQtLC6tezQcdszrLJgDMUsLq", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.01193004" } ] }, %{ "attributes" => [%{"data" => "6e656f2d6f6e65", "usage" => "Remark15"}], "net_fee" => "0", "scripts" => [ %{ "invocation" => "407e4305984ec8b7563c9815976e1e5c40347adeb71e3a9fe772253f35cdff42825afac3e39dc88ee7e7728c1f56d2941e998cb95608f946d3a22f4ac1fb0b9034", "verification" => "21021cdb84434d21cd0500d0a2e6f3305e78791cf33b56627f2a43a129a29d9d6920ac" } ], "size" => 211, "sys_fee" => "0", "txid" => "0x2592139d2521d9ff1d9c602f538be0229cfec04854c383bc21a606ee9469853a", "type" => "ContractTransaction", "version" => 0, "vin" => [ %{ "txid" => "0x8c8c94c62ef52e355d5f26ca5c6ea6943923580490a4ce0067bf65c1419de98d", "vout" => 0 } ], "vout" => [ %{ "address" => "AMDfGmyBh6RCuZ4PCAoDuPVNjgDAhGK91a", "asset" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "n" => 0, "value" => "10" } ] }, %{ "attributes" => [], "gas" => "490", "net_fee" => "0", "script" => "084c726e546f6b656e0140084c6f6f7072696e67013108", "scripts" => [ %{ "invocation" => "40277f87254fcb33a76487f0527134d5b4eaae1baa834d12757c8002804f687df04d14c9865f321bde8356a1c9e5ba709546c21cd5ca52b9727594845ca0dd9e8f", "verification" => "2103730df1d0f8bf2e2df4d1502f30e507ee09dc0c56f0a11c5a23bf0a68eba2b556ac" } ], "size" => 3909, "sys_fee" => "490", "txid" => "0xe708a3e7697d89b9d3775399dcee22ffffed9602c4077968a66e059a4cccbe25", "type" => "InvocationTransaction", "version" => 1, "vin" => [ %{ "txid" => "0x57d6aa151fcf99dd29a5b651bc2295be77b8ed588dd13f2a43436a9e040acac2", "vout" => 0 } ], "vout" => [ %{ "address" => "AZy6n4jDAN4ssEDucN42Cpyj442K4u16r4", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "510" } ] }, %{ "attributes" => [%{"data" => "6e656f2d6f6e65", "usage" => "Remark15"}], "claims" => [ %{ "txid" => "0x2962439d9ecff6b38d8169ab8858d1983663ad308d99681d47d94f77de56e05b", "vout" => 0 } ], "net_fee" => "0", "scripts" => [ %{ "invocation" => "4079c5e8cc89f86080363fc1a29bb2c5ea9784b84ef1c56a48af0918c3f7fb147eebdd7a1462027ec3465d16649ce240a4cb8a828bbce01b09829a03bfe90c827a", "verification" => "210350feb6bcbcb342befda2bfde15ebdc0d35ac576624ca060fa129f2e8accd1109ac" } ], "size" => 212, "sys_fee" => "0", "txid" => "0x762435e41c83ddf01807891aad58a6f1a1bb1a9e51a8ead3885fbd5251028a2b", "type" => "ClaimTransaction", "version" => 0, "vin" => [], "vout" => [ %{ "address" => "ASGYHG2org22KsnXwD7YeayaEE1NHKubJk", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.00000182" } ] } ], "version" => 0 } @unknown_transaction %{ code: -100, message: "Unknown transaction" } @transaction %{ "txid" => "0x9e9526615ee7d460ed445c873c4af91bf7bfcc67e6e43feaf051b962a6df0a98", "size" => 10, "type" => "MinerTransaction", "version" => 0, "attributes" => [], "vin" => [], "vout" => [], "sys_fee" => "0", "net_fee" => "0", "scripts" => [], "nonce" => 3_576_443_283, "blockhash" => "0xd500ce5bce17351e9e5a24833499cf80f2d98882793c13b7bbf221ff32a42ccd", "confirmations" => 2_326_325, "blocktime" => 1_476_647_836 } @transactionfd %{ "attributes" => [], "blockhash" => "0xd7eaf396549415320c023523282e0c2160176a0519810e19a01eb13f4be55c63", "blocktime" => 1_499_134_416, "confirmations" => 1_359_296, "contract" => %{ "author" => "Erik Zhang", "code" => %{ "hash" => "0xce3a97d7cfaa770a5e51c5b12cd1d015fbb5f87d", "parameters" => [ "Hash160", "Hash256", "Hash256", "Hash160", "Boolean", "Integer", "Signature" ], "returntype" => "Boolean", "script" => "5679547aac640800516b629202557a7cac630800006b62860252796304007c0000682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726823416e745368617265732e5472616e73616374696f6e2e4765745265666572656e63657376c00078789c63a700527978c376681e416e745368617265732e4f75747075742e47657453637269707448617368682953797374656d2e457865637574696f6e456e67696e652e476574456e7472795363726970744861736887644e0076681b416e745368617265732e4f75747075742e47657441737365744964577987630800006b62a801766819416e745368617265732e4f75747075742e47657456616c7565557993557275758b6259ff757575682953797374656d2e457865637574696f6e456e67696e652e476574536372697074436f6e7461696e65726820416e745368617265732e5472616e73616374696f6e2e4765744f75747075747376c00078789c63eb00527978c376681e416e745368617265732e4f75747075742e47657453637269707448617368682953797374656d2e457865637574696f6e456e67696e652e476574456e747279536372697074486173688764920076681b416e745368617265732e4f75747075742e476574417373657449645779876428005479786819416e745368617265732e4f75747075742e47657456616c75659455727562490076681b416e745368617265732e4f75747075742e476574417373657449645879876425005579786819416e745368617265732e4f75747075742e47657456616c756593567275758b6215ff7575757600a1640800516b623200547a641600547a957c0400e1f50595a0641b00006b621a000400e1f505957c547a95a0640800006b62070075755166746407007562fbff6c66" }, "description" => "Agency Contract 2.0", "email" => "erik@antshares.org", "name" => "AgencyContract", "needstorage" => false, "version" => "2.0.1-preview2" }, "net_fee" => "0", "scripts" => [ %{ "invocation" => "404b6c8254acd0925ccef7620488de7abb14aa4c42bfe245fa7e916c08922ea62a6251d2df433cb0e753eb71db626d1a8770825372d9ddb99818aa3a8c84ef2797", "verification" => "2103c368b6aac37dda8a401fd04ec4d868f6c67ff3802e5e047918ae6c84d4fc3a50ac" } ], "size" => 972, "sys_fee" => "500", "txid" => "0xfd161ccd87deab812daa433cbc0f8f6468de24f1d708187beef5ab9ada7050f3", "type" => "PublishTransaction", "version" => 0, "vin" => [ %{ "txid" => "0xa899f409d3a753192a3eb6cd7fdaef4c3b69d23e12b65e3b32abc18588403122", "vout" => 0 } ], "vout" => [ %{ "address" => "ANxAmsn9Qnx5gEUtgsmSqt7TycE7Vbkdv4", "asset" => "0x602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", "n" => 0, "value" => "0.00023856" } ] } @transaction45 %{ "attributes" => [ %{ "data" => "5fa99d93303775fe50ca119c327759313eccfa1c", "usage" => "Script" } ], "blockhash" => "0x1f9e6de446b3b78807efd0df1b22be35a661b608def2ccfc0cc7909ceacfec4e", "blocktime" => 1_503_219_640, "confirmations" => 1_193_922, "gas" => "1", "net_fee" => "0", "script" => "2102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a702102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e21024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e8950932103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c57c1145fa99d93303775fe50ca119c327759313eccfa1c68194e656f2e426c6f636b636861696e2e4765744163636f756e7468144e656f2e4163636f756e742e536574566f746573", "scripts" => [ %{ "invocation" => "408df19860b2d93caa948cb7fcf09b407a67d0c6c775dd7b3dbff29671f4fac3974ae3617a0564cf89528e5de99abd17f261ed0212a769bf3aa3cc2e68a526632640c1300d38a0659824ef959aa9163bb49b6c8132ae17df336a3f78996f633f952bc54272f010431a86c4f8af60961d2b544e76043cead27e238958f371842dc4c94098f112f68f9e2427088e625b030cf7c960a4715157366b44aa64d76f47c9c9944cbfa0ebfc332c5fd0562e5976b6fb6e919ea481280008503834b9acabc1e0cd4065ae9872cb971e7f3394504290496f3361bd8bdd09e872b965aedc3f3e26b5c8fe6b6601bfacc68f3cb7f79fc593dcd73513b284d093428e5c0d34356601bc08", "verification" => "542102486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a7021024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d2102aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e2103b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c2103b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a2102ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba5542102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e89509357ae" }, %{ "invocation" => "4065a3c7abb44ed656d2625ec748bcf4add247f39956190e8907800c7871cdd10d2e470367242440cb8393546178a377a4c7893c1290530e5b45f457fc83bcce73", "verification" => "2102df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093ac" } ], "size" => 981, "sys_fee" => "1", "txid" => "0x45ced268026de0fcaf7035e4960e860b98fe1ae5122e716d9daac1163f13e534", "type" => "InvocationTransaction", "version" => 1, "vin" => [ %{ "txid" => "0x0f1f3e1b3becc0ad835ba7f19a0290743ebc1773705f2c44f63cf6a89dd4c6aa", "vout" => 0 } ], "vout" => [] } @transaction9f %{ "attributes" => [ %{ "data" => "6e656f2d6f6e652d696e766f6b653a7b22636f6e7472616374223a22307861383763633261353133663564386234613432343332333433363837633231323763363062633366222c226d6574686f64223a227472616e73666572222c22706172616d73223a5b5b2266726f6d222c22307861636134666635653565663234346631383865643563636634393238316635336463383666383635225d2c5b22746f222c22307835343438373039393339313434303564393763396565343931393534646530623235613466323666225d2c5b2276616c7565222c22302e303031225d5d7d", "usage" => "Remark14" }, %{"data" => "6e656f2d6f6e65", "usage" => "Remark15"}, %{"data" => "34313834353436363237", "usage" => "Remark15"}, %{ "data" => "65f886dc531f2849cf5ced88f144f25e5effa4ac", "usage" => "Script" } ], "blockhash" => "0x1670427ca839ab855a32694a803dc1357840ecb1a5ffc2ac3731b0e129b3b956", "blocktime" => 1_527_582_147, "confirmations" => 387, "gas" => "0", "net_fee" => "0", "script" => "03a08601146ff2a4250bde541949eec9975d401439997048541465f886dc531f2849cf5ced88f144f25e5effa4ac53c1087472616e73666572673fbc607c12c28736343224a4b4d8f513a5c27ca8", "scripts" => [ %{ "invocation" => "40638f88bc555bc114c7f835735e2ba558a7b8d79ad6ac002eda4314cbbbeb50a2e8dde4ecedd7bf31a11333e0d3be947ae43f18406bc46b9fb3ebf7181cfbbfd2", "verification" => "210381db9ec3fe4bea3da50ad739ef56b7c3dceebfb0331bbe9da862dadbc0c231b8ac" } ], "size" => 458, "sys_fee" => "0", "txid" => "0x9f3316d2eaa4c5cdd8cfbd3252be14efb8e9dcd76d3115517c45f85946db41b2", "type" => "InvocationTransaction", "version" => 1, "vin" => [], "vout" => [] } @unknown_asset %{ code: -100, message: "Unknown asset" } @asset %{ "version" => 0, "id" => "0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b", "type" => "GoverningToken", "name" => [ %{"lang" => "zh-CN", "name" => "\\u5C0F\\u8681\\u80A1"}, %{"lang" => "en", "name" => "AntShare"} ], "amount" => "100000000", "available" => "100000000", "precision" => 0, "owner" => "00", "admin" => "Abf2qMs1pzQb8kYk9RuxtUb9jtRKJVuBJt", "issuer" => "Abf2qMs1pzQb8kYk9RuxtUb9jtRKJVuBJt", "expiration" => 4_000_000, "frozen" => false } @unknown_contract %{ code: -100, message: "Unknown contract" } @contract %{ "author" => "Red Pulse", "code_version" => "1.0", "description" => "RPX Sale", "email" => "rpx@red-pulse.com", "hash" => "0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9", "name" => "RPX Sale", "parameters" => ["String", "Array"], "properties" => %{ "dynamic_invoke" => false, "storage" => true }, "returntype" => "ByteArray", "script" => "011f", "version" => 0 } defp result(result), do: %{"result" => result} defp error(error), do: %{"error" => error} def post(url, data, headers, opts) do result = handle_post(Poison.decode!(data)) if is_nil(result) do IO.inspect({url, data, headers, opts}) result = HTTPoison.post(url, data, headers, opts) IO.inspect(result) IO.inspect(Poison.decode!(:zlib.gunzip(elem(result, 1).body)), limit: :infinity) result else result end end def handle_post(%{"method" => "getblockerror"}) do body = Poison.encode!(%{ "error" => %{ "code" => -32601, "message" => "Method not found" }, "id" => 5, "jsonrpc" => "2.0" }) {:ok, %HTTPoison.Response{headers: [], status_code: 200, body: body}} end def handle_post(%{ "params" => [hash], "method" => "getcontractstate", "jsonrpc" => "2.0", "id" => 5 }) do data = contract_data(hash) unless is_nil(data) do body = :zlib.gzip(Poison.encode!(Map.merge(%{"jsonrpc" => "2.0", "id" => 5}, data))) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end end def handle_post(%{ "params" => [hash, _length], "method" => "getrawtransaction", "jsonrpc" => "2.0", "id" => 5 }) do data = transaction_data(hash) unless is_nil(data) do body = :zlib.gzip(Poison.encode!(Map.merge(%{"jsonrpc" => "2.0", "id" => 5}, data))) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end end def handle_post(%{"method" => "getblock", "params" => [123_457, _]}) do {:error, :timeout} end def handle_post(%{ "params" => [hash, _length], "method" => "getblock", "jsonrpc" => "2.0", "id" => 5 }) do data = block_data(hash) unless is_nil(data) do body = :zlib.gzip(Poison.encode!(Map.merge(%{"jsonrpc" => "2.0", "id" => 5}, data))) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end end def handle_post(%{ "params" => [hash, _length], "method" => "getassetstate", "jsonrpc" => "2.0", "id" => 5 }) do data = asset_data(hash) unless is_nil(data) do body = :zlib.gzip(Poison.encode!(Map.merge(%{"jsonrpc" => "2.0", "id" => 5}, data))) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end end def handle_post(%{"params" => [], "method" => "getblockcount", "jsonrpc" => "2.0", "id" => 5}) do body = :zlib.gzip(Poison.encode!(%{"jsonrpc" => "2.0", "id" => 5, "result" => 2_400_000})) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end def handle_post(%{"params" => [], "method" => "getversion", "jsonrpc" => "2.0", "id" => 5}) do body = :zlib.gzip( Poison.encode!(%{ "id" => 5, "jsonrpc" => "2.0", "result" => %{ "nonce" => 22_173_783, "port" => 10333, "useragent" => "/NEO:2.7.6.1/" } }) ) { :ok, %HTTPoison.Response{headers: [{"Content-Encoding", "gzip"}], status_code: 200, body: body} } end def handle_post(_), do: nil def block_data(0), do: result(@block0) def block_data(1), do: result(@block1) def block_data(2), do: result(@block2) def block_data(123), do: result(@block123) def block_data(2_399_999), do: result(@block199) def block_data(123_456), do: error("error") def block_data(1_444_843), do: result(@block1444843) def block_data(2_120_069), do: result(@block2120069) def block_data("d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf"), do: result(@block0) def block_data("d782db8a38b0eea0d7394e0f007c61c71798867578c77c387c08113903946cc9"), do: result(@block1) def block_data("87ba13e7af11d599364f7ee0e59970e7e84611bbdbe27e4fccee8fb7ec6aba28"), do: result(@block123) def block_data("0000000000000000000000000000000000000000000000000000000000000000"), do: error(@unknown_block) def block_data(_), do: nil def transaction_data("9f3316d2eaa4c5cdd8cfbd3252be14efb8e9dcd76d3115517c45f85946db41b2"), do: result(@transaction9f) def transaction_data("45ced268026de0fcaf7035e4960e860b98fe1ae5122e716d9daac1163f13e534"), do: result(@transaction45) def transaction_data("0x9e9526615ee7d460ed445c873c4af91bf7bfcc67e6e43feaf051b962a6df0a98"), do: result(@transaction) def transaction_data("fd161ccd87deab812daa433cbc0f8f6468de24f1d708187beef5ab9ada7050f3"), do: result(@transactionfd) def transaction_data("0000000000000000000000000000000000000000000000000000000000000000"), do: error(@unknown_transaction) def transaction_data(_), do: nil def asset_data("c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"), do: result(@asset) def asset_data("0xc56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"), do: result(@asset) def asset_data("0000000000000000000000000000000000000000000000000000000000000000"), do: error(@unknown_asset) def asset_data("0x0000000000000000000000000000000000000000000000000000000000000000"), do: error(@unknown_asset) def asset_data(_), do: nil def contract_data("0xecc6b20d3ccac1ee9ef109af5a7cdb85706b1df9"), do: result(@contract) def contract_data("0x0000000000000000000000000000000000000000"), do: error(@unknown_contract) def contract_data(_), do: nil end
37.599227
1,368
0.602267
08e7194468ad595c4869d632b3887905b73be103
13,794
ex
Elixir
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/api/floodlight_configurations.ex
ukrbublik/elixir-google-api
364cec36bc76f60bec94cbcad34844367a29d174
[ "Apache-2.0" ]
null
null
null
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/api/floodlight_configurations.ex
ukrbublik/elixir-google-api
364cec36bc76f60bec94cbcad34844367a29d174
[ "Apache-2.0" ]
null
null
null
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/api/floodlight_configurations.ex
ukrbublik/elixir-google-api
364cec36bc76f60bec94cbcad34844367a29d174
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.DFAReporting.V34.Api.FloodlightConfigurations do @moduledoc """ API calls for all endpoints tagged `FloodlightConfigurations`. """ alias GoogleApi.DFAReporting.V34.Connection alias GoogleApi.Gax.{Request, Response} @library_version Mix.Project.config() |> Keyword.get(:version, "") @doc """ Gets one floodlight configuration by ID. ## Parameters * `connection` (*type:* `GoogleApi.DFAReporting.V34.Connection.t`) - Connection to server * `profile_id` (*type:* `String.t`) - User profile ID associated with this request. * `id` (*type:* `String.t`) - Floodlight configuration ID. * `optional_params` (*type:* `keyword()`) - Optional parameters * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. * `:access_token` (*type:* `String.t`) - OAuth access token. * `:alt` (*type:* `String.t`) - Data format for response. * `:callback` (*type:* `String.t`) - JSONP * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. * `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). * `opts` (*type:* `keyword()`) - Call options ## Returns * `{:ok, %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}}` on success * `{:error, info}` on failure """ @spec dfareporting_floodlight_configurations_get( Tesla.Env.client(), String.t(), String.t(), keyword(), keyword() ) :: {:ok, GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration.t()} | {:ok, Tesla.Env.t()} | {:error, any()} def dfareporting_floodlight_configurations_get( connection, profile_id, id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :"$.xgafv" => :query, :access_token => :query, :alt => :query, :callback => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :uploadType => :query, :upload_protocol => :query } request = Request.new() |> Request.method(:get) |> Request.url( "/dfareporting/v3.4/userprofiles/{profileId}/floodlightConfigurations/{id}", %{ "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1), "id" => URI.encode(id, &(URI.char_unreserved?(&1) || &1 == ?/)) } ) |> Request.add_optional_params(optional_params_config, optional_params) |> Request.library_version(@library_version) connection |> Connection.execute(request) |> Response.decode( opts ++ [struct: %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}] ) end @doc """ Retrieves a list of floodlight configurations, possibly filtered. ## Parameters * `connection` (*type:* `GoogleApi.DFAReporting.V34.Connection.t`) - Connection to server * `profile_id` (*type:* `String.t`) - User profile ID associated with this request. * `optional_params` (*type:* `keyword()`) - Optional parameters * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. * `:access_token` (*type:* `String.t`) - OAuth access token. * `:alt` (*type:* `String.t`) - Data format for response. * `:callback` (*type:* `String.t`) - JSONP * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. * `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). * `:ids` (*type:* `list(String.t)`) - Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned. * `opts` (*type:* `keyword()`) - Call options ## Returns * `{:ok, %GoogleApi.DFAReporting.V34.Model.FloodlightConfigurationsListResponse{}}` on success * `{:error, info}` on failure """ @spec dfareporting_floodlight_configurations_list( Tesla.Env.client(), String.t(), keyword(), keyword() ) :: {:ok, GoogleApi.DFAReporting.V34.Model.FloodlightConfigurationsListResponse.t()} | {:ok, Tesla.Env.t()} | {:error, any()} def dfareporting_floodlight_configurations_list( connection, profile_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :"$.xgafv" => :query, :access_token => :query, :alt => :query, :callback => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :uploadType => :query, :upload_protocol => :query, :ids => :query } request = Request.new() |> Request.method(:get) |> Request.url("/dfareporting/v3.4/userprofiles/{profileId}/floodlightConfigurations", %{ "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) |> Request.library_version(@library_version) connection |> Connection.execute(request) |> Response.decode( opts ++ [struct: %GoogleApi.DFAReporting.V34.Model.FloodlightConfigurationsListResponse{}] ) end @doc """ Updates an existing floodlight configuration. This method supports patch semantics. ## Parameters * `connection` (*type:* `GoogleApi.DFAReporting.V34.Connection.t`) - Connection to server * `profile_id` (*type:* `String.t`) - User profile ID associated with this request. * `optional_params` (*type:* `keyword()`) - Optional parameters * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. * `:access_token` (*type:* `String.t`) - OAuth access token. * `:alt` (*type:* `String.t`) - Data format for response. * `:callback` (*type:* `String.t`) - JSONP * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. * `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). * `:id` (*type:* `String.t`) - FloodlightConfiguration ID. * `:body` (*type:* `GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration.t`) - * `opts` (*type:* `keyword()`) - Call options ## Returns * `{:ok, %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}}` on success * `{:error, info}` on failure """ @spec dfareporting_floodlight_configurations_patch( Tesla.Env.client(), String.t(), keyword(), keyword() ) :: {:ok, GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration.t()} | {:ok, Tesla.Env.t()} | {:error, any()} def dfareporting_floodlight_configurations_patch( connection, profile_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :"$.xgafv" => :query, :access_token => :query, :alt => :query, :callback => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :uploadType => :query, :upload_protocol => :query, :id => :query, :body => :body } request = Request.new() |> Request.method(:patch) |> Request.url("/dfareporting/v3.4/userprofiles/{profileId}/floodlightConfigurations", %{ "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) |> Request.library_version(@library_version) connection |> Connection.execute(request) |> Response.decode( opts ++ [struct: %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}] ) end @doc """ Updates an existing floodlight configuration. ## Parameters * `connection` (*type:* `GoogleApi.DFAReporting.V34.Connection.t`) - Connection to server * `profile_id` (*type:* `String.t`) - User profile ID associated with this request. * `optional_params` (*type:* `keyword()`) - Optional parameters * `:"$.xgafv"` (*type:* `String.t`) - V1 error format. * `:access_token` (*type:* `String.t`) - OAuth access token. * `:alt` (*type:* `String.t`) - Data format for response. * `:callback` (*type:* `String.t`) - JSONP * `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. * `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. * `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). * `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). * `:body` (*type:* `GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration.t`) - * `opts` (*type:* `keyword()`) - Call options ## Returns * `{:ok, %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}}` on success * `{:error, info}` on failure """ @spec dfareporting_floodlight_configurations_update( Tesla.Env.client(), String.t(), keyword(), keyword() ) :: {:ok, GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration.t()} | {:ok, Tesla.Env.t()} | {:error, any()} def dfareporting_floodlight_configurations_update( connection, profile_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :"$.xgafv" => :query, :access_token => :query, :alt => :query, :callback => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :uploadType => :query, :upload_protocol => :query, :body => :body } request = Request.new() |> Request.method(:put) |> Request.url("/dfareporting/v3.4/userprofiles/{profileId}/floodlightConfigurations", %{ "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) |> Request.library_version(@library_version) connection |> Connection.execute(request) |> Response.decode( opts ++ [struct: %GoogleApi.DFAReporting.V34.Model.FloodlightConfiguration{}] ) end end
42.183486
196
0.62056
08e72d2ce0d725d5ed5d46212354ebb7008b33bc
66
ex
Elixir
apps/api_web/lib/api_web/views/admin/session/session_view.ex
fjlanasa/api
c39bc393aea572bfb81754b2ea1adf9dda9ce24a
[ "MIT" ]
62
2019-01-17T12:34:39.000Z
2022-03-20T21:49:47.000Z
apps/api_web/lib/api_web/views/admin/session/session_view.ex
fjlanasa/api
c39bc393aea572bfb81754b2ea1adf9dda9ce24a
[ "MIT" ]
375
2019-02-13T15:30:50.000Z
2022-03-30T18:50:41.000Z
apps/api_web/lib/api_web/views/admin/session/session_view.ex
fjlanasa/api
c39bc393aea572bfb81754b2ea1adf9dda9ce24a
[ "MIT" ]
14
2019-01-16T19:35:57.000Z
2022-02-26T18:55:54.000Z
defmodule ApiWeb.Admin.SessionView do use ApiWeb.Web, :view end
16.5
37
0.787879
08e72d738512b00839e387dd25c72622a41c8135
528
exs
Elixir
apps/mishka_database/priv/repo/migrations/20210330132407_blog_likes.exs
mojtaba-naserei/mishka-cms
1f31f61347bab1aae6ba0d47c5515a61815db6c9
[ "Apache-2.0" ]
35
2021-06-26T09:05:50.000Z
2022-03-30T15:41:22.000Z
apps/mishka_database/priv/repo/migrations/20210330132407_blog_likes.exs
iArazar/mishka-cms
8b579101d607d91e80834527c1508fe5f4ceefef
[ "Apache-2.0" ]
101
2021-01-01T09:54:07.000Z
2022-03-28T10:02:24.000Z
apps/mishka_database/priv/repo/migrations/20210330132407_blog_likes.exs
iArazar/mishka-cms
8b579101d607d91e80834527c1508fe5f4ceefef
[ "Apache-2.0" ]
8
2021-01-17T17:08:07.000Z
2022-03-11T16:12:06.000Z
defmodule MishkaDatabase.Repo.Migrations.BlogLikes do use Ecto.Migration def change do create table(:blog_likes, primary_key: false) do add(:id, :uuid, primary_key: true) add(:post_id, references(:blog_posts, on_delete: :nothing, type: :uuid)) add(:user_id, references(:users, on_delete: :nothing, type: :uuid)) timestamps() end create( index(:blog_likes, [:post_id, :user_id], name: :index_blog_likes_on_post_id_and_user_id, unique: true ) ) end end
25.142857
78
0.659091
08e73020d92ee4210cf677689edf115ed942bb4f
441
exs
Elixir
test/elixir_keeb_ui_web/views/error_view_test.exs
amalbuquerque/elixir_keeb_ui
d203ccc128547668febd13a35d9472e5b4b3151a
[ "MIT" ]
3
2020-07-07T15:57:55.000Z
2021-08-12T05:09:38.000Z
test/elixir_keeb_ui_web/views/error_view_test.exs
amalbuquerque/elixir_keeb_ui
d203ccc128547668febd13a35d9472e5b4b3151a
[ "MIT" ]
3
2020-09-28T20:53:30.000Z
2021-08-31T20:41:04.000Z
test/elixir_keeb_ui_web/views/error_view_test.exs
amalbuquerque/elixir_keeb_ui
d203ccc128547668febd13a35d9472e5b4b3151a
[ "MIT" ]
1
2021-07-16T13:49:09.000Z
2021-07-16T13:49:09.000Z
defmodule ElixirKeeb.UIWeb.ErrorViewTest do use ElixirKeeb.UIWeb.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do assert render_to_string(ElixirKeeb.UIWeb.ErrorView, "404.html", []) == "Not Found" end test "renders 500.html" do assert render_to_string(ElixirKeeb.UIWeb.ErrorView, "500.html", []) == "Internal Server Error" end end
29.4
98
0.739229
08e74f198117378264a37a07cc79a952bb0e01ea
2,514
exs
Elixir
test/jap_haji_web/controllers/verb_controller_test.exs
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
1
2017-11-27T07:11:27.000Z
2017-11-27T07:11:27.000Z
test/jap_haji_web/controllers/verb_controller_test.exs
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
null
null
null
test/jap_haji_web/controllers/verb_controller_test.exs
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
null
null
null
defmodule JapHajiWeb.VerbControllerTest do use JapHajiWeb.ConnCase alias JapHaji.API alias JapHaji.API.Verb @create_attrs %{kumi: "ichidan", midashi: "食べる", yomi: "たべる"} @update_attrs %{kumi: "ichidan", midashi: "食べる", yomi: "たべる"} @invalid_attrs %{kumi: nil, midashi: nil, yomi: nil} def fixture(:verb) do {:ok, verb} = API.create_verb(@create_attrs) verb end setup %{conn: conn} do {:ok, conn: put_req_header(conn, "accept", "application/json")} end describe "index" do test "lists all verbs", %{conn: conn} do conn = get conn, verb_path(conn, :index) assert json_response(conn, 200)["data"] == [] end end describe "create verb" do test "renders verb when data is valid", %{conn: conn} do conn = post conn, verb_path(conn, :create), verb: @create_attrs assert %{"id" => id} = json_response(conn, 201)["data"] conn = get conn, verb_path(conn, :show, id) assert json_response(conn, 200)["data"] == %{ "id" => id, "kumi" => "ichidan", "midashi" => "食べる", "yomi" => "たべる", "polite_present" => "食べます" } end test "renders errors when data is invalid", %{conn: conn} do conn = post conn, verb_path(conn, :create), verb: @invalid_attrs assert json_response(conn, 422)["errors"] != %{} end end describe "update verb" do setup [:create_verb] test "renders verb when data is valid", %{conn: conn, verb: %Verb{id: id} = verb} do conn = put conn, verb_path(conn, :update, verb), verb: @update_attrs assert %{"id" => ^id} = json_response(conn, 200)["data"] conn = get conn, verb_path(conn, :show, id) assert json_response(conn, 200)["data"] == %{ "id" => id, "kumi" => "ichidan", "midashi" => "食べる", "yomi" => "たべる", "polite_present" => "食べます" } end test "renders errors when data is invalid", %{conn: conn, verb: verb} do conn = put conn, verb_path(conn, :update, verb), verb: @invalid_attrs assert json_response(conn, 422)["errors"] != %{} end end describe "delete verb" do setup [:create_verb] test "deletes chosen verb", %{conn: conn, verb: verb} do conn = delete conn, verb_path(conn, :delete, verb) assert response(conn, 204) assert_error_sent 404, fn -> get conn, verb_path(conn, :show, verb) end end end defp create_verb(_) do verb = fixture(:verb) {:ok, verb: verb} end end
28.568182
88
0.593079
08e76383fcc792a9c710d48aa48efe4b0455c95e
259
ex
Elixir
lib/boss_first_task.ex
inaka/beam_olympics-solver
a32fa18a4a7e03900b7274c4a0c4e8b82f1a9768
[ "Apache-2.0" ]
1
2018-10-11T06:58:02.000Z
2018-10-11T06:58:02.000Z
lib/boss_first_task.ex
inaka/beam_olympics-solver
a32fa18a4a7e03900b7274c4a0c4e8b82f1a9768
[ "Apache-2.0" ]
null
null
null
lib/boss_first_task.ex
inaka/beam_olympics-solver
a32fa18a4a7e03900b7274c4a0c4e8b82f1a9768
[ "Apache-2.0" ]
null
null
null
defmodule BossFirstTask do @moduledoc """ Solver for bo_first_task """ @doc """ Solves the task requirement """ def solve do Boss.submit &solution/1 end @doc """ Solution for bo_first_task """ def solution(x) do x end end
12.333333
29
0.625483
08e764952ae837a6a8ff1e795e1f65ab7e3711d9
548
ex
Elixir
lib/tzdata/tzdata_app.ex
DefactoSoftware/tzdata
60cf09cf924e34dac6ce332283cc39182e771c5f
[ "MIT" ]
245
2015-02-26T10:04:32.000Z
2022-02-18T04:22:02.000Z
lib/tzdata/tzdata_app.ex
DefactoSoftware/tzdata
60cf09cf924e34dac6ce332283cc39182e771c5f
[ "MIT" ]
104
2015-06-26T17:35:15.000Z
2022-03-20T00:07:06.000Z
lib/tzdata/tzdata_app.ex
DefactoSoftware/tzdata
60cf09cf924e34dac6ce332283cc39182e771c5f
[ "MIT" ]
78
2015-05-16T15:22:59.000Z
2022-03-13T09:43:50.000Z
defmodule Tzdata.App do @moduledoc false use Application def start(_type, _args) do children = [Tzdata.EtsHolder] children = case Application.fetch_env(:tzdata, :autoupdate) do {:ok, :enabled} -> children ++ [Tzdata.ReleaseUpdater] {:ok, :disabled} -> children end {:ok, pid} = Supervisor.start_link(children, strategy: :one_for_one) # Make zone atoms exist so that when to_existing_atom is called, all of the zones exist Tzdata.zone_list |> Enum.map(&(&1 |> String.to_atom)) {:ok, pid} end end
26.095238
91
0.671533
08e77899607ae1d4bdec9351b68a59c92fd1618b
1,647
ex
Elixir
clients/firestore/lib/google_api/firestore/v1beta1/model/empty.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/firestore/lib/google_api/firestore/v1beta1/model/empty.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/firestore/lib/google_api/firestore/v1beta1/model/empty.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Firestore.V1beta1.Model.Empty do @moduledoc """ A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for &#x60;Empty&#x60; is empty JSON object &#x60;{}&#x60;. ## Attributes """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{} end defimpl Poison.Decoder, for: GoogleApi.Firestore.V1beta1.Model.Empty do def decode(value, options) do GoogleApi.Firestore.V1beta1.Model.Empty.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Firestore.V1beta1.Model.Empty do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
38.302326
381
0.750455
08e7919d7736a994ab1f986ceaa3792f7c14cce3
1,406
ex
Elixir
lib/blockfrost/response/cardano/pools/specific_stake_pool_response.ex
blockfrost/blockfrost-elixir
b1f8ea7ae47cd3a7037e1c9ed0d3691fc775bdec
[ "Apache-2.0" ]
13
2021-08-31T03:54:37.000Z
2022-01-30T17:39:40.000Z
lib/blockfrost/response/cardano/pools/specific_stake_pool_response.ex
blockfrost/blockfrost-elixir
b1f8ea7ae47cd3a7037e1c9ed0d3691fc775bdec
[ "Apache-2.0" ]
6
2021-08-30T04:45:52.000Z
2021-09-23T09:15:08.000Z
lib/blockfrost/response/cardano/pools/specific_stake_pool_response.ex
blockfrost/blockfrost-elixir
b1f8ea7ae47cd3a7037e1c9ed0d3691fc775bdec
[ "Apache-2.0" ]
null
null
null
defmodule Blockfrost.Response.SpecificStakePoolResponse do use Blockfrost.Response.BaseSchema @type t :: %__MODULE__{ pool_id: String.t(), hex: String.t(), vrf_key: String.t(), blocks_minted: integer(), live_stake: String.t(), live_size: float(), live_saturation: float(), live_delegators: integer(), active_stake: String.t(), active_size: float(), declared_pledge: String.t(), live_pledge: String.t(), margin_cost: float(), fixed_cost: String.t(), reward_account: String.t(), owners: list(String.t()), registration: list(String.t()), retirement: list(String.t()) } embedded_schema do field(:pool_id, :string) field(:hex, :string) field(:vrf_key, :string) field(:blocks_minted, :integer) field(:live_stake, :string) field(:live_size, :float) field(:live_saturation, :float) field(:live_delegators, :integer) field(:active_stake, :string) field(:active_size, :float) field(:declared_pledge, :string) field(:live_pledge, :string) field(:margin_cost, :float) field(:fixed_cost, :string) field(:reward_account, :string) field(:owners, {:array, :string}) field(:registration, {:array, :string}) field(:retirement, {:array, :string}) end end
30.565217
58
0.601707
08e7a92bccd9d9e5e50d6f322d66d83ee066d931
63
ex
Elixir
lib/jap_haji_web/views/layout_view.ex
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
1
2017-11-27T07:11:27.000Z
2017-11-27T07:11:27.000Z
lib/jap_haji_web/views/layout_view.ex
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
null
null
null
lib/jap_haji_web/views/layout_view.ex
swarut/jap-haji
04211ff56add0cbe6e7e09e4b41baa3771125f82
[ "Apache-2.0" ]
null
null
null
defmodule JapHajiWeb.LayoutView do use JapHajiWeb, :view end
15.75
34
0.809524
08e7aca6be9cdea4d0c01e2b4f152fc92ceeb5e5
987
exs
Elixir
mix.exs
damonvjanis/telnyx
917eea167164040c531127c993fda967ec070e5a
[ "MIT" ]
4
2020-10-16T13:27:11.000Z
2021-02-07T01:45:43.000Z
mix.exs
damonvjanis/telnyx
917eea167164040c531127c993fda967ec070e5a
[ "MIT" ]
null
null
null
mix.exs
damonvjanis/telnyx
917eea167164040c531127c993fda967ec070e5a
[ "MIT" ]
null
null
null
defmodule Telnyx.MixProject do use Mix.Project def project do [ app: :telnyx, version: "0.3.0", elixir: "~> 1.7", description: "Telnyx API Elixir Client", source_url: "https://github.com/damonvjanis/telnyx", package: package(), start_permanent: Mix.env() == :prod, deps: deps(), # Suppress warnings xref: [ exclude: [ Mojito ] ] ] end def application do [ extra_applications: [:logger], mod: {Telnyx.Application, []}, env: [client: Telnyx.Client.Mojito, base_url: "https://api.telnyx.com/v2"] ] end defp package do [ licenses: ["MIT"], maintainers: ["damon janis <damonvjanis@gmail.com>"], links: %{github: "https://github.com/damonvjanis/telnyx"} ] end defp deps do [ {:mojito, "~> 0.7.0", optional: true}, {:jason, "~> 1.1"}, {:ex_doc, "~> 0.21", only: :dev, runtime: false} ] end end
21
80
0.54002
08e7b5a40e24a6df7010fa7ebca4734fd935418d
152
ex
Elixir
test/support/s/image.ex
sreecodeslayer/exfile
c88288563d688fb47a6fcae190dbe1b8eb64bf9b
[ "MIT" ]
100
2015-12-25T12:38:41.000Z
2021-12-31T11:41:20.000Z
test/support/s/image.ex
sreecodeslayer/exfile
c88288563d688fb47a6fcae190dbe1b8eb64bf9b
[ "MIT" ]
62
2015-12-26T01:43:54.000Z
2019-09-15T16:16:35.000Z
test/support/s/image.ex
sreecodeslayer/exfile
c88288563d688fb47a6fcae190dbe1b8eb64bf9b
[ "MIT" ]
22
2016-04-19T11:54:38.000Z
2021-09-29T14:48:46.000Z
defmodule Exfile.S.Image do use Ecto.Schema schema "images" do field :image, Exfile.Ecto.File field :image_content_type, :string end end
16.888889
38
0.717105
08e7cf5104b3e712057efc3c5081e470c1b0aa26
3,835
ex
Elixir
clients/spanner/lib/google_api/spanner/v1/model/backup.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
null
null
null
clients/spanner/lib/google_api/spanner/v1/model/backup.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
1
2020-12-18T09:25:12.000Z
2020-12-18T09:25:12.000Z
clients/spanner/lib/google_api/spanner/v1/model/backup.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
1
2020-10-04T10:12:44.000Z
2020-10-04T10:12:44.000Z
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Spanner.V1.Model.Backup do @moduledoc """ A backup of a Cloud Spanner database. ## Attributes * `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The backup will contain an externally consistent copy of the database at the timestamp specified by `create_time`. `create_time` is approximately the time the CreateBackup request is received. * `database` (*type:* `String.t`, *default:* `nil`) - Required for the CreateBackup operation. Name of the database from which this backup was created. This needs to be in the same instance as the backup. Values are of the form `projects//instances//databases/`. * `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Required for the CreateBackup operation. The expiration time of the backup, with microseconds granularity that must be at least 6 hours and at most 366 days from the time the CreateBackup request is processed. Once the `expire_time` has passed, the backup is eligible to be automatically deleted by Cloud Spanner to free the resources used by the backup. * `name` (*type:* `String.t`, *default:* `nil`) - Output only for the CreateBackup operation. Required for the UpdateBackup operation. A globally unique identifier for the backup which cannot be changed. Values are of the form `projects//instances//backups/a-z*[a-z0-9]` The final segment of the name must be between 2 and 60 characters in length. The backup is stored in the location(s) specified in the instance configuration of the instance containing the backup, identified by the prefix of the backup name of the form `projects//instances/`. * `referencingDatabases` (*type:* `list(String.t)`, *default:* `nil`) - Output only. The names of the restored databases that reference the backup. The database names are of the form `projects//instances//databases/`. Referencing databases may exist in different instances. The existence of any referencing database prevents the backup from being deleted. When a restored database from the backup enters the `READY` state, the reference to the backup is removed. * `sizeBytes` (*type:* `String.t`, *default:* `nil`) - Output only. Size of the backup in bytes. * `state` (*type:* `String.t`, *default:* `nil`) - Output only. The current state of the backup. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :createTime => DateTime.t(), :database => String.t(), :expireTime => DateTime.t(), :name => String.t(), :referencingDatabases => list(String.t()), :sizeBytes => String.t(), :state => String.t() } field(:createTime, as: DateTime) field(:database) field(:expireTime, as: DateTime) field(:name) field(:referencingDatabases, type: :list) field(:sizeBytes) field(:state) end defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.Backup do def decode(value, options) do GoogleApi.Spanner.V1.Model.Backup.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.Backup do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
59
550
0.726728
08e7f652b7bb5bcad0e3feab8628a7ba6752107e
1,060
ex
Elixir
apps/blockchain/lib/blockchain/application.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
apps/blockchain/lib/blockchain/application.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
apps/blockchain/lib/blockchain/application.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
defmodule Blockchain.Application do @moduledoc false use Application require Logger def start(_type, _args) do import Supervisor.Spec, warn: false if breakpoint_address_hex = System.get_env("BREAKPOINT") do case Base.decode16(breakpoint_address_hex, case: :mixed) do {:ok, breakpoint_address} -> EVM.Debugger.enable() id = EVM.Debugger.break_on(address: breakpoint_address) Logger.warn( "Debugger has been enabled. Set breakpoint ##{id} on contract address 0x#{ breakpoint_address_hex }." ) :error -> Logger.error("Invalid breakpoint address: #{breakpoint_address_hex}") end end # Define workers and child supervisors to be supervised children = [ # Starts a worker by calling: Blockchain.Worker.start_link(arg1, arg2, arg3) # worker(Blockchain.Worker, [arg1, arg2, arg3]), ] opts = [strategy: :one_for_one, name: Blockchain.Supervisor] Supervisor.start_link(children, opts) end end
28.648649
86
0.65283
08e80136d73432f27dc84e894c2d19b1b5ef6f02
539
exs
Elixir
test/cache_test.exs
erikvullings/json-service
c920346e503e05d98e20b17283d43037c6202d7f
[ "MIT" ]
null
null
null
test/cache_test.exs
erikvullings/json-service
c920346e503e05d98e20b17283d43037c6202d7f
[ "MIT" ]
null
null
null
test/cache_test.exs
erikvullings/json-service
c920346e503e05d98e20b17283d43037c6202d7f
[ "MIT" ]
null
null
null
defmodule JsonService.CacheTest do use ExUnit.Case alias JsonService.Cache setup do list = %{name: "Home", items: []} Cache.save(list) {:ok, list: list} end test ".save adds a list to the ETS table" do info = :ets.info(Cache) assert info[:size] == 1 end test ".find gets a list out of the ETS table", %{list: list} do assert Cache.find(list.name) == list end test ".clear eliminates all objects from the ETS table", %{list: list} do Cache.clear refute Cache.find(list.name) end end
20.730769
75
0.643785
08e80c5392b8a6d38fa72c51c1ca62d7bc9ee02f
1,082
exs
Elixir
apps/andi/runtime.exs
AWHServiceAccount/smartcitiesdata
6957afac12809288640b6ba6b576c3016e6033d7
[ "Apache-2.0" ]
1
2020-03-18T21:14:39.000Z
2020-03-18T21:14:39.000Z
apps/andi/runtime.exs
AWHServiceAccount/smartcitiesdata
6957afac12809288640b6ba6b576c3016e6033d7
[ "Apache-2.0" ]
null
null
null
apps/andi/runtime.exs
AWHServiceAccount/smartcitiesdata
6957afac12809288640b6ba6b576c3016e6033d7
[ "Apache-2.0" ]
null
null
null
use Mix.Config kafka_brokers = System.get_env("KAFKA_BROKERS") live_view_salt = System.get_env("LIVEVIEW_SALT") get_redix_args = fn host, password -> [host: host, password: password] |> Enum.filter(fn {_, nil} -> false {_, ""} -> false _ -> true end) end redix_args = get_redix_args.(System.get_env("REDIS_HOST"), System.get_env("REDIS_PASSWORD")) endpoint = kafka_brokers |> String.split(",") |> Enum.map(&String.trim/1) |> Enum.map(fn entry -> String.split(entry, ":") end) |> Enum.map(fn [host, port] -> {String.to_atom(host), String.to_integer(port)} end) config :andi, :brook, instance: :andi, driver: [ module: Brook.Driver.Kafka, init_arg: [ endpoints: endpoint, topic: "event-stream", group: "andi-event-stream", config: [ begin_offset: :earliest ] ] ], handlers: [Andi.EventHandler], storage: [ module: Brook.Storage.Redis, init_arg: [redix_args: redix_args, namespace: "andi:view"] ] config :andi, AndiWeb.Endpoint, live_view: [ signing_salt: live_view_salt ]
23.021277
92
0.643253
08e81a231eb73313f496957d0b7d5d4d96461b72
2,124
ex
Elixir
clients/compute/lib/google_api/compute/v1/model/subnetwork_list_warning.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/compute/lib/google_api/compute/v1/model/subnetwork_list_warning.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/compute/lib/google_api/compute/v1/model/subnetwork_list_warning.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Compute.V1.Model.SubnetworkListWarning do @moduledoc """ [Output Only] Informational warning message. ## Attributes * `code` (*type:* `String.t`, *default:* `nil`) - [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. * `data` (*type:* `list(GoogleApi.Compute.V1.Model.SubnetworkListWarningData.t)`, *default:* `nil`) - [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } * `message` (*type:* `String.t`, *default:* `nil`) - [Output Only] A human-readable description of the warning code. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :code => String.t() | nil, :data => list(GoogleApi.Compute.V1.Model.SubnetworkListWarningData.t()) | nil, :message => String.t() | nil } field(:code) field(:data, as: GoogleApi.Compute.V1.Model.SubnetworkListWarningData, type: :list) field(:message) end defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.SubnetworkListWarning do def decode(value, options) do GoogleApi.Compute.V1.Model.SubnetworkListWarning.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.SubnetworkListWarning do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
40.075472
241
0.719868
08e8291277298bc3c7a936b05a8c2e5af45a086b
4,336
ex
Elixir
lib/uploadcare_ex.ex
EevanW/uploadcare_ex
a9ad604285a9abb517420a1fec7b5c589ab9417a
[ "MIT" ]
1
2021-08-08T23:32:18.000Z
2021-08-08T23:32:18.000Z
lib/uploadcare_ex.ex
EevanW/uploadcare_ex
a9ad604285a9abb517420a1fec7b5c589ab9417a
[ "MIT" ]
null
null
null
lib/uploadcare_ex.ex
EevanW/uploadcare_ex
a9ad604285a9abb517420a1fec7b5c589ab9417a
[ "MIT" ]
null
null
null
defmodule UploadcareEx do alias UploadcareEx.Request alias UploadcareEx.API.Behaviour, as: ApiBehaviour alias UploadcareEx.API.Upload, as: UploadApi alias UploadcareEx.API.Files, as: FilesApi @behaviour ApiBehaviour @type response :: %{status_code: number(), body: map() | binary()} @moduledoc """ Elixir wrapper for Uploadcare API. """ @doc """ Basic request method with retries. Retries are configured with `retry_period` and `retry_expiry` configuration params in your config.exs. Their default values are 1_000 and 5_000 respectively. All requests that get responses with 5xx status codes are retried. Also all HTTPoison (which is used as a default http client) errors are retried. Examples: iex> UploadcareEx.request("https://api.uploadcare.com/files/2e6b7f23-9143-4b71-94e7-338bbf278c01/", :get) {:ok, %{ body: %{"detail" => "Authentication credentials were not provided."}, status_code: 401 }} iex> UploadcareEx.request("https://upload.uploadcare.com/from_url/status/?token=b8a3eb85-c01d-4809-9ba7-7590e4e7300f", :get) {:ok, %{...} } """ @spec request(binary(), atom(), any(), map()) :: {:ok, response()} | {:error, any()} defdelegate request(url, http_method, data \\ "", headers \\ %{}), to: Request @doc """ Uploads files from URLs. Returns created file status. Examples: iex> UploadcareEx.upload_url("https://avatars0.githubusercontent.com/u/6567687?s=460&v=4") {:ok, "a295f184-0328-4b30-be4d-f215d9cdbed7"} iex> UploadcareEx.upload_url("https://google.com") {:error, %{ body: %{ "error" => "Uploading of these files types is not allowed on your current plan.", "status" => "error" }, status_code: 200 } } """ @spec upload_url(binary()) :: {:ok, binary()} | {:error, any()} defdelegate upload_url(url), to: UploadApi @doc """ Uploads a file from provided filesystem path. Returns created file uuid. Examples: iex> UploadcareEx.upload_file("/my/path/image.png") {:ok, "a295f184-0328-4b30-be4d-f215d9cdbed7"} iex> UploadcareEx.upload_file("/invalid") {:error, %HTTPoison.Error{id: nil, reason: :enoent}} """ @spec upload_file(binary()) :: {:ok, binary()} | {:error, any()} defdelegate upload_file(file_path), to: UploadApi @doc """ Uploads a file from provided binary data. Returns created file uuid. Examples: iex> UploadcareEx.upload_file(<<137, 80, 78>>, "file_name", "image/png") {:ok, "a295f184-0328-4b30-be4d-f215d9cdbed7"} iex> UploadcareEx.upload_file(nil, "file_name", "image/png") {:error, %HTTPoison.Error{id: nil, reason: :enoent}} """ @spec upload_file(binary(),binary() ,binary()) :: {:ok, binary()} | {:error, any()} defdelegate upload_file(data, filename, content_type), to: UploadApi @doc """ Acquires file-specific info by its uuid. Examples: iex> UploadcareEx.file_info("a295f184-0328-4b30-be4d-f215d9cdbed7") {:ok, %{ "datetime_removed" => nil, "datetime_stored" => nil, ... } } iex> UploadcareEx.file_info("wrong") {:error, %{body: %{"detail" => "Not found."}, status_code: 404}} """ @spec file_info(binary()) :: {:ok, map()} | {:error, any()} def file_info(uuid) do uuid |> FilesApi.info() end @doc """ Stores a file by its uuid. Examples: iex> UploadcareEx.file_store("a295f184-0328-4b30-be4d-f215d9cdbed7") {:ok, %{ "datetime_removed" => nil, "datetime_stored" => "2018-04-01T16:17:26.699680Z", ... } } iex> UploadcareEx.file_store("wrong") {:error, %{body: %{"detail" => "Not found."}, status_code: 404}} """ @spec file_store(binary()) :: {:ok, map()} | {:error, any()} def file_store(uuid) do uuid |> FilesApi.store() end @doc """ Deletes a file by its uuid. Examples: iex> UploadcareEx.file_delete("a295f184-0328-4b30-be4d-f215d9cdbed7") :ok iex> UploadcareEx.file_delete("wrong") {:error, %{body: %{"detail" => "Not found."}, status_code: 404}} """ @spec file_delete(binary()) :: :ok | {:error, any()} def file_delete(uuid) do uuid |> FilesApi.delete() end end
29.100671
130
0.620618
08e82930e9b9b5190fbc58fb742c62c4ff439ef6
2,676
ex
Elixir
clients/data_labeling/lib/google_api/data_labeling/v1beta1/model/google_cloud_datalabeling_v1beta1_export_data_request.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/data_labeling/lib/google_api/data_labeling/v1beta1/model/google_cloud_datalabeling_v1beta1_export_data_request.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/data_labeling/lib/google_api/data_labeling/v1beta1/model/google_cloud_datalabeling_v1beta1_export_data_request.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1ExportDataRequest do @moduledoc """ Request message for ExportData API. ## Attributes * `annotatedDataset` (*type:* `String.t`, *default:* `nil`) - Required. Annotated dataset resource name. DataItem in Dataset and their annotations in specified annotated dataset will be exported. It's in format of projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id} * `filter` (*type:* `String.t`, *default:* `nil`) - Optional. Filter is not supported at this moment. * `outputConfig` (*type:* `GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1OutputConfig.t`, *default:* `nil`) - Required. Specify the output destination. * `userEmailAddress` (*type:* `String.t`, *default:* `nil`) - Email of the user who started the export task and should be notified by email. If empty no notification will be sent. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :annotatedDataset => String.t() | nil, :filter => String.t() | nil, :outputConfig => GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1OutputConfig.t() | nil, :userEmailAddress => String.t() | nil } field(:annotatedDataset) field(:filter) field(:outputConfig, as: GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1OutputConfig ) field(:userEmailAddress) end defimpl Poison.Decoder, for: GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1ExportDataRequest do def decode(value, options) do GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1ExportDataRequest.decode( value, options ) end end defimpl Poison.Encoder, for: GoogleApi.DataLabeling.V1beta1.Model.GoogleCloudDatalabelingV1beta1ExportDataRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
39.940299
303
0.741779
08e83d949a017403a4164c157c77328f750b9727
516
exs
Elixir
test/ecto/integration/uuid_test.exs
fasib/ecto_sqlite3
3ef1bf4d2a93fe07ea2571fb24dc7b6e320cf4cf
[ "MIT" ]
null
null
null
test/ecto/integration/uuid_test.exs
fasib/ecto_sqlite3
3ef1bf4d2a93fe07ea2571fb24dc7b6e320cf4cf
[ "MIT" ]
null
null
null
test/ecto/integration/uuid_test.exs
fasib/ecto_sqlite3
3ef1bf4d2a93fe07ea2571fb24dc7b6e320cf4cf
[ "MIT" ]
null
null
null
defmodule Ecto.Integration.UUIDTest do use Ecto.Integration.Case alias Ecto.Integration.TestRepo alias EctoSQLite3.Integration.Product test "handles uuid serialization and deserialization" do external_id = Ecto.UUID.generate() product = TestRepo.insert!(%Product{name: "Pupper Beer", external_id: external_id}) assert product.id assert product.external_id == external_id found = TestRepo.get(Product, product.id) assert found assert found.external_id == external_id end end
27.157895
87
0.753876
08e860c7230e2d28232771edec1402e784952510
874
ex
Elixir
clients/chat/lib/google_api/chat/v1/metadata.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
null
null
null
clients/chat/lib/google_api/chat/v1/metadata.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
null
null
null
clients/chat/lib/google_api/chat/v1/metadata.ex
MasashiYokota/elixir-google-api
975dccbff395c16afcb62e7a8e411fbb58e9ab01
[ "Apache-2.0" ]
1
2020-10-04T10:12:44.000Z
2020-10-04T10:12:44.000Z
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Chat.V1 do @moduledoc """ API client metadata for GoogleApi.Chat.V1. """ @discovery_revision "20200919" def discovery_revision(), do: @discovery_revision end
32.37037
74
0.756293
08e863e2867620b9f365f0569b0570c04b9cea79
19,726
ex
Elixir
clients/content/lib/google_api/content/v2/api/datafeeds.ex
linjunpop/elixir-google-api
444cb2b2fb02726894535461a474beddd8b86db4
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/api/datafeeds.ex
linjunpop/elixir-google-api
444cb2b2fb02726894535461a474beddd8b86db4
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v2/api/datafeeds.ex
linjunpop/elixir-google-api
444cb2b2fb02726894535461a474beddd8b86db4
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Content.V2.Api.Datafeeds do @moduledoc """ API calls for all endpoints tagged `Datafeeds`. """ alias GoogleApi.Content.V2.Connection alias GoogleApi.Gax.{Request, Response} @doc """ Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). - :body (DatafeedsCustomBatchRequest): ## Returns {:ok, %GoogleApi.Content.V2.Model.DatafeedsCustomBatchResponse{}} on success {:error, info} on failure """ @spec content_datafeeds_custombatch(Tesla.Env.client(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.DatafeedsCustomBatchResponse.t()} | {:error, Tesla.Env.t()} def content_datafeeds_custombatch(connection, optional_params \\ [], opts \\ []) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/datafeeds/batch") |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode( opts ++ [struct: %GoogleApi.Content.V2.Model.DatafeedsCustomBatchResponse{}] ) end @doc """ Deletes a datafeed configuration from your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - datafeed_id (String.t): The ID of the datafeed. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec content_datafeeds_delete(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t()} def content_datafeeds_delete( connection, merchant_id, datafeed_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query } request = Request.new() |> Request.method(:delete) |> Request.url("/{merchantId}/datafeeds/{datafeedId}", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1), "datafeedId" => URI.encode(datafeed_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [decode: false]) end @doc """ Invokes a fetch for the datafeed in your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - datafeed_id (String.t): The ID of the datafeed to be fetched. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). ## Returns {:ok, %GoogleApi.Content.V2.Model.DatafeedsFetchNowResponse{}} on success {:error, info} on failure """ @spec content_datafeeds_fetchnow(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.DatafeedsFetchNowResponse.t()} | {:error, Tesla.Env.t()} def content_datafeeds_fetchnow( connection, merchant_id, datafeed_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query } request = Request.new() |> Request.method(:post) |> Request.url("/{merchantId}/datafeeds/{datafeedId}/fetchNow", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1), "datafeedId" => URI.encode(datafeed_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.DatafeedsFetchNowResponse{}]) end @doc """ Retrieves a datafeed configuration from your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - datafeed_id (String.t): The ID of the datafeed. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. ## Returns {:ok, %GoogleApi.Content.V2.Model.Datafeed{}} on success {:error, info} on failure """ @spec content_datafeeds_get(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.Datafeed.t()} | {:error, Tesla.Env.t()} def content_datafeeds_get( connection, merchant_id, datafeed_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query } request = Request.new() |> Request.method(:get) |> Request.url("/{merchantId}/datafeeds/{datafeedId}", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1), "datafeedId" => URI.encode(datafeed_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.Datafeed{}]) end @doc """ Registers a datafeed configuration with your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). - :body (Datafeed): ## Returns {:ok, %GoogleApi.Content.V2.Model.Datafeed{}} on success {:error, info} on failure """ @spec content_datafeeds_insert(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.Datafeed.t()} | {:error, Tesla.Env.t()} def content_datafeeds_insert(connection, merchant_id, optional_params \\ [], opts \\ []) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{merchantId}/datafeeds", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.Datafeed{}]) end @doc """ Lists the configurations for datafeeds in your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeeds. This account cannot be a multi-client account. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :maxResults (integer()): The maximum number of products to return in the response, used for paging. - :pageToken (String.t): The token returned by the previous request. ## Returns {:ok, %GoogleApi.Content.V2.Model.DatafeedsListResponse{}} on success {:error, info} on failure """ @spec content_datafeeds_list(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.DatafeedsListResponse.t()} | {:error, Tesla.Env.t()} def content_datafeeds_list(connection, merchant_id, optional_params \\ [], opts \\ []) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :maxResults => :query, :pageToken => :query } request = Request.new() |> Request.method(:get) |> Request.url("/{merchantId}/datafeeds", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.DatafeedsListResponse{}]) end @doc """ Updates a datafeed configuration of your Merchant Center account. This method supports patch semantics. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - datafeed_id (String.t): The ID of the datafeed. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). - :body (Datafeed): ## Returns {:ok, %GoogleApi.Content.V2.Model.Datafeed{}} on success {:error, info} on failure """ @spec content_datafeeds_patch(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.Datafeed.t()} | {:error, Tesla.Env.t()} def content_datafeeds_patch( connection, merchant_id, datafeed_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query, :body => :body } request = Request.new() |> Request.method(:patch) |> Request.url("/{merchantId}/datafeeds/{datafeedId}", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1), "datafeedId" => URI.encode(datafeed_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.Datafeed{}]) end @doc """ Updates a datafeed configuration of your Merchant Center account. ## Parameters - connection (GoogleApi.Content.V2.Connection): Connection to server - merchant_id (String.t): The ID of the account that manages the datafeed. This account cannot be a multi-client account. - datafeed_id (String.t): The ID of the datafeed. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :dryRun (boolean()): Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any). - :body (Datafeed): ## Returns {:ok, %GoogleApi.Content.V2.Model.Datafeed{}} on success {:error, info} on failure """ @spec content_datafeeds_update(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Content.V2.Model.Datafeed.t()} | {:error, Tesla.Env.t()} def content_datafeeds_update( connection, merchant_id, datafeed_id, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :dryRun => :query, :body => :body } request = Request.new() |> Request.method(:put) |> Request.url("/{merchantId}/datafeeds/{datafeedId}", %{ "merchantId" => URI.encode(merchant_id, &URI.char_unreserved?/1), "datafeedId" => URI.encode(datafeed_id, &URI.char_unreserved?/1) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Content.V2.Model.Datafeed{}]) end end
42.149573
174
0.672412
08e8680d08da3895b24c7ab822c701207bbd9b33
312
exs
Elixir
test/mipha_web/controllers/page_controller_test.exs
ZPVIP/mipha
a7df054f72eec7de88b60d94c501488375bdff6a
[ "MIT" ]
156
2018-06-01T19:52:32.000Z
2022-02-03T10:58:10.000Z
test/mipha_web/controllers/page_controller_test.exs
ZPVIP/mipha
a7df054f72eec7de88b60d94c501488375bdff6a
[ "MIT" ]
139
2018-07-10T01:57:23.000Z
2021-08-02T21:29:24.000Z
test/mipha_web/controllers/page_controller_test.exs
ZPVIP/mipha
a7df054f72eec7de88b60d94c501488375bdff6a
[ "MIT" ]
29
2018-07-17T08:43:45.000Z
2021-12-14T13:45:30.000Z
defmodule MiphaWeb.PageControllerTest do use MiphaWeb.ConnCase test "GET /", %{conn: conn} do t1 = insert(:topic) t2 = insert(:topic) conn = get(conn, topic_path(conn, :index)) assert conn.status == 200 assert conn.resp_body =~ t1.title assert conn.resp_body =~ t2.title end end
20.8
46
0.660256
08e86ea47002c5eba3bed0b1ebb2975dbcac6a46
92
ex
Elixir
lib/changelog/slack/response.ex
soleo/changelog.com
621c7471b23379e1cdd4a0c960b66ed98d8d1a53
[ "MIT" ]
1
2021-03-14T21:12:49.000Z
2021-03-14T21:12:49.000Z
lib/changelog/slack/response.ex
soleo/changelog.com
621c7471b23379e1cdd4a0c960b66ed98d8d1a53
[ "MIT" ]
null
null
null
lib/changelog/slack/response.ex
soleo/changelog.com
621c7471b23379e1cdd4a0c960b66ed98d8d1a53
[ "MIT" ]
1
2018-10-03T20:55:52.000Z
2018-10-03T20:55:52.000Z
defmodule Changelog.Slack.Response do defstruct response_type: "in_channel", text: "" end
23
49
0.782609
08e86ec022f42848df83a3d6f5b40f83034d8348
1,212
ex
Elixir
web/router.ex
colbydehart/MartaWhistle
852d1aaecb1fe5705fdcaab30283870613f6a66f
[ "MIT" ]
null
null
null
web/router.ex
colbydehart/MartaWhistle
852d1aaecb1fe5705fdcaab30283870613f6a66f
[ "MIT" ]
null
null
null
web/router.ex
colbydehart/MartaWhistle
852d1aaecb1fe5705fdcaab30283870613f6a66f
[ "MIT" ]
null
null
null
defmodule TrainWhistle.Router do use TrainWhistle.Web, :router pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_flash plug :protect_from_forgery plug :put_secure_browser_headers end pipeline :api do plug :accepts, ["json", "json-api"] plug Guardian.Plug.VerifyHeader, realm: "Bearer" plug Guardian.Plug.LoadResource end pipeline :authenticated do plug Guardian.Plug.EnsureAuthenticated, handler: TrainWhistle.UserController end scope "/", TrainWhistle do pipe_through :browser # Use the default browser stack get "/", PageController, :index end # Other scopes may use custom stacks. scope "/api", TrainWhistle do pipe_through :api scope as: :public do post "/users", UserController, :create post "/login", UserController, :login end scope as: :private do pipe_through :authenticated get "/users", UserController, :index resources "/alarms", AlarmController, except: [:new, :edit] resources "/locations", LocationController, only: [:index, :show] get "/users", UserController, :index patch "/users/:id", UserController, :update end end end
25.25
80
0.684818
08e887a1071edf0e75ca72f8da868faa362e0f7a
242
exs
Elixir
misc-stuff/with.exs
jordanhubbard/elixir-projects
dee341d672e83a45a17a4a85abd54a480f95c506
[ "BSD-2-Clause" ]
null
null
null
misc-stuff/with.exs
jordanhubbard/elixir-projects
dee341d672e83a45a17a4a85abd54a480f95c506
[ "BSD-2-Clause" ]
1
2021-03-09T16:27:25.000Z
2021-03-09T16:27:25.000Z
misc-stuff/with.exs
jordanhubbard/elixir-projects
dee341d672e83a45a17a4a85abd54a480f95c506
[ "BSD-2-Clause" ]
null
null
null
result = with {:ok, file} = File.open("/etc/passwd"), content = IO.read(file, :all), :ok = File.close(file), [_, uid, gid] = Regex.run(~r/^_app.*?:(\d+):(\d+)/m, content) do "#{uid} : #{gid}" end IO.puts(result)
24.2
71
0.5
08e88c6f69ceb0e392919b0ac61f2c2c5c573753
3,129
ex
Elixir
lib/procore/resources/vendors.ex
procore/elixir-sdk
abff2935702a5e9f0290a072e90c2f219bca3cb8
[ "MIT" ]
6
2018-02-01T01:34:16.000Z
2020-08-31T15:15:08.000Z
lib/procore/resources/vendors.ex
procore/elixir-sdk
abff2935702a5e9f0290a072e90c2f219bca3cb8
[ "MIT" ]
6
2018-02-03T03:01:48.000Z
2021-06-08T18:39:40.000Z
lib/procore/resources/vendors.ex
procore/elixir-sdk
abff2935702a5e9f0290a072e90c2f219bca3cb8
[ "MIT" ]
3
2018-08-12T03:51:52.000Z
2020-02-27T14:29:14.000Z
defmodule Procore.Resources.Vendors do @moduledoc """ Available actions for the vendor resource. """ alias Procore.ErrorResult alias Procore.Request alias Procore.Resources.Vendors.ResponseBodyTypes alias Procore.ResponseResult @doc """ Lists all vendors in a company directory. """ @spec list(Tesla.Client.t(), %{ required(company_id :: String.t()) => pos_integer, optional(api_version :: String.t()) => String.t() }) :: %ResponseResult{ status_code: DefinedTypes.non_error_status_code(), parsed_body: ResponseBodyTypes.ListCompanyVendors.t(), reply: atom } | %ErrorResult{} def list(client, %{"company_id" => company_id} = options) do %Request{} |> Request.insert_request_type(:get) |> Request.insert_api_version(options["api_version"]) |> Request.insert_endpoint("/vendors") |> Request.insert_query_params(%{"company_id" => company_id}) |> Procore.send_request(client) end @doc """ Lists all vendors in a project directory. """ @spec list(Tesla.Client.t(), %{ required(project_id :: String.t()) => pos_integer, optional(api_version :: String.t()) => String.t() }) :: %ResponseResult{} | %ErrorResult{} def list(client, %{"project_id" => project_id} = options) do %Request{} |> Request.insert_request_type(:get) |> Request.insert_api_version(options["api_version"]) |> Request.insert_endpoint("/projects/#{project_id}/vendors") |> Procore.send_request(client) end @doc """ Adds an existing vendor from a company to a project's directory in that company. """ @spec add_vendor_to_project(Tesla.Client.t(), %{ required(project_id :: String.t()) => pos_integer, required(vendor_id :: String.t()) => pos_integer, optional(api_version :: String.t()) => String.t() }) :: %ResponseResult{} | %ErrorResult{} def add_vendor_to_project( client, %{ "project_id" => project_id, "vendor_id" => vendor_id } = options ) do %Request{} |> Request.insert_request_type(:post) |> Request.insert_api_version(options["api_version"]) |> Request.insert_endpoint("/projects/#{project_id}/vendors/#{vendor_id}/actions/add") |> Procore.send_request(client) end @doc """ Creates or updates a batch of vendors in a company directory. """ @spec sync(Tesla.Client.t(), %{ required(company_id :: String.t()) => pos_integer, required(vendors :: String.t()) => list, optional(api_version :: String.t()) => String.t() }) :: %ResponseResult{} | %ErrorResult{} def sync( client, %{ "company_id" => company_id, "vendors" => vendors } = options ) do %Request{} |> Request.insert_request_type(:patch) |> Request.insert_endpoint("/vendors/sync") |> Request.insert_api_version(options["api_version"]) |> Request.insert_body(%{"company_id" => company_id, "updates" => vendors}) |> Procore.send_request(client) end end
33.645161
90
0.621604
08e8c4cf24d2f838fdb9977e52875d85d3a0b3b4
2,187
exs
Elixir
test/mongoose_push_application_test.exs
rslota/MongoosePush
ae7ca89f0f53d7564a2d69c75bd97f0f68d1e2e5
[ "Apache-2.0" ]
null
null
null
test/mongoose_push_application_test.exs
rslota/MongoosePush
ae7ca89f0f53d7564a2d69c75bd97f0f68d1e2e5
[ "Apache-2.0" ]
null
null
null
test/mongoose_push_application_test.exs
rslota/MongoosePush
ae7ca89f0f53d7564a2d69c75bd97f0f68d1e2e5
[ "Apache-2.0" ]
null
null
null
defmodule MongoosePushApplicationTest do use ExUnit.Case import MongoosePush.Application import MongoosePush.Pools doctest MongoosePush.Application setup do # Validate config/text.exs that is need for this test suite apns_pools = Keyword.keys(Application.get_env(:mongoose_push, :apns)) [:dev1, :dev2, :prod1, :prod2] = Enum.sort(apns_pools) fcm_pools = Keyword.keys(Application.get_env(:mongoose_push, :fcm)) [:default] = fcm_pools :ok end test "pools online" do assert Process.alive?(Process.whereis(worker_name(:apns, :prod1, 1))) assert Process.alive?(Process.whereis(worker_name(:apns, :prod1, 2))) assert Process.alive?(Process.whereis(worker_name(:apns, :prod2, 1))) assert Process.alive?(Process.whereis(worker_name(:apns, :prod2, 4))) assert Process.alive?(Process.whereis(worker_name(:apns, :dev1, 1))) assert Process.alive?(Process.whereis(worker_name(:apns, :dev2, 1))) assert Process.alive?(Process.whereis(worker_name(:apns, :dev2, 3))) assert Process.alive?(Process.whereis(worker_name(:fcm, :default, 1))) assert Process.alive?(Process.whereis(worker_name(:fcm, :default, 5))) end test "pools have corrent size" do assert nil == Process.whereis(worker_name(:apns, :dev1, 2)) assert nil == Process.whereis(worker_name(:apns, :prod1, 3)) assert nil == Process.whereis(worker_name(:apns, :dev2, 4)) assert nil == Process.whereis(worker_name(:apns, :prod2, 5)) assert nil == Process.whereis(worker_name(:fcm, :default, 6)) end test "application starts and stops" do :ok = Application.stop(:mongoose_push) :ok = Application.start(:mongoose_push, :temporary) end test "workers are stoped along with the application" do :ok = Application.stop(:mongoose_push) assert nil == Process.whereis(worker_name(:apns, :dev1, 1)) assert nil == Process.whereis(worker_name(:apns, :prod1, 1)) assert nil == Process.whereis(worker_name(:apns, :dev2, 1)) assert nil == Process.whereis(worker_name(:apns, :prod2, 1)) assert nil == Process.whereis(worker_name(:fcm, :default, 1)) :ok = Application.start(:mongoose_push, :temporary) end end
38.368421
74
0.705075
08e9042e1653b059c628c7c82d89632c6abe9069
5,333
ex
Elixir
lib/eview/helpers/changeset_validations_parser.ex
imax-iva/eview
c9cc7eda9a55101a996113fa31adbf809f801648
[ "MIT" ]
null
null
null
lib/eview/helpers/changeset_validations_parser.ex
imax-iva/eview
c9cc7eda9a55101a996113fa31adbf809f801648
[ "MIT" ]
null
null
null
lib/eview/helpers/changeset_validations_parser.ex
imax-iva/eview
c9cc7eda9a55101a996113fa31adbf809f801648
[ "MIT" ]
null
null
null
if Code.ensure_loaded?(Ecto) do defmodule EView.Helpers.ChangesetValidationsParser do @moduledoc false # This module converts changeset to a error structure described in API Manifest. @entry_type "json_data_property" @jsonpath_root "$" @jsonpath_joiner "." def changeset_to_rules(%Ecto.Changeset{} = changeset, entry_type \\ @entry_type) do changeset |> Ecto.Changeset.traverse_errors(&construct_rule/3) |> Enum.flat_map(&errors_flatener(&1, @jsonpath_root, entry_type)) end defp construct_rule(%Ecto.Changeset{validations: validations}, field, {message, opts}) do validation_name = opts[:validation] get_rule(field, validation_name, put_validation(validations, validation_name, field, opts), message, opts) end # Special case for cast validation that stores type in field that dont match validation name defp put_validation(validations, :cast, field, opts) do [{field, {:cast, opts[:type]}} | validations] end # Special case for metadata validator that can't modify to changeset validations defp put_validation(validations, :length, field, opts) do validation = Keyword.take(opts, [:min, :max, :is]) [{field, {:length, validation}} | validations] end # Embeds defp put_validation(validations, nil, field, type: :map) do [{field, {:cast, :map}} | validations] end # Embeds Many defp put_validation(validations, nil, field, type: {_, _} = type) do [{field, {:cast, type}} | validations] end defp put_validation(validations, _, _field, _opts), do: validations # Embeds defp get_rule(field, nil, validations, message, [type: {_, _}] = opts) do opts = Keyword.put(opts, :validation, :cast) validation_name = :cast get_rule(field, validation_name, validations, message, opts) end defp get_rule(field, nil, validations, message, [type: :map] = opts) do opts = Keyword.put(opts, :validation, :cast) validation_name = :cast get_rule(field, validation_name, validations, message, opts) end defp get_rule(field, validation_name, validations, message, opts) do %{ description: message |> get_rule_description(opts), rule: opts[:validation], params: field |> reduce_rule_params(validation_name, validations) |> cast_rules_type() } end defp get_rule_description(message, opts) do Enum.reduce(opts, message, fn # Lists {key, value}, acc when is_list(value) -> String.replace(acc, "%{#{key}}", Enum.join(value, ", ")) {key, {:array, :string}}, acc -> String.replace(acc, "%{#{key}}", "string") {key, {:array, :map}}, acc -> String.replace(acc, "%{#{key}}", "map") {key, {:array, Ecto.UUID}}, acc -> String.replace(acc, "%{#{key}}", "uuid") # Everything else is a string {key, value}, acc -> String.replace(acc, "%{#{key}}", to_string(value)) end) end defp reduce_rule_params(field, validation_name, validations) do validations |> Keyword.get_values(field) |> Enum.reduce([], fn # Validation with keywords {^validation_name, [h | _] = keyword}, acc when is_tuple(h) -> keyword ++ acc # With list {^validation_name, list}, acc when is_list(list) -> list ++ acc # With regex pattern {^validation_name, %Regex{} = regex}, acc -> [inspect(regex) | acc] # Ecto.UUID rule {^validation_name, {:array, Ecto.UUID}}, acc -> [:uuid | acc] # Array of anything # TODO: Return ID of element from Ecto {^validation_name, {:array, type}}, acc when is_atom(type) -> type = type |> Atom.to_string() |> Kernel.<>("s_array") |> String.to_atom() [type | acc] # Or at least parseable {^validation_name, rule_description}, acc -> [rule_description | acc] # Skip rest _, acc -> acc end) |> Enum.uniq() end defp cast_rules_type([h | _] = rules) when is_tuple(h), do: rules |> Enum.into(%{}) defp cast_rules_type(rules), do: rules # Recursively flatten errors map defp errors_flatener({field, [%{rule: _} | _] = rules}, prefix, entry_type) when is_list(rules) do [ %{ entry_type: entry_type, entry: prefix <> @jsonpath_joiner <> to_string(field), rules: rules } ] end defp errors_flatener({field, errors}, prefix, entry_type) when is_map(errors) do errors |> Enum.flat_map(&errors_flatener(&1, prefix <> @jsonpath_joiner <> to_string(field), entry_type)) end defp errors_flatener({field, errors}, prefix, entry_type) when is_list(errors) do {acc, _} = errors |> Enum.reduce({[], 0}, fn inner_errors, {acc, i} -> inner_rules = inner_errors |> Enum.flat_map( &errors_flatener( &1, "#{prefix}#{@jsonpath_joiner}" <> to_string(field) <> "[#{i}]", entry_type ) ) {acc ++ inner_rules, i + 1} end) acc end end end
31.744048
112
0.590287
08e97035a0806230b31fe36d846148fff8d46311
3,455
ex
Elixir
lib/lob/client.ex
pdgonzalez872/lob-elixir
4b4b24f267144b15ab1cb19e37eb861ff2a1acc0
[ "MIT" ]
11
2018-02-07T17:59:17.000Z
2021-11-21T14:11:15.000Z
lib/lob/client.ex
pdgonzalez872/lob-elixir
4b4b24f267144b15ab1cb19e37eb861ff2a1acc0
[ "MIT" ]
34
2018-02-13T19:59:27.000Z
2022-03-02T19:50:41.000Z
lib/lob/client.ex
pdgonzalez872/lob-elixir
4b4b24f267144b15ab1cb19e37eb861ff2a1acc0
[ "MIT" ]
8
2019-01-30T00:39:36.000Z
2022-03-01T15:32:17.000Z
defmodule Lob.Client do @moduledoc """ Client responsible for making requests to Lob and handling the responses. """ alias HTTPoison.Error alias Poison.Parser use HTTPoison.Base @client_version Mix.Project.config[:version] @type client_response :: {:ok, map, list} | {:error, any} defmodule MissingAPIKeyError do @moduledoc """ Exception for when a request is made without an API key. """ defexception message: """ The api_key setting is required to make requests to Lob. Please configure :api_key in config.exs or set the API_KEY environment variable. config :lob_elixir, api_key: API_KEY """ end @spec client_version :: String.t def client_version, do: @client_version @spec api_key(atom) :: String.t def api_key(env_key \\ :api_key) do case Confex.get_env(:lob_elixir, env_key, System.get_env("API_KEY")) || :not_found do :not_found -> raise MissingAPIKeyError value -> value end end @spec api_version :: String.t | nil def api_version, do: Application.get_env(:lob_elixir, :api_version, System.get_env("LOB_API_VERSION")) # ######################### # HTTPoison.Base callbacks # ######################### def process_request_headers(headers) do api_version() |> default_headers() |> Map.merge(Map.new(headers)) |> Enum.into([]) end def process_response_body(body) do Parser.parse!(body, %{keys: :atoms}) end # ######################### # Client API # ######################### @spec get_request(String.t, HTTPoison.Base.headers) :: client_response def get_request(url, headers \\ []) do url |> get(headers, build_options()) |> handle_response end @spec post_request(<<_::64, _::_*8>>, {:multipart, [any()]}, [{binary(), binary()}]) :: client_response def post_request(url, body, headers \\ []) do url |> post(body, headers, build_options()) |> handle_response end @spec post_request_binary(<<_::64, _::_*8>>, binary(), [{binary(), binary()}]) :: client_response def post_request_binary(url, body, headers \\ []) do url |> post(body, headers, build_options()) |> handle_response end @spec delete_request(String.t, HTTPoison.Base.headers) :: client_response def delete_request(url, headers \\ []) do url |> delete(headers, build_options()) |> handle_response end # ######################### # Response handlers # ######################### @spec handle_response({:ok, map} | {:error, Error.t}) :: client_response defp handle_response({:ok, %{body: body, headers: headers, status_code: code}}) when code >= 200 and code < 300 do {:ok, body, headers} end defp handle_response({:ok, %{body: body}}) do {:error, body.error} end defp handle_response({:error, error = %Error{}}) do {:error, %{message: Error.message(error)}} end @spec build_options(String.t) :: Keyword.t defp build_options(api_key \\ api_key()) do [hackney: [basic_auth: {api_key, ""}], recv_timeout: :infinity] end @spec default_headers(String.t | nil) :: %{String.t => String.t} defp default_headers(nil), do: %{"User-Agent" => "Lob/v1 ElixirBindings/#{client_version()}"} defp default_headers(api_version), do: %{ "User-Agent" => "Lob/v1 ElixirBindings/#{client_version()}", "Lob-Version" => api_version } end
28.089431
105
0.614472
08e98394e05cbc74a429226744a4f529d196bb5d
1,437
ex
Elixir
lib/club/application.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
null
null
null
lib/club/application.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
34
2019-11-10T11:31:37.000Z
2019-11-27T21:26:48.000Z
lib/club/application.ex
vheathen/club.wallprint.pro
d58d2409d8879d23ed4d60fe3b9c2e1bd82e924d
[ "MIT" ]
null
null
null
defmodule Club.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application def start(_type, _args) do # List all child processes to be supervised children = [ # Start the Ecto repository Club.ReadRepo, # Start the endpoint when the application starts ClubWeb.Endpoint, # Starts a worker by calling: Club.Worker.start_link(arg) # {Club.Worker, arg}, Pow.Store.Backend.MnesiaCache, # Events PubSub {Phoenix.PubSub.PG2, name: Club.EventBus, pool_size: 1}, # Support tools supervisor Club.Support.Supervisor, # Commanded application Club.Commanded, # Accounts domain Club.Accounts.Supervisor, # Brands domain Club.Brands.Supervisor, # Devices domain Club.Devices.Supervisor, # SurfaceTypes domain Club.SurfaceTypes.Supervisor, # Colors domain Club.Colors.Supervisor ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options opts = [strategy: :one_for_one, name: Club.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do ClubWeb.Endpoint.config_change(changed, removed) :ok end end
25.210526
63
0.682672
08e9a49c6ccafa3964b93d46c3f0b040c963f5fe
69
exs
Elixir
test/test_helper.exs
alejandronanez/phoenix-absinthe-auth-template
e4e72f52247cb4c880ddc058beaa7b5eecb68980
[ "MIT" ]
8
2020-06-25T03:15:06.000Z
2021-12-10T10:52:26.000Z
test/test_helper.exs
alejandronanez/phoenix-absinthe-auth-template
e4e72f52247cb4c880ddc058beaa7b5eecb68980
[ "MIT" ]
null
null
null
test/test_helper.exs
alejandronanez/phoenix-absinthe-auth-template
e4e72f52247cb4c880ddc058beaa7b5eecb68980
[ "MIT" ]
null
null
null
ExUnit.start() Ecto.Adapters.SQL.Sandbox.mode(Ticketo.Repo, :manual)
23
53
0.782609
08e9b581c9c4117c1f28506110d3a7f42fd9ec38
570
ex
Elixir
lib/stabby_flies/application.ex
hassanshaikley/ascii-quest
8b3b3af3b9c6c59b8155fe2e6cb2a794033c29f1
[ "MIT" ]
8
2019-01-15T09:31:05.000Z
2020-04-20T13:59:01.000Z
lib/stabby_flies/application.ex
hassanshaikley/ascii-quest
8b3b3af3b9c6c59b8155fe2e6cb2a794033c29f1
[ "MIT" ]
2
2019-01-06T02:53:44.000Z
2019-05-30T20:30:20.000Z
lib/stabby_flies/application.ex
hassanshaikley/ascii-quest
8b3b3af3b9c6c59b8155fe2e6cb2a794033c29f1
[ "MIT" ]
1
2019-01-04T04:37:21.000Z
2019-01-04T04:37:21.000Z
defmodule StabbyFlies.Application do @moduledoc false use Application def start(_type, _args) do children = [ StabbyFlies.Repo, StabbyFliesWeb.Endpoint, {Registry, [keys: :unique, name: Registry.PlayersServer]}, {StabbyFlies.PlayerSupervisor, []}, {StabbyFlies.GameSupervisor, []} ] opts = [strategy: :one_for_one, name: StabbyFlies.Supervisor] Supervisor.start_link(children, opts) end def config_change(changed, _new, removed) do StabbyFliesWeb.Endpoint.config_change(changed, removed) :ok end end
23.75
65
0.696491
08ea0c9c3c8d2e4691b1a3c2689c8080b0acd30c
2,571
exs
Elixir
mix.exs
Sgoettschkes/168-hours
fd9895b2b3b8fd1dcce0283f03fe46cd0a5c454b
[ "MIT" ]
null
null
null
mix.exs
Sgoettschkes/168-hours
fd9895b2b3b8fd1dcce0283f03fe46cd0a5c454b
[ "MIT" ]
null
null
null
mix.exs
Sgoettschkes/168-hours
fd9895b2b3b8fd1dcce0283f03fe46cd0a5c454b
[ "MIT" ]
null
null
null
defmodule OnehundredsixtyeightHours.MixProject do use Mix.Project def project do [ app: :onehundredsixtyeight_hours, version: "0.1.0", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), preferred_cli_env: [ci: :test, "test.once": :test], dialyzer: [ plt_add_apps: [:ex_unit], plt_file: {:no_warn, "priv/plts/dialyzer.plt"} ] ] end # Configuration for the OTP application. # # Type `mix help compile.app` for more information. def application do [ mod: {OnehundredsixtyeightHours.Application, []}, extra_applications: [:logger, :runtime_tools] ] end # Specifies which paths to compile per environment. defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] # Specifies your project dependencies. # # Type `mix help deps` for examples and options. defp deps do [ {:phoenix, "~> 1.6.0"}, {:phoenix_ecto, "~> 4.4"}, {:ecto_sql, "~> 3.6"}, {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 3.0"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_view, "~> 0.17.5"}, {:floki, ">= 0.30.0", only: :test}, {:phoenix_live_dashboard, "~> 0.6"}, {:esbuild, "~> 0.2", runtime: Mix.env() == :dev}, {:swoosh, "~> 1.3"}, {:telemetry_metrics, "~> 0.6"}, {:telemetry_poller, "~> 1.0"}, {:gettext, "~> 0.18"}, {:jason, "~> 1.2"}, {:plug_cowboy, "~> 2.5"}, {:csv, "~> 2.4"}, {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false} ] end # Aliases are shortcuts or tasks specific to the current project. # For example, to install project dependencies and perform other setup tasks, run: # # $ mix setup # # See the documentation for `Mix` for more info on aliases. defp aliases do [ setup: ["deps.get", "ecto.setup", "cmd npm install --prefix assets"], "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], "ecto.reset": ["ecto.drop", "ecto.setup"], "test.once": ["ecto.reset", "test"], ci: ["format --check-formatted", "credo", "dialyzer --format short", "ecto.reset", "test"], "assets.deploy": [ "cmd --cd assets npm run deploy", "esbuild default --minify", "phx.digest" ] ] end end
30.607143
97
0.563205
08ea2b189614c17474b49477d226fbe5fb5dc32a
7,099
exs
Elixir
.credo.exs
sdrew/protox
c28d02f1626b5cd39bad7de2b415d20ebbdf76ee
[ "MIT" ]
null
null
null
.credo.exs
sdrew/protox
c28d02f1626b5cd39bad7de2b415d20ebbdf76ee
[ "MIT" ]
null
null
null
.credo.exs
sdrew/protox
c28d02f1626b5cd39bad7de2b415d20ebbdf76ee
[ "MIT" ]
null
null
null
# This file contains the configuration for Credo and you are probably reading # this after creating it with `mix credo.gen.config`. # # If you find anything wrong or unclear in this file, please report an # issue on GitHub: https://github.com/rrrene/credo/issues # %{ # # You can have as many configs as you like in the `configs:` field. configs: [ %{ # # Run any config using `mix credo -C <name>`. If no config name is given # "default" is used. # name: "default", # # These are the files included in the analysis: files: %{ # # You can give explicit globs or simply directories. # In the latter case `**/*.{ex,exs}` will be used. # included: [ "lib/", "src/", "test/", "web/", "apps/*/lib/", "apps/*/src/", "apps/*/test/", "apps/*/web/" ], excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] }, # # Load and configure plugins here: # plugins: [], # # If you create your own checks, you must specify the source files for # them here, so they can be loaded by Credo before running the analysis. # requires: [], # # If you want to enforce a style guide and need a more traditional linting # experience, you can change `strict` to `true` below: # strict: false, # # To modify the timeout for parsing files, change this value: # parse_timeout: 5000, # # If you want to use uncolored output by default, you can change `color` # to `false` below: # color: true, # # You can customize the parameters of any check by adding a second element # to the tuple. # # To disable a check put `false` as second element: # # {Credo.Check.Design.DuplicatedCode, false} # checks: [ # ## Consistency Checks # {Credo.Check.Consistency.ExceptionNames, false}, {Credo.Check.Consistency.LineEndings, []}, {Credo.Check.Consistency.ParameterPatternMatching, []}, {Credo.Check.Consistency.SpaceAroundOperators, []}, {Credo.Check.Consistency.SpaceInParentheses, []}, {Credo.Check.Consistency.TabsOrSpaces, []}, # ## Design Checks # # You can customize the priority of any check # Priority values are: `low, normal, high, higher` # {Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, # You can also customize the exit_status of each check. # If you don't want TODO comments to cause `mix credo` to fail, just # set this value to 0 (zero). # {Credo.Check.Design.TagTODO, [exit_status: 2]}, {Credo.Check.Design.TagFIXME, []}, # ## Readability Checks # {Credo.Check.Readability.AliasOrder, []}, {Credo.Check.Readability.FunctionNames, []}, {Credo.Check.Readability.LargeNumbers, []}, {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, {Credo.Check.Readability.ModuleAttributeNames, []}, {Credo.Check.Readability.ModuleDoc, []}, {Credo.Check.Readability.ModuleNames, []}, {Credo.Check.Readability.ParenthesesInCondition, []}, {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, {Credo.Check.Readability.PredicateFunctionNames, []}, {Credo.Check.Readability.PreferImplicitTry, []}, {Credo.Check.Readability.RedundantBlankLines, []}, {Credo.Check.Readability.Semicolons, []}, {Credo.Check.Readability.SpaceAfterCommas, []}, {Credo.Check.Readability.StringSigils, []}, {Credo.Check.Readability.TrailingBlankLine, []}, {Credo.Check.Readability.TrailingWhiteSpace, []}, {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, {Credo.Check.Readability.VariableNames, []}, # ## Refactoring Opportunities # {Credo.Check.Refactor.CondStatements, []}, {Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 10]}, {Credo.Check.Refactor.FunctionArity, []}, {Credo.Check.Refactor.LongQuoteBlocks, []}, {Credo.Check.Refactor.MapInto, false}, {Credo.Check.Refactor.MatchInCondition, []}, {Credo.Check.Refactor.NegatedConditionsInUnless, []}, {Credo.Check.Refactor.NegatedConditionsWithElse, []}, {Credo.Check.Refactor.Nesting, []}, {Credo.Check.Refactor.UnlessWithElse, []}, {Credo.Check.Refactor.WithClauses, []}, # ## Warnings # {Credo.Check.Warning.BoolOperationOnSameValues, []}, {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, {Credo.Check.Warning.IExPry, []}, {Credo.Check.Warning.IoInspect, []}, {Credo.Check.Warning.LazyLogging, false}, {Credo.Check.Warning.MixEnv, false}, {Credo.Check.Warning.OperationOnSameValues, []}, {Credo.Check.Warning.OperationWithConstantResult, []}, {Credo.Check.Warning.RaiseInsideRescue, []}, {Credo.Check.Warning.UnusedEnumOperation, []}, {Credo.Check.Warning.UnusedFileOperation, []}, {Credo.Check.Warning.UnusedKeywordOperation, []}, {Credo.Check.Warning.UnusedListOperation, []}, {Credo.Check.Warning.UnusedPathOperation, []}, {Credo.Check.Warning.UnusedRegexOperation, []}, {Credo.Check.Warning.UnusedStringOperation, []}, {Credo.Check.Warning.UnusedTupleOperation, []}, {Credo.Check.Warning.UnsafeExec, []}, # # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) # # Controversial and experimental checks (opt-in, just replace `false` with `[]`) # {Credo.Check.Readability.StrictModuleLayout, false}, {Credo.Check.Consistency.MultiAliasImportRequireUse, []}, {Credo.Check.Consistency.UnusedVariableNames, false}, {Credo.Check.Design.DuplicatedCode, []}, {Credo.Check.Readability.AliasAs, []}, {Credo.Check.Readability.MultiAlias, []}, {Credo.Check.Readability.Specs, false}, {Credo.Check.Readability.SinglePipe, []}, {Credo.Check.Readability.WithCustomTaggedTuple, []}, {Credo.Check.Refactor.ABCSize, false}, {Credo.Check.Refactor.AppendSingleItem, []}, {Credo.Check.Refactor.DoubleBooleanNegation, []}, {Credo.Check.Refactor.ModuleDependencies, false}, {Credo.Check.Refactor.NegatedIsNil, []}, {Credo.Check.Refactor.PipeChainStart, []}, {Credo.Check.Refactor.VariableRebinding, false}, {Credo.Check.Warning.LeakyEnvironment, false}, {Credo.Check.Warning.MapGetUnsafePass, []}, {Credo.Check.Warning.UnsafeToAtom, false} # # Custom checks can be created using `mix credo.gen.check`. # ] } ] }
38.166667
97
0.607409
08ea2d2e1b4e1dda235ab7db5125c2b23c9fbc5c
1,510
ex
Elixir
web/models/team.ex
digitalronin/ticket-poker
e39ee9975ca0c1a9f06d5ef1ba2b3d22108bd573
[ "MIT" ]
4
2017-01-03T16:34:07.000Z
2017-07-12T09:24:03.000Z
web/models/team.ex
digitalronin/ticket-poker
e39ee9975ca0c1a9f06d5ef1ba2b3d22108bd573
[ "MIT" ]
null
null
null
web/models/team.ex
digitalronin/ticket-poker
e39ee9975ca0c1a9f06d5ef1ba2b3d22108bd573
[ "MIT" ]
null
null
null
defmodule TicketPoker.Team do use TicketPoker.Web, :model @primary_key {:id, :binary_id, autogenerate: true} schema "teams" do field :name, :string field :points, {:array, :integer} field :points_string, :string, virtual: true field :coders, {:array, :string} has_many :tickets, TicketPoker.Ticket timestamps() end def pre_process_points(nil), do: [] def pre_process_points(""), do: [] def pre_process_points(str) do str |> String.replace(~r/[^0-9\s]/, " ") |> String.replace(~r/\s+/, " ") |> String.trim |> String.split(" ") |> Enum.map(&String.to_integer/1) |> Enum.sort |> Enum.uniq end def pre_process_coders(nil), do: [] def pre_process_coders(""), do: [] def pre_process_coders(str) when is_binary(str) do str |> String.split("\n") |> Enum.map(&String.trim/1) |> Enum.reject(fn(s) -> s == "" end) |> Enum.sort |> Enum.uniq end def pre_process_coders(arr), do: arr @doc """ Builds a changeset based on the `struct` and `params`. """ def changeset(struct, params \\ %{}) do struct |> cast(params, [:name, :points, :points_string, :coders]) |> validate_required([:name, :points, :coders]) |> build_points_string end defp build_points_string(changeset) do put_change(changeset, :points_string, points_string(changeset.data)) end defp points_string(%{ points: nil }), do: "" defp points_string(%{ points: points }), do: Enum.join(points, " ") end
23.59375
72
0.624503
08ea7b973cd62dbfc1ad0bd0846e8b8be317802a
9,254
ex
Elixir
lib/elixir/unicode/unicode.ex
jfornoff/elixir
4ed5e8e66973ae7b0e52ead00f65117ab0d600e0
[ "Apache-2.0" ]
null
null
null
lib/elixir/unicode/unicode.ex
jfornoff/elixir
4ed5e8e66973ae7b0e52ead00f65117ab0d600e0
[ "Apache-2.0" ]
null
null
null
lib/elixir/unicode/unicode.ex
jfornoff/elixir
4ed5e8e66973ae7b0e52ead00f65117ab0d600e0
[ "Apache-2.0" ]
null
null
null
# How to update the Unicode files # # 1. Update CompositionExclusions.txt by copying original as is # 2. Update GraphemeBreakProperty.txt by copying original as is # 3. Update PropList.txt by copying original as is # 4. Update GraphemeBreakTest.txt by copying original as is # 5. Update SpecialCasing.txt by removing comments and conditional mappings from original # 6. Update String.Unicode.version/0 and on String module docs # 7. make unicode # 8. elixir lib/elixir/unicode/graphemes_test.exs # defmodule String.Unicode do @moduledoc false def version, do: {10, 0, 0} cluster_path = Path.join(__DIR__, "GraphemeBreakProperty.txt") regex = ~r/(?:^([0-9A-F]+)(?:\.\.([0-9A-F]+))?)\s+;\s(\w+)/m cluster = Enum.reduce(File.stream!(cluster_path), %{}, fn line, acc -> case Regex.run(regex, line, capture: :all_but_first) do ["D800", "DFFF", _class] -> acc [first, "", class] -> codepoint = <<String.to_integer(first, 16)::utf8>> Map.update(acc, class, [codepoint], &[<<String.to_integer(first, 16)::utf8>> | &1]) [first, last, class] -> range = String.to_integer(first, 16)..String.to_integer(last, 16) codepoints = Enum.map(range, fn int -> <<int::utf8>> end) Map.update(acc, class, codepoints, &(codepoints ++ &1)) nil -> acc end end) # Don't break CRLF def next_grapheme_size(<<?\r, ?\n, rest::binary>>) do {2, rest} end # Break on control for codepoint <- cluster["CR"] ++ cluster["LF"] ++ cluster["Control"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do {unquote(byte_size(codepoint)), rest} end end # Break on Prepend* for codepoint <- cluster["Prepend"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_prepend_size(rest, unquote(byte_size(codepoint))) end end # Handle Regional for codepoint <- cluster["Regional_Indicator"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_regional_size(rest, unquote(byte_size(codepoint))) end end # Handle Hangul L for codepoint <- cluster["L"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_hangul_l_size(rest, unquote(byte_size(codepoint))) end end # Handle Hangul V for codepoint <- cluster["LV"] ++ cluster["V"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_hangul_v_size(rest, unquote(byte_size(codepoint))) end end # Handle Hangul T for codepoint <- cluster["LVT"] ++ cluster["T"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_hangul_t_size(rest, unquote(byte_size(codepoint))) end end # Handle E_Base for codepoint <- cluster["E_Base"] ++ cluster["E_Base_GAZ"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_extend_size(rest, unquote(byte_size(codepoint)), :e_base) end end # Handle ZWJ for codepoint <- cluster["ZWJ"] do def next_grapheme_size(<<unquote(codepoint), rest::binary>>) do next_extend_size(rest, unquote(byte_size(codepoint)), :zwj) end end # Handle extended entries def next_grapheme_size(<<cp::utf8, rest::binary>>) do case cp do x when x <= 0x007F -> next_extend_size(rest, 1, :other) x when x <= 0x07FF -> next_extend_size(rest, 2, :other) x when x <= 0xFFFF -> next_extend_size(rest, 3, :other) _ -> next_extend_size(rest, 4, :other) end end def next_grapheme_size(<<_, rest::binary>>) do {1, rest} end def next_grapheme_size(<<>>) do nil end # Handle hanguls defp next_hangul_l_size(rest, size) do case next_hangul(rest, size) do {:l, rest, size} -> next_hangul_l_size(rest, size) {:v, rest, size} -> next_hangul_v_size(rest, size) {:lv, rest, size} -> next_hangul_v_size(rest, size) {:lvt, rest, size} -> next_hangul_t_size(rest, size) _ -> next_extend_size(rest, size, :other) end end defp next_hangul_v_size(rest, size) do case next_hangul(rest, size) do {:v, rest, size} -> next_hangul_v_size(rest, size) {:t, rest, size} -> next_hangul_t_size(rest, size) _ -> next_extend_size(rest, size, :other) end end defp next_hangul_t_size(rest, size) do case next_hangul(rest, size) do {:t, rest, size} -> next_hangul_t_size(rest, size) _ -> next_extend_size(rest, size, :other) end end for codepoint <- cluster["L"] do defp next_hangul(<<unquote(codepoint), rest::binary>>, size) do {:l, rest, size + unquote(byte_size(codepoint))} end end for codepoint <- cluster["V"] do defp next_hangul(<<unquote(codepoint), rest::binary>>, size) do {:v, rest, size + unquote(byte_size(codepoint))} end end for codepoint <- cluster["T"] do defp next_hangul(<<unquote(codepoint), rest::binary>>, size) do {:t, rest, size + unquote(byte_size(codepoint))} end end for codepoint <- cluster["LV"] do defp next_hangul(<<unquote(codepoint), rest::binary>>, size) do {:lv, rest, size + unquote(byte_size(codepoint))} end end for codepoint <- cluster["LVT"] do defp next_hangul(<<unquote(codepoint), rest::binary>>, size) do {:lvt, rest, size + unquote(byte_size(codepoint))} end end defp next_hangul(_, _) do false end # Handle regional for codepoint <- cluster["Regional_Indicator"] do defp next_regional_size(<<unquote(codepoint), rest::binary>>, size) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :other) end end defp next_regional_size(rest, size) do next_extend_size(rest, size, :other) end # Handle Extend+SpacingMark+ZWJ for codepoint <- cluster["Extend"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, marker) do next_extend_size(rest, size + unquote(byte_size(codepoint)), keep_ebase(marker)) end end for codepoint <- cluster["SpacingMark"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, _marker) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :other) end end for codepoint <- cluster["ZWJ"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, _marker) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :zwj) end end for codepoint <- cluster["E_Modifier"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, :e_base) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :other) end end for codepoint <- cluster["Glue_After_Zwj"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, :zwj) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :other) end end for codepoint <- cluster["E_Base_GAZ"] do defp next_extend_size(<<unquote(codepoint), rest::binary>>, size, :zwj) do next_extend_size(rest, size + unquote(byte_size(codepoint)), :e_base) end end defp next_extend_size(rest, size, _) do {size, rest} end defp keep_ebase(:e_base), do: :e_base defp keep_ebase(_), do: :other # Handle Prepend for codepoint <- cluster["Prepend"] do defp next_prepend_size(<<unquote(codepoint), rest::binary>>, size) do next_prepend_size(rest, size + unquote(byte_size(codepoint))) end end # However, if we see a control character, we have to break it for codepoint <- cluster["CR"] ++ cluster["LF"] ++ cluster["Control"] do defp next_prepend_size(<<unquote(codepoint), _::binary>> = rest, size) do {size, rest} end end defp next_prepend_size(rest, size) do case next_grapheme_size(rest) do {more, rest} -> {more + size, rest} nil -> {size, rest} end end # Graphemes def graphemes(binary) when is_binary(binary) do do_graphemes(next_grapheme_size(binary), binary) end defp do_graphemes({size, rest}, binary) do [binary_part(binary, 0, size) | do_graphemes(next_grapheme_size(rest), rest)] end defp do_graphemes(nil, _) do [] end # Length def length(string) when is_binary(string) do do_length(next_grapheme_size(string), 0) end defp do_length({_, rest}, acc) do do_length(next_grapheme_size(rest), acc + 1) end defp do_length(nil, acc), do: acc # Split at def split_at(string, pos) do do_split_at(string, 0, pos, 0) end defp do_split_at(string, acc, desired_pos, current_pos) when desired_pos > current_pos do case next_grapheme_size(string) do {count, rest} -> do_split_at(rest, acc + count, desired_pos, current_pos + 1) nil -> {acc, nil} end end defp do_split_at(string, acc, desired_pos, desired_pos) do {acc, string} end # Codepoints def next_codepoint(<<cp::utf8, rest::binary>>) do {<<cp::utf8>>, rest} end def next_codepoint(<<cp, rest::binary>>) do {<<cp>>, rest} end def next_codepoint(<<>>) do nil end def codepoints(binary) when is_binary(binary) do do_codepoints(next_codepoint(binary)) end defp do_codepoints({c, rest}) do [c | do_codepoints(next_codepoint(rest))] end defp do_codepoints(nil) do [] end end
28.650155
93
0.659715
08eaa5c6509ba30702975485ab865fff4438ce54
2,789
ex
Elixir
clients/slides/lib/google_api/slides/v1/model/update_table_cell_properties_request.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
1
2018-12-03T23:43:10.000Z
2018-12-03T23:43:10.000Z
clients/slides/lib/google_api/slides/v1/model/update_table_cell_properties_request.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
clients/slides/lib/google_api/slides/v1/model/update_table_cell_properties_request.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the elixir code generator program. # Do not edit the class manually. defmodule GoogleApi.Slides.V1.Model.UpdateTableCellPropertiesRequest do @moduledoc """ Update the properties of a TableCell. ## Attributes * `fields` (*type:* `String.t`, *default:* `nil`) - The fields that should be updated. At least one field must be specified. The root `tableCellProperties` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the table cell background solid fill color, set `fields` to `"tableCellBackgroundFill.solidFill.color"`. To reset a property to its default value, include its field name in the field mask but leave the field itself unset. * `objectId` (*type:* `String.t`, *default:* `nil`) - The object ID of the table. * `tableCellProperties` (*type:* `GoogleApi.Slides.V1.Model.TableCellProperties.t`, *default:* `nil`) - The table cell properties to update. * `tableRange` (*type:* `GoogleApi.Slides.V1.Model.TableRange.t`, *default:* `nil`) - The table range representing the subset of the table to which the updates are applied. If a table range is not specified, the updates will apply to the entire table. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :fields => String.t(), :objectId => String.t(), :tableCellProperties => GoogleApi.Slides.V1.Model.TableCellProperties.t(), :tableRange => GoogleApi.Slides.V1.Model.TableRange.t() } field(:fields) field(:objectId) field(:tableCellProperties, as: GoogleApi.Slides.V1.Model.TableCellProperties) field(:tableRange, as: GoogleApi.Slides.V1.Model.TableRange) end defimpl Poison.Decoder, for: GoogleApi.Slides.V1.Model.UpdateTableCellPropertiesRequest do def decode(value, options) do GoogleApi.Slides.V1.Model.UpdateTableCellPropertiesRequest.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Slides.V1.Model.UpdateTableCellPropertiesRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
41.014706
163
0.725708
08eaa639af9f89d9546d724a49506fcd003f0e7c
71
ex
Elixir
lib/honeystream_web/views/layout_view.ex
TheBeeCashers/HoneyStream
469a505b1c01597bc746f8eaf117410ae4bc56e0
[ "MIT" ]
6
2018-10-27T10:55:41.000Z
2018-11-06T04:48:33.000Z
lib/honeystream_web/views/layout_view.ex
TheBeeCashers/HoneyStream
469a505b1c01597bc746f8eaf117410ae4bc56e0
[ "MIT" ]
2
2018-10-28T14:18:16.000Z
2018-10-28T14:18:30.000Z
lib/honeystream_web/views/layout_view.ex
TheBeeCashers/HoneyStream
469a505b1c01597bc746f8eaf117410ae4bc56e0
[ "MIT" ]
null
null
null
defmodule HoneystreamWeb.LayoutView do use HoneystreamWeb, :view end
17.75
38
0.830986
08eabe68d8aee3b5993dacb217beaa07016cf300
1,191
ex
Elixir
lib/cinemix/endpoint.ex
lucidstack/cinemix
2bda8ce74052b0492c60ddb7682bed810204c593
[ "MIT" ]
null
null
null
lib/cinemix/endpoint.ex
lucidstack/cinemix
2bda8ce74052b0492c60ddb7682bed810204c593
[ "MIT" ]
null
null
null
lib/cinemix/endpoint.ex
lucidstack/cinemix
2bda8ce74052b0492c60ddb7682bed810204c593
[ "MIT" ]
null
null
null
defmodule Cinemix.Endpoint do use Phoenix.Endpoint, otp_app: :cinemix socket "/socket", Cinemix.UserSocket # Serve at "/" the static files from "priv/static" directory. # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in production. plug Plug.Static, at: "/", from: :cinemix, gzip: false, only: ~w(css fonts images js favicon.ico robots.txt) # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. if code_reloading? do socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket plug Phoenix.LiveReloader plug Phoenix.CodeReloader end plug Plug.RequestId plug Plug.Logger plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], json_decoder: Poison plug Plug.MethodOverride plug Plug.Head # The session will be stored in the cookie and signed, # this means its contents can be read but not tampered with. # Set :encryption_salt if you would also like to encrypt it. plug Plug.Session, store: :cookie, key: "_cinemix_key", signing_salt: "oeFYd7CL" plug Cinemix.Router end
27.697674
69
0.714526
08ead66daa05310af8a3a412eff7d05be2aa2cb0
3,563
ex
Elixir
lib/explay/request/auth.ex
sheharyarn/explay
72a5d1ae131cbbcb277cb47a2e6b5e7cb65d7a75
[ "MIT" ]
16
2016-10-17T19:58:32.000Z
2020-04-22T10:33:22.000Z
lib/explay/request/auth.ex
sheharyarn/explay
72a5d1ae131cbbcb277cb47a2e6b5e7cb65d7a75
[ "MIT" ]
2
2017-04-12T13:24:09.000Z
2021-08-29T15:17:14.000Z
lib/explay/request/auth.ex
sheharyarn/explay
72a5d1ae131cbbcb277cb47a2e6b5e7cb65d7a75
[ "MIT" ]
1
2017-04-06T15:02:55.000Z
2017-04-06T15:02:55.000Z
defmodule ExPlay.Request.Auth do use ExPlay.Request.Base @moduledoc """ Wrapper module to handle authentication for Google Play user """ @doc "Attempts to authenticate the user, returning a new instance with auth_token set" def authenticate(account) do response = account |> make_auth_request! |> parse_response case response do {:ok, token} -> {:ok, %{ account | auth_token: token } } {:error, reason} -> {:error, reason} end end @doc """ Authenticates, returning a new Account instance with auth_token if everything is valid. Otherwise, raises an error. """ def authenticate!(account) do case authenticate(account) do {:ok, account} -> account {:error, _} -> raise "Could not authenticate account" end end @doc "Make Authentication request for an Account instance" def make_auth_request!(account) do post!(@url.auth, auth_body(account), auth_headers) end @doc "Parses Authentication request response for useful information" def parse_response(%HTTPoison.Response{body: body}) do cond do Regex.match?(@regex.auth.success, body) -> [_, token] = Regex.run(@regex.auth.success, body) {:ok, token} Regex.match?(@regex.auth.error, body) -> [_, error_code] = Regex.run(@regex.auth.error, body) {:error, [error_code, error_message(error_code)]} true -> {:error, ["AuthUnavailable", "Auth Code unavailable for some reason"]} end end @doc "Keyword List of required authentication headers" def auth_headers do [{"Content-type", @defaults.content_type}] end @doc "Prepares Keyword List of required body params for User authentication" def auth_body(account) do [ { "Email", account.email }, { "Passwd", account.password }, { "androidId", account.device_id }, { "source", @defaults.source }, { "app", @defaults.vending }, { "lang", @defaults.language }, { "service", @defaults.service }, { "sdk_version", @defaults.sdk_version }, { "accountType", @defaults.account_type }, { "has_permission", @defaults.has_permission }, { "device_country", @defaults.country_code }, { "operatorCountry", @defaults.country_code } ] end # Private Methods defp error_message(code) do case code do "BadAuthentication" -> "Incorrect username or password." "NotVerified" -> "The account email address has not been verified. You need to access your Google account directly to resolve the issue before logging in here." "TermsNotAgreed" -> "You have not yet agreed to Google's terms, acccess your Google account directly to resolve the issue before logging in using here." "CaptchaRequired" -> "A CAPTCHA is required. (not supported, try logging in another tab)" "Unknown" -> "Unknown or unspecified error; the request contained invalid input or was malformed." "AccountDeleted" -> "The user account has been deleted." "AccountDisabled" -> "The user account has been disabled." "ServiceDisabled" -> "Your access to the specified service has been disabled. (The user account may still be valid.)" "ServiceUnavailable" -> "The service is not available; try again later." _ -> "Unknown Error" end end end
35.277228
173
0.62307
08ead7deb59dd0e9e4b9487f1b3850a998ba5526
3,251
ex
Elixir
lib/cloudinary/format.ex
h-ikeda/cloudinary-elixir
5e70aedb6d1e51839f1e21c49b40293036b99efd
[ "MIT" ]
1
2021-05-23T09:17:44.000Z
2021-05-23T09:17:44.000Z
lib/cloudinary/format.ex
h-ikeda/cloudinary-elixir
5e70aedb6d1e51839f1e21c49b40293036b99efd
[ "MIT" ]
44
2020-05-15T03:36:36.000Z
2022-03-23T21:39:11.000Z
lib/cloudinary/format.ex
h-ikeda/cloudinary-elixir
5e70aedb6d1e51839f1e21c49b40293036b99efd
[ "MIT" ]
null
null
null
defmodule Cloudinary.Format do @moduledoc """ The cloudinary supported formats of images, videos and audios. ## Official documentation * https://cloudinary.com/documentation/image_transformations#supported_image_formats * https://cloudinary.com/documentation/video_manipulation_and_delivery#supported_video_formats * https://cloudinary.com/documentation/audio_transformations#supported_audio_formats """ @typedoc """ The cloudinary supported formats of images, videos and audios. """ @type t :: :ai | :gif | :webp | :bmp | :djvu | :ps | :ept | :eps | :eps3 | :fbx | :flif | :gltf | :heif | :heic | :ico | :indd | :jpg | :jpe | :jpeg | :jp2 | :wdp | :jxr | :hdp | :pdf | :png | :psd | :arw | :cr2 | :svg | :tga | :tif | :tiff | :"3g2" | :"3gp" | :avi | :flv | :m3u8 | :ts | :m2ts | :mts | :mov | :mkv | :mp4 | :mpeg | :mpd | :mxf | :ogv | :webm | :wmv | :aac | :aiff | :amr | :flac | :m4a | :mp3 | :ogg | :opus | :wav @doc """ Returns true if the format of the image, video or audio is supported by the cloudinary. ## Example iex> Cloudinary.Format.is_supported(:png) true iex> Cloudinary.Format.is_supported(:txt) false """ defguard is_supported(format) when format in [ :ai, :gif, :webp, :bmp, :djvu, :ps, :ept, :eps, :eps3, :fbx, :flif, :gltf, :heif, :heic, :ico, :indd, :jpg, :jpe, :jpeg, :jp2, :wdp, :jxr, :hdp, :pdf, :png, :psd, :arw, :cr2, :svg, :tga, :tif, :tiff, :"3g2", :"3gp", :avi, :flv, :m3u8, :ts, :m2ts, :mts, :mov, :mkv, :mp4, :mpeg, :mpd, :mxf, :ogv, :webm, :wmv, :aac, :aiff, :amr, :flac, :m4a, :mp3, :ogg, :opus, :wav ] end
22.734266
96
0.302061
08eae78aeb06d10e7ce0accee187e9591bd964cf
1,540
ex
Elixir
test/support/data_case.ex
Cadiac/titeenit-backend
51db7a1f93dc78a769bb309b94b1b893cefdcdc9
[ "MIT" ]
null
null
null
test/support/data_case.ex
Cadiac/titeenit-backend
51db7a1f93dc78a769bb309b94b1b893cefdcdc9
[ "MIT" ]
null
null
null
test/support/data_case.ex
Cadiac/titeenit-backend
51db7a1f93dc78a769bb309b94b1b893cefdcdc9
[ "MIT" ]
null
null
null
defmodule Titeenipeli.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously by setting `use Titeenipeli.DataCase, async: true`, although this option is not recommended for other databases. """ use ExUnit.CaseTemplate using do quote do alias Titeenipeli.Repo import Ecto import Ecto.Changeset import Ecto.Query import Titeenipeli.DataCase end end setup tags do pid = Ecto.Adapters.SQL.Sandbox.start_owner!(Titeenipeli.Repo, shared: not tags[:async]) on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) :ok end @doc """ A helper that transforms changeset errors into a map of messages. assert {:error, changeset} = Accounts.create_user(%{password: "short"}) assert "password is too short" in errors_on(changeset).password assert %{password: ["password is too short"]} = errors_on(changeset) """ def errors_on(changeset) do Ecto.Changeset.traverse_errors(changeset, fn {message, opts} -> Regex.replace(~r"%{(\w+)}", message, fn _, key -> opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() end) end) end end
29.615385
92
0.699351
08eb0aa60c4328eefa52cf350678a32f8a4f9e45
5,413
ex
Elixir
lib/hpack/context.ex
kiennt/hpack
6047e69204796c69b789bb9a96689430c92577d4
[ "MIT" ]
1
2016-03-13T00:03:17.000Z
2016-03-13T00:03:17.000Z
lib/hpack/context.ex
kiennt/hpack
6047e69204796c69b789bb9a96689430c92577d4
[ "MIT" ]
null
null
null
lib/hpack/context.ex
kiennt/hpack
6047e69204796c69b789bb9a96689430c92577d4
[ "MIT" ]
null
null
null
defmodule HPACK.Context do defstruct max_size: 4096, table: [], size: 0, encode: :incremental, huffman: true @static_table [ {1, ":authority", ""}, {2, ":method", "GET"}, {3, ":method", "POST"}, {4, ":path", "/"}, {5, ":path", "/index.html"}, {6, ":scheme", "http"}, {7, ":scheme", "https"}, {8, ":status", "200"}, {9, ":status", "204"}, {10, ":status", "206"}, {11, ":status", "304"}, {12, ":status", "400"}, {13, ":status", "404"}, {14, ":status", "500"}, {15, "accept-charset", ""}, {16, "accept-encoding", "gzip, deflate"}, {17, "accept-language", ""}, {18, "accept-ranges", ""}, {19, "accept", ""}, {20, "access-control-allow-origin", ""}, {21, "age", ""}, {22, "allow", ""}, {23, "authorization", ""}, {24, "cache-control", ""}, {25, "content-disposition", ""}, {26, "content-encoding", ""}, {27, "content-language", ""}, {28, "content-length", ""}, {29, "content-location", ""}, {30, "content-range", ""}, {31, "content-type", ""}, {32, "cookie", ""}, {33, "date", ""}, {34, "etag", ""}, {35, "expect", ""}, {36, "expires", ""}, {37, "from", ""}, {38, "host", ""}, {39, "if-match", ""}, {40, "if-modified-since", ""}, {41, "if-none-match", ""}, {42, "if-range", ""}, {43, "if-unmodified-since", ""}, {44, "last-modified", ""}, {45, "link", ""}, {46, "location", ""}, {47, "max-forwards", ""}, {48, "proxy-authenticate", ""}, {49, "proxy-authorization", ""}, {50, "range", ""}, {51, "referer", ""}, {52, "refresh", ""}, {53, "retry-after", ""}, {54, "server", ""}, {55, "set-cookie", ""}, {56, "strict-transport-security", ""}, {57, "transfer-encoding", ""}, {58, "user-agent", ""}, {59, "vary", ""}, {60, "via", ""}, {61, "www-authenticate", ""} ] def new(options \\ %{}) do %__MODULE__{ max_size: options[:max_size] || 4096, table: [], size: 0, encode: options[:encode] || :incremental, huffman: options[:huffman] || true } end @doc """ Get header at specified index in table http://httpwg.org/specs/rfc7541.html#string.literal.representation """ @static_table |> Enum.each(fn({index, name, value}) -> def at(_, unquote(index)), do: {unquote(name), unquote(value)} end) def at(context, index), do: Enum.at(context.table, index - 62) @doc """ Find index of a header http://httpwg.org/specs/rfc7541.html#string.literal.representation """ def find(%__MODULE__{table: table}, {name, value}) do index = Enum.find_index(table, fn({n, v}) -> n == name && v == value end) if index do {:indexed, index + 62} else name_index = Enum.find_index(table, fn({n, _}) -> n == name end) if name_index do {:name_index, name_index + 62} else static_find({name, value}) end end end @doc """ Change size of dynamic table http://httpwg.org/specs/rfc7541.html#string.literal.representation """ def change_size(%__MODULE__{table: table, size: size} = context, new_size) do do_change_size(%__MODULE__{ max_size: new_size, table: table, size: size, encode: context.encode, huffman: context.huffman, }) end @doc """ Add new header into dynamic table http://httpwg.org/specs/rfc7541.html#string.literal.representation """ def add(context, header) do do_add(context, header, entry_size(header)) end ############################################################################# # Private functions ############################################################################# @static_table |> Enum.each(fn({index, name, value}) -> defp static_find({unquote(name), unquote(value)}), do: {:indexed, unquote(index)} end) @static_table |> Enum.each(fn({index, name, value}) -> defp static_find({unquote(name), _}), do: {:name_index, unquote(index)} end) defp static_find({_, _}), do: {:none} defp do_change_size(%__MODULE__{max_size: max_size, size: size} = context) when max_size >= size, do: context defp do_change_size(context), do: do_change_size(drop_last(context)) defp do_add(%__MODULE__{max_size: max_size, table: table, size: size} = context, header, header_size) when max_size >= size + header_size do %__MODULE__{ max_size: max_size, table: [header | table], size: size + header_size, encode: context.encode, huffman: context.huffman, } end defp do_add(%__MODULE__{max_size: max_size} = context, _, header_size) when header_size > max_size do %__MODULE__{ max_size: max_size, table: [], size: 0, encode: context.encode, huffman: context.huffman, } end defp do_add(context, header, header_size) do do_add(drop_last(context), header, header_size) end def drop_last(%__MODULE__{table: []} = context) do context end def drop_last(%__MODULE__{max_size: max_size, table: table, size: size} = context) do [last | new_table] = Enum.reverse(table) %__MODULE__{ max_size: max_size, table: Enum.reverse(new_table), size: size - entry_size(last), encode: context.encode, huffman: context.huffman, } end def entry_size({name, value}), do: 32 + byte_size(name) + byte_size(value) end
28.946524
103
0.551635